const mixin crypto::PubKey
crypto::PubKey : crypto::AsymKey
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")
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)