encryptAsymmWith method

DummyCastle encryptAsymmWith(
  1. String plainText,
  2. CryptAsymmKey key
)

Encrypts provided text using asymmetric encryption. The result may be obtained using getResult() method and it is not encoded. Use decryptSymm() to decrypt the result. Use decryptAsymm() to decrypt.

param plainText to encrypt. param key contains data used to encrypt plain text. If it is an instance of a CryptAsymmPublicKey class, a CryptAsymmPrivateKey object should be used to decrypt the text. return this object for chaining.

Implementation

DummyCastle encryptAsymmWith(String plainText, CryptAsymmKey key) {
  if (((plainText == null) || plainText.isEmpty) || (key == null)) {
    exception = new Exception("Empty or null argument");
    error = true;
    return this;
  }

  try {
    resultBytes =
        CryptAsymm.encryptStream(Coder.getBytesSimple(plainText), key);
  } on Exception catch (e) {
    setUpError(e);
  }
  return this;
}