privkey/algo-name privkey/check-key privkey/export privkey/get-field privkey/get-pubkey privkey/load privkey/load-dh privkey/load-dsa privkey/load-ecdh privkey/load-ecdsa privkey/load-ed25519 privkey/load-elgamal privkey/load-ml-kem privkey/load-rsa privkey/load-sm2 privkey/new privkey/new-ec privkey/oid privkey/remaining-operations privkey/stateful-operation privkey/to-der privkey/to-pem privkey/to-raw
(privkey/check-key privkey rng &opt weak)
Test the key for consistency. If weak is provided then less expensive tests are performed.
(privkey/export &opt pem)
Exports the private key in PKCS8 format. If `pem` is provided, the result is a PEM encoded string. Otherwise it is a binary DER value. The key will not be encrypted.
(privkey/get-field filed-name)
Return an integer field related to the private key. The valid field names vary depending on the algorithm. For example first RSA secret prime can be extracted with `(privkey/get-field key "p")`. This function can also be used to extract the public parameters.
(privkey/load blob &opt password)
Return a private key (DER or PEM formats accepted). No `password` indicate no encryption expected.
(privkey/load-ed25519 key)
Return a private ed25519 key created from a 32-byte raw key value.
(privkey/load-ml-kem key mode)
Return a private ML-KEM key based on the given mode.
(privkey/new algo param &opt rng)
Creates a new private key. The parameter type/value depends on the algorithm. For "rsa" it is the size of the key in bits. For "ecdsa" and "ecdh" it is a group name (for instance "secp256r1"). For "ecdh" there is also a special case for group "curve25519" (which is actually a completely distinct key type with a non-standard encoding). Use `rng` if provided.
(privkey/new-ec algo ec-group &opt rng)
Creates a new EC Group private key. Use `rng` if provided.
(privkey/remaining-operations privkey)
Return the number of remaining operations. If the key is not stateful, an error will be occurred.
(privkey/stateful-operation privkey)
Checks whether a key is stateful. Return a boolean.
(privkey/to-der privkey)
Return the unencrypted DER encoding of the private key.
(privkey/to-pem privkey)
Return the unencrypted PEM encoding of the private key.
(privkey/to-raw privkey)
Return the unencrypted canonical raw encoding of the private key. This might not be defined for all key types.