Sample code for 30+ languages & platforms
Go

RSA Import Public Key

See more RSA Examples

Shows how to select/import a public key for RSA encryption or signature verification.

Chilkat Go Downloads

Go
    success := false

    pubKey := chilkat.NewPublicKey()
    // In all Chilkat methods expecting a path, you pass either absolute or relative paths.
    success = pubKey.LoadFromFile("rsaKeys/myTestRsaPublic.pem")
    if success == false {
        fmt.Println(pubKey.LastErrorText())
        pubKey.DisposePublicKey()
        return
    }

    rsa := chilkat.NewRsa()

    // Tell RSA to use the public key.
    rsa.UsePublicKey(pubKey)

    pubKey.DisposePublicKey()
    rsa.DisposeRsa()