public byte[] decryptFrom(EncryptedData encryptedData, String recipientSecretPhrase) { if (getPublicKey() == null) { throw new IllegalArgumentException("Sender account doesn't have a public key set"); } return encryptedData.decrypt(Crypto.getPrivateKey(recipientSecretPhrase), publicKey); }
public EncryptedData encryptTo(byte[] data, String senderSecretPhrase) { if (getPublicKey() == null) { throw new IllegalArgumentException("Recipient account doesn't have a public key set"); } return EncryptedData.encrypt(data, Crypto.getPrivateKey(senderSecretPhrase), publicKey); }