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 AND LICENSE π
Copyright tea, exact:
Copyright (C) 2013 by Messiah CollegeCopyright (C) 2010 by Jason LongCopyright (C) 2017 by Standcore LLCCopyright (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
- alpine 3.23: perl-mail-dkim-doc 1.20240923-r0 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- opensuse-leap 16.0: perl-Mail-DKIM 1.20240923-bp160.1.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms