Web::I...nerator(3pm)

πŸ“¦
version 1.927 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ NAME ✨

Web::ID::Certificate::Generator β€” it's a role for Web::ID::Certificate πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

use Web::ID::Certificate::Generator;

my %options = (
  cert_output       => '/home/alice/webid.p12',
  passphrase        => 's3cr3t s0urc3',
  rdf_output        => '/home/alice/public_html/foaf.rdf',
  subject_alt_names => [
    Web::ID::SAN::URI->new(
      value => 'http://example.com/~alice/foaf.rdf#me',
    ),
    Web::ID::SAN::Email->new(
      value => 'alice@example.com',
    ),
  ],
  subject_name      => 'Alice Jones',
  subject_locality  => 'Lewes',
  subject_region    => 'East Sussex',
  subject_country   => 'GB',   # ISO 3166-1 alpha-2 code
);

my $cert = Web::ID::Certificate->generate(%options);

🌸 DESCRIPTION 🌸

Okay bestie, so Web::ID::Certificate::Generator is a role that you can apply to Web::ID::Certificate. And like… it is not consumed by Web::ID::Certificate by default, because the author was literally trying to avoid tainting the class with the horror that's found in this role πŸ’€ (their words, not mine, and honestly? valid).

The good news: the import routine of this package applies the role to Web::ID::Certificate for you, so this is genuinely all you need:

use Web::ID::Certificate::Generator;

You do not need to muck around with apply_all_roles yourself. Not even a little. 🫢

πŸ’… Constructor

  • generate(%options) β€” Generates a brand new WebID-enabled certificate. That's it, that's the whole vibe. ✨

🌈 Options

These are the options you can pass to generator πŸ‘‘

  • cert_output β€” A passphrase-protected PKCS12 certificate file gets generated as part of the certificate generation process. The PKCS12 file is the thing you'd typically import into a browser 🌐.

You can pass a scalar reference, and in that case the PKCS12 data gets written to that scalar; or you can pass a file handle or a string file name.

This is a required option. No skipping, bestie.
  • passphrase β€” The password for the PKCS12 file πŸ”.
This is a required option.
  • rdf_output β€” RDF data is also generated as part of the certificate generation process πŸ¦‹.

Again, a file handle or string file name can be passed, or an RDF::Trine::Model.

This is a required option.
  • subject_alt_names β€” A list of Web::ID::SAN objects, used to generate the certificate's subjectAltNames field. You want at least one Web::ID::SAN::URI in there, fr fr.
This is a required option.
  • subject_name β€” The name of the person who will hold the certificate. (e.g. "Alice Smith".) πŸ‘‘
This is a required option.
  • subject_org β€” The certificate holder's organisation.

Not required πŸ’œ

  • subject_locality β€” The locality (e.g. city) of the certificate holder's address.

Not required πŸ’œ

  • subject_region β€” The region (e.g. state or county) of the certificate holder's address.

Not required πŸ’œ

  • subject_country β€” Two letter ISO code for the country of the certificate holder's address.

Not required πŸ’œ

  • openssl_path β€” The path to the OpenSSL binary. And yes, that's right β€” this role calls the OpenSSL binary via system calls 😭 it's giving shelling out. Defaults to automatic discovery via Web::ID::Util::FindOpenSSL.
  • key_size β€” Key size in bits. Defaults to 1024. Bigger keys are more secure πŸ”₯. Keys bigger than 2048 bits will take a ridiculously long time to generate. Keys less than 512 bits are pretty poor πŸ™ˆ.
  • not_after β€” Date when the certificate should expire, as a DateTime object. Defaults to 365 days.

πŸ’€ BUGS AND LIMITATIONS πŸ’€

Generating the private key results in shedloads of nasty crud being spewed out on STDERR. Yeah. Not cute. 😭

Please report any bugs to <http://rt.cpan.org/Dist/Display.html?Queue=Web-ID>.


πŸ¦‹ SEE ALSO πŸ¦‹

Web::ID, Web::ID::Certificate.


🌟 AUTHOR 🌟

Toby Inkster <tobyink@cpan.org>.


This software is copyright (c) 2012 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Slay πŸ’…


πŸ‘‘ DISCLAIMER OF WARRANTIES πŸ‘‘

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Like, no promises. None. Zero. Nada. 🫢


Okay that's the whole page bestie, go generate some certificates πŸ’– This was Web::I...nerator(3pm) from perl v5.32.1, dated 2021-09-11 ✨ mwah 😘

πŸ“¦ where this page comes from