This namespace provides functionality to generate PGP keypairs and keyrings using a convenient macro syntax.
The two primary supported key types are RSA keys (via rsa-keypair-generator
)
and Elliptic Curve keys (via ec-keypair-generator
). A set of the supported
named curves can be found in elliptic-curve-names
.
To generate PGP keyrings with designater master keys and subkeys with specific
roles and restrictions, use the generate-keys
macro. This returns a map with
:public
and :secret
entries containing the respective keyrings.
This namespace provides functionality to generate PGP keypairs and keyrings using a convenient macro syntax. The two primary supported key types are RSA keys (via `rsa-keypair-generator`) and Elliptic Curve keys (via `ec-keypair-generator`). A set of the supported named curves can be found in `elliptic-curve-names`. To generate PGP keyrings with designater master keys and subkeys with specific roles and restrictions, use the `generate-keys` macro. This returns a map with `:public` and `:secret` entries containing the respective keyrings.
(add-subkey! generator subkey sig-gen)
Adds a subkey and signature packet to a keyring genrator.
Adds a subkey and signature packet to a keyring genrator.
(ec-keypair-generator curve & opts)
Constructs a new generator for keypairs on the named elliptic curve.
Opts may include:
:random
a custom random number generatorConstructs a new generator for keypairs on the named elliptic curve. Opts may include: - `:random` a custom random number generator
Set of supported elliptic curves.
Set of supported elliptic curves.
(generate-keypair generator algorithm)
Builds a new PGP keypair from a generator.
Builds a new PGP keypair from a generator.
(generate-keyrings keyring-gen)
Generates both the public and secret keyrings from the given generator.
Generates both the public and secret keyrings from the given generator.
(generate-keys user-id passphrase & key-specs)
Macro to generate keys with a mini-language to specify preferences and subkeys.
An example invocation that creates a master key with signing and encryption subkeys:
(pgp-gen/generate-keys
"test user" "test passphrase"
(master-key
(keypair rsa :rsa-general)
(prefer-symmetric :aes-256 :aes-128)
(prefer-hash :sha512 :sha256 :sha1)
(prefer-compression :zlib :bzip2))
(signing-key
(keypair rsa :rsa-general)
(expires 36000))
(encryption-key
(keypair rsa :rsa-general)))
Macro to generate keys with a mini-language to specify preferences and subkeys. An example invocation that creates a master key with signing and encryption subkeys: ``` (pgp-gen/generate-keys "test user" "test passphrase" (master-key (keypair rsa :rsa-general) (prefer-symmetric :aes-256 :aes-128) (prefer-hash :sha512 :sha256 :sha1) (prefer-compression :zlib :bzip2)) (signing-key (keypair rsa :rsa-general) (expires 36000)) (encryption-key (keypair rsa :rsa-general))) ```
(keyring-generator user-id passphrase master-key master-sig-gen)
Constructs a new generator for a keyring for a user-id, encrypted with the given passphrase. The provided keypair will become the master key with any options specified in the signature subpacket.
Constructs a new generator for a keyring for a user-id, encrypted with the given passphrase. The provided keypair will become the master key with any options specified in the signature subpacket.
(prefer-compression-algorithms! generator__5827__auto__
&
algorithms__5828__auto__)
Sets the list of preferred algorithms on a signature generator for use when sending messages to the key.
Sets the list of preferred algorithms on a signature generator for use when sending messages to the key.
(prefer-hash-algorithms! generator__5827__auto__ & algorithms__5828__auto__)
Sets the list of preferred algorithms on a signature generator for use when sending messages to the key.
Sets the list of preferred algorithms on a signature generator for use when sending messages to the key.
(prefer-symmetric-algorithms! generator__5827__auto__
&
algorithms__5828__auto__)
Sets the list of preferred algorithms on a signature generator for use when sending messages to the key.
Sets the list of preferred algorithms on a signature generator for use when sending messages to the key.
(rsa-keypair-generator strength & opts)
Constructs a new generator for RSA keypairs with the given bit strength. Other parameters may be customized with keyword options.
Opts may include:
:random
a custom random number generator:exponent
RSA algorithm public exponent:certainty
threshold for probabilistic prime generationConstructs a new generator for RSA keypairs with the given bit strength. Other parameters may be customized with keyword options. Opts may include: - `:random` a custom random number generator - `:exponent` RSA algorithm public exponent - `:certainty` threshold for probabilistic prime generation
(set-key-expiration! generator lifetime)
Sets a key expiration time on a signature generator. The lifetime is expressed as a number of seconds since the key creation time.
Sets a key expiration time on a signature generator. The lifetime is expressed as a number of seconds since the key creation time.
(signature-generator mode)
Constructs a signature subpacket generator with a preset mode. This can be
one of :master
, :signing
, or :encryption
.
Constructs a signature subpacket generator with a preset mode. This can be one of `:master`, `:signing`, or `:encryption`.
(signature-subpacket-generator & flags)
Constructs a new generator for key signature subpackets. The given flags will be applied to the key.
Constructs a new generator for key signature subpackets. The given flags will be applied to the key.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close