public class EncryptedMessage extends TypedMessage
Constructor and Description |
---|
EncryptedMessage(java.lang.String encryptedPayload)
It creates a Encrypted Message from the encryptedPayload.
|
Modifier and Type | Method and Description |
---|---|
static EncryptedMessage |
create(java.lang.String plainTextMessage,
PrivateKey senderPrivateKey,
PublicKey recipientPublicKey)
Helper constructor that allow users to easily encrypt a message using the SDK provided
CryptoEngine and BlockCipher . |
java.lang.String |
decryptPayload(PublicKey senderPublicKey,
PrivateKey recipientPrivateKey)
Utility method that allow users to decrypt a message if it was created using the Java SDK or
the Typescript SDK.
|
getPayloadByteBuffer, getText
createFromHexPayload, createFromPayload, equals, getPayload, getPayloadByteBuffer, getPayloadHex, getType, hashCode
public EncryptedMessage(java.lang.String encryptedPayload)
encryptedPayload
- the encrypted payload.public static EncryptedMessage create(java.lang.String plainTextMessage, PrivateKey senderPrivateKey, PublicKey recipientPublicKey)
CryptoEngine
and BlockCipher
.
Note, the strategy to encrypt and decrypt should be shared between the different SDKs. A client may send a transaction using a sdk and the recipient may be using a different one.
The strategy is:
"plain text" string - utf8 byte array - encrypted byte array - hex string (the encrypted message string)
plainTextMessage
- Plain message to be encryptedsenderPrivateKey
- Sender private keyrecipientPublicKey
- Recipient public keypublic java.lang.String decryptPayload(PublicKey senderPublicKey, PrivateKey recipientPrivateKey)
senderPublicKey
- Sender public key.recipientPrivateKey
- Recipient private key