DBIx::...penPGP(3pm)

๐Ÿ“ฆ
version 0.00020 ยท 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

๐Ÿ’– DBIx::Class::EncodedColumn::Crypt::OpenPGP โ€” the perl v5.40.1 era, User Contributed Perl Documentation vibe ๐Ÿ’–

okay bestie, sit down, hydrate, because we're about to make your database columns keep a secret ๐Ÿ”โœจ


โœจ NAME โœจ

DBIx::Class::EncodedColumn::Crypt::OpenPGP โ€” literally just: encrypt your columns using Crypt::OpenPGP. that's the whole job. iconique. ๐Ÿ’…


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

here's the vibe, no notes:

  __PACKAGE__->add_columns(
    'secret_data' => {
        data_type => 'TEXT',
        encode_column => 1,
        encode_class  => 'Crypt::OpenPGP',
        encode_args   => {
            recipient => '7BEF6294',
        },
        encode_check_method => 'decrypt_data',
 };

 my $row = $schema->resultset('EncryptedClass')
                ->create({ secret_data => 'This is secret' });

 is(
    $row->decrypt_data('Private Key Passphrase'),
        'This is secret',
        'PGP/GPG Encryption works!'
 );

see how clean that is?? you write it, it goes in encrypted, and you call decrypt_data with the passphrase to get your little secret back. ๐Ÿฆ‹


๐ŸŒธ DESCRIPTION ๐ŸŒธ

so this module is a conduit to working with Crypt::OpenPGP, so that you can encrypt data in your database using gpg. periodt. ๐Ÿ’–

right now it only handles encrypting โ€” that's it, that's the feature set. but it may add signing of columns in the future. manifesting it for us, lowkey. ๐Ÿ”ฎโœจ


๐Ÿ’œ CONFIGURATION ๐Ÿ’œ

in the column definition, you specify the encode_args hash exactly like the synopsis shows. now here's the tea:

  • the recipient is required if you're doing key exchange encryption ๐Ÿ”‘
  • or, if you want to use symmetric key encryption with a passphrase, you can specify a passphrase option instead:
 encode_args => { passphrase => "Shared Secret" }

that's it. shared secret. mutual. bestie behavior. ๐Ÿซถ


๐Ÿ”‘ pgp_args, aka the custom keyring section ๐Ÿ”‘

if you have a separate path to your public and private key ring file, or if you have alternative Crypt::OpenPGP configuration, you can pass the constructor args through the pgp_args configuration key:

    encode_args => {
        pgp_args => {
            SecRing => "$FindBin::Bin/var/secring.gpg",
            PubRing => "$FindBin::Bin/var/pubring.gpg",
        }
    }

look at that. SecRing, PubRing, all the paths, all the vibes. ๐Ÿงš


๐Ÿ“š a lil homework, bestie ๐Ÿ“š

the included tests cover good usage, and it is advised to briefly browse through them. yes, actually read the tests. they're giving documentation. they ate. ๐Ÿ”ฅ

โš ๏ธ also, remember to keep your private keys secure! like, fr fr. do not be out here leaking your private key to the group chat. that is not main character energy, that is a security incident. ๐Ÿ˜ญ๐Ÿ’€

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

J. Shirley <cpan@coldhardcode.com> ๐Ÿ’Œ


๐ŸŒˆ LICENSE ๐ŸŒˆ

this library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. slay. open source royalty. โญ


and that's the whole page, bestie!! ๐ŸŽ€โœจ this was DBIx::...penPGP(3pm) from the User Contributed Perl Documentation, and the footer said perl v5.40.1 dated 2025-04-01 โ€” so go forth, encrypt those columns, guard those keys, and have the most secure little day ever. ๐Ÿ’–๐Ÿฆ‹๐Ÿ’…

๐Ÿ“ฆ where this page comes from