Crypt::...eyChain(3)

πŸ’– Crypt::DSA::KeyChain πŸ’–

okay bestie, pull up a chair β€” this is the Crypt::...eyChain(3) page from your friendly neighbourhood User Contributed Perl Documentation. It's giving "I make DSA keys and I'm lowkey iconic about it." Let's get into it. πŸŽ€


✨ NAME ✨

Crypt::DSA::KeyChain β€” the DSA key generation system. that's it, that's the name, slay. πŸ’…


✨ SYNOPSIS ✨

bestie here's the whole vibe in code form:

use Crypt::DSA::KeyChain;
my $keychain = Crypt::DSA::KeyChain->new;

my $key = $keychain->generate_params(
                Size      => 512,
                Seed      => $seed,
                Verbosity => 1,
          );

$keychain->generate_keys($key);

like. look at her go. πŸ¦‹


✨ DESCRIPTION ✨

Crypt::DSA::KeyChain is the lower-level interface to key generation β€” the one underneath the interface in Crypt::DSA (you know, the keygen method). It lets you generate the p, q, and g key parameters separately, given an optional starting seed and a mandatory bit size for p. And just so we're clear: q and g are 160 bits each, no negotiating. πŸ’€

then, once you've got all that, you can call generate_keys to generate the public and private portions of the key. main character energy fr fr. πŸ‘‘


✨ USAGE ✨

πŸ’« $keychain = Crypt::DSA::KeyChain->new

Constructs a brand new Crypt::DSA::KeyChain object. ngl, at the moment this isn't particularly useful in itself β€” it's mostly just the object you need in order to call the other methods. it's giving "I'm here to hold the vibes." 🫢

Returns the new object. ✨


πŸ’« $key = $keychain->generate_params(%arg)

Generates a set of DSA parameters: the p, q, and g values of the key. Heads up though β€” this involves finding primes, and as such it can be a relatively long process. like, go make a snack. πŸ“

When invoked in scalar context</>, it returns a new Crypt::DSA::Key object.

In list context, it returns the new Crypt::DSA::Key object, along with:

  • the value of the internal counter when a suitable prime p was found;
  • the value of h when g was derived;
  • and the value of the seed (a 20-byte string) when q was found.

These values aren't particularly useful in normal circumstances, but they could be useful. iykyk. πŸ™ˆ

%arg can contain:

  • Size β€” the size in bits of the p value to generate. The q and g values are always 160 bits each.

This argument is mandatory. no Size, no key, periodt. πŸ’…

  • Seed β€” a seed with which q generation will begin. If this seed does not lead to a suitable prime, it will be discarded, and a new random seed chosen in its place, until a suitable prime can be found.

This is entirely optional, and if not provided a random seed will be generated automatically.

Note: This module now uses Crypt::SysRandom to generate a seed. If you are not using one of the sources of randomness recommended at https://security.metacpan.org/docs/guides/random-data-for-security.html you should not (must not) provide your own Seed value. 😭
In particular, Perl's rand function must not be used for any session, token, hash, authentication, cryptographic value. Basically do not use rand unless you absolutely know how it will be used. seriously. bestie. I'm begging. πŸ’€
  • Verbosity β€” should be either 0 or 1. A value of 1 will give you a progress meter during p and q generation β€” this can be useful, since the process can be relatively long. (see: the snack comment above.)

The default is 0. ✨


πŸ’« $keychain->generate_keys($key)

Generates the public and private portions of the key $key, a Crypt::DSA::Key object. the glow-up portion of the program. 🌈


Please see the Crypt::DSA manpage for author, copyright, and license information. 🫢


and that's the page bestie!! πŸ’– this was brought to you by perl v5.42.2, dated 2026-07-03, and the manual Crypt::...eyChain(3). go forth and generate responsibly, no cap. πŸŽ€βœ¨πŸ¦‹πŸ’…

πŸ“¦ where this page comes from