publicKey method

Rsa publicKey(
  1. dynamic key
)

Sets the public key on this encryption object.

Implementation

Rsa publicKey(dynamic key) {
  if (key is RSAPublicKey) {
    _publicKey = key;
  } else if (key is String) {
    _publicKey = RSAKeyParser().parse(key) as RSAPublicKey;
  } else {
    throw Exception(
      'Unknown publicKey type: [${key?.runtimeType.toString()}]',
    );
  }

  return this;
}