const mixin crypto::PubKey

crypto::PubKey : crypto::AsymKey

Source

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

encrypt

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

Source

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)

Source

Throws an Err if the digest algorithm is not supported.

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