APIPublic Key

Public Key

The public key of an actor.

Instance creation

PublicKey publicKey = PublicKey.from(object);
var publicKey = cn.publicKeyFromObject(object);
my $publicKey = CN::PublicKey->fromObject($object);

Parses the public key from the Condensation object returns a corresponding instance. This function returns nullundef if the object does not contain a parsable public key.

Encryption

Bytes encryptedBytes = publicKey.encrypt(bytes);
var encryptedBytes = publicKey.encrypt(bytes);
my $encryptedBytes = $publicKey->encrypt($bytes);

Encrypts bytes.

Signature verification

boolean ok = publicKey.verify(digestBytes, signatureBytes);
boolean ok = publicKey.verify(hash, signatureBytes);
var ok = publicKey.verifyHash(hash, signatureBytes);
my $ok = $publicKey->verifyHash($hash, $signatureBytes);

Verifies whether signatureBytes is a valid signature for hash or digestBytes.

Threading

Public keys are immutable objects and can be accessed concurrently from multiple threads.