Class EncryptionKey
java.lang.Object
org.apache.pulsar.client.api.v5.auth.EncryptionKey
A single encryption / decryption key returned by a
PublicKeyProvider or
PrivateKeyProvider.
The producer-side flow returns just the key bytes. The consumer-side flow may
include metadata() that the producer attached when the message was
encrypted (e.g. a key version) — the PrivateKeyProvider can use it to
pick the right private key when keys have been rotated.
Use of(byte[]) when there's no metadata, or of(byte[], Map)
to attach producer-side hints alongside the bytes.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]key()metadata()static EncryptionKeyof(byte[] key) Create anEncryptionKeywith no metadata.static EncryptionKeyCreate anEncryptionKeywith associated metadata.
-
Method Details
-
key
public byte[] key()- Returns:
- the raw key bytes
-
metadata
-
of
Create anEncryptionKeywith no metadata.- Parameters:
key- the raw key bytes- Returns:
- a new
EncryptionKey
-
of
Create anEncryptionKeywith associated metadata.- Parameters:
key- the raw key bytesmetadata- key-value metadata to attach to the key- Returns:
- a new
EncryptionKey
-