type

PubKey

const mixin PubKey : AsymKey

A public key in an asymmetric key pair. A public key can be used to verify and encrypt data.

methods

encrypt

Encrypt the contents of the data buffer and return the result.

verify

Throws an Err if the digest algorithm is not supported.

Slot Details

encrypt

abstract Buf encrypt(Buf data, Str padding := "PKCS1Padding")

Encrypt the contents of the data buffer and return the result.

Throws an Err if the algorithm does not support encryption, or if the padding is not supported for the algorithm.

encrypted := pubKey.encrypt("Message".toBuf)

verify

abstract Bool verify(Buf data, Str digest, Buf signature)

Throws an Err if the digest algorithm is not supported.

valid := pubKey.verify("Message".toBuf, "SHA512", signature)