const mixin crypto::PrivKey

crypto::PrivKey : crypto::AsymKey

A private key in an asymmetric key pair. A private key can be used to sign and decrypt data.

decrypt

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

Decrypt the contents of the data buffer and return the result. Throws Err if the decryption fails for any reason.

msg := privKey.decrypt(encrypted)
sign

abstract Buf sign(Buf data, Str digest)

Sign the contents of the data buffer after applying the given digest algorithm and return the signature. Throws Err if the digest algorithm is not supported.

signature := privKey.sign("Message".toBuf, "SHA512")