App::GroupSecret::File - Reading and writing groupsecret keyfiles
version 0.303
use App::GroupSecret::File; my $file = App::GroupSecret::File->new('path/to/keyfile.yml'); print "File version: " . $file->version, "\n"; $file->add_key('path/to/key_rsa.pub'); $file->save;
This module provides a programmatic way to manage keyfiles.
See groupsecret for the command-line interface.
Get the filepath of the keyfile.
$file = App::GroupSecret::File->new($filepath);
Construct a new keyfile object.
$info = $file->info;
Get a raw hashref with the contents of the keyfile.
$info = $file->init;
Get a hashref representing an empty keyfile, used for initializing a new keyfile.
$info = $file->load; $info = $file->load($filepath);
Load (or reload) the contents of a keyfile.
$file->save; $file->save($filepath);
Save the keyfile to disk.
$file->check; $file->check($info);
Check the file format of a keyfile to make sure this module can understand it.
$keys = $file->keys;
Get a hashref of the keys from a keyfile.
$secret = $file->secret;
Get the secret from a keyfile as an encrypted string.
$version = $file->version
Get the file format version.
$file->add_key($filepath);
Add a key to the keyfile.
$file->delete_key($fingerprint);
Delete a key from the keyfile.
$secret = $file->decrypt_secret(passphrase => $passphrase); $secret = $file->decrypt_secret(private_key => $private_key);
Get the decrypted secret.
$passphrase = $file->decrypt_secret_passphrase($private_key);
Get the decrypted secret passphrase.
$file->encrypt_secret($secret, $passphrase);
Set the secret by encrypting it with a 256-bit passphrase.
Passphrase must be 32 bytes.
$file->encrypt_secret_passphrase($passphrase);
Set the passphrase by encrypting it with each key in the keyfile.
$filepath = $file->find_public_key($key);
Get a path to the public key file for a key.
$str = $file->format_key($key);
Get a one-line summary of a key. Format is "<fingerprint> <comment>".
Keyfiles are YAML documents that contains this structure:
--- keys: FINGERPRINT: comment: COMMENT content: ssh-rsa ... filename: FILENAME secret_passphrase: PASSPHRASE... type: rsa secret: SECRET... version: 1
Please report any bugs or feature requests on the bugtracker website https://github.com/chazmcgarvey/groupsecret/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Charles McGarvey <chazmcgarvey@brokenzipper.com>
This software is Copyright (c) 2017 by Charles McGarvey.
This is free software, licensed under:
The MIT (X11) License
To install App::GroupSecret, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::GroupSecret
CPAN shell
perl -MCPAN -e shell install App::GroupSecret
For more information on module installation, please visit the detailed CPAN module installation guide.