Mail::D...vateKey(3)

πŸ’– NAME πŸ’–

Okay bestie, welcome to the Mail::DKIM::PrivateKey page from User Contributed Perl Documentation. This module is literally a private key loaded in memory for DKIM signing, and it's giving main character key energy. πŸ”‘βœ¨

πŸŽ€ VERSION πŸŽ€

version 1.20240923 β€” that's the version, periodt. πŸ’…

✨ SYNOPSIS ✨

Here's the vibe check in code form:

        my $key1 = Mail::DKIM::PrivateKey->load(
                      File => '/path/to/private.key');

        my $key2 = Mail::DKIM::PrivateKey->load(
                      Data => $base64);

        # use the loaded key in a DKIM signing object
        my $dkim = Mail::DKIM::Signer->new(
                      Key => $key2,
                    );

So you load a key from a file, load another from Base64 data, then hand the loaded key to a DKIM signing object. Obsessed. 🫢


🌸 CONSTRUCTOR 🌸

πŸ¦‹ load() - loads a private key into memory πŸ¦‹

This is the constructor that gets your private key into memory. It's giving "come through, key." πŸ’…

First, from a file β€” it loads the Base64-encoded key from the specified file:

        my $key1 = Mail::DKIM::PrivateKey->load(
                      File => '/path/to/private.key');

Then from a string that's already in memory β€” it loads the Base64-encoded key from a string already in memory:

         my $key2 = Mail::DKIM::PrivateKey->load(Data => $base64);

Then the wrapper path β€” it creates a Mail::DKIM::PrivateKey wrapper object for the given OpenSSL key object:

         my $key3 = Mail::DKIM::PrivateKey->load(Cork => $openssl_object);

And that key object should be of type Crypt::OpenSSL::RSA. Not optional, bestie β€” that's the type. 🫢

πŸ”₯ METHODS πŸ”₯

πŸ’œ cork() - access the underlying OpenSSL key object πŸ’œ

Want the underlying OpenSSL key object? Say less:

         $openssl_object = $key->cork;

The returned object is of type Crypt::OpenSSL::RSA. That's the whole tea. β˜•

⭐ sign_digest() ⭐

This method cryptographically signs the given message digest. Iconic behavior. ✨

         $key->sign_digest('SHA-1', sha1('my message text'));

The first parameter is the name of the digest, and it's one of "SHA-1", "SHA-256" β€” yes, those exact strings. The second parameter is the message digest as a binary string. The result should be the signed digest as a binary string. Slay. πŸ’…

       1;

πŸ‘‘ AUTHORS πŸ‘‘

The people behind this masterpiece:

  • Jason Long <jason@long.name>
  • Marc Bradshaw <marc@marcbradshaw.net>
  • Bron Gondwana <brong@fastmailteam.com> (ARC)

🌈 THANKS 🌈

Work on ensuring that this module passes the ARC test suite was generously sponsored by Valimail (https://www.valimail.com/) β€” and we're grateful fr fr. 🫢

Copyright tea, exact:

  • Copyright (C) 2013 by Messiah College
  • Copyright (C) 2010 by Jason Long
  • Copyright (C) 2017 by Standcore LLC
  • Copyright (C) 2020 by FastMail Pty Ltd
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.

This page came from perl v5.42.0, dated 2024-09-23, and the footer name is Mail::D...vateKey(3). Bye bestie β€” go sign something cute! πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from