encrypt

open fun encrypt(publicKey: PublicKey, message: String): String

Encrypt a string with an RSA public key.

Return

The encrypted base 64 string.

Parameters

publicKey

The public key which is used to encrypt the message.

message

The message to encrypt.

Throws

If the key isn't long enough to encrypt this message.

If the algorithm can't be found on the system.

If the key can't be used for this process.


open fun encrypt(publicKey: PublicKey, bytes: Array<Byte>): String

Encrypt a byte array with an RSA public key.

Return

The encrypted base 64 string.

Parameters

publicKey

The public key which is used to encrypt the bytes.

bytes

The bytes to encrypt.

Throws

If the key isn't long enough to encrypt this message.

If the algorithm can't be found on the system.

If the key can't be used for this process.