Crypt-ZCert

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.003002 2015-07-17

  - 'use strictures 2;' for saner fatal warnings behavior

0.003001 2014-11-23

  - Make ->generate_keypair available as a class method

0.002005 2014-11-21

  - Depend on newer Path::Tiny (for ->chmod)

0.002004 2014-11-08

  - Switch to FFI::CheckLib for dynamic lib check

0.002003 2014-10-27

  - Depend on newer List::Objects::WithUtils to guarantee TO_ZPL availability

0.002002 2014-10-26

README.mkdn  view on Meta::CPAN


    # ... or as the original Z85:
    my $pub_z85 = $zcert->public_key_z85;
    my $sec_z85 = $zcert->secret_key_z85;

    # Alter metadata:
    $zcert->metadata->set(foo => 'bar');

    # Commit certificate to disk
    # (as '/foo/mycert', '/foo/mycert_secret' pair)
    # Without '->new(adjust_permissions => 0)', _secret becomes chmod 0600:
    $zcert->commit;

    # Retrieve a public/secret ZCert file pair (as ZPL) without writing:
    my $certdata = $zcert->export_zcert;
    my $pubdata  = $certdata->public;
    my $secdata  = $certdata->secret;

    # Retrieve a newly-generated key pair (no certificate):
    my $keypair = Crypt::ZCert->new->generate_keypair;
    my $pub_z85 = $keypair->public;

README.mkdn  view on Meta::CPAN


The path to the secret ZCert; defaults to appending '\_secret' to
["public\_file"](#public_file).

Coerced to a [Path::Tiny](https://metacpan.org/pod/Path::Tiny).

Predicate: `has_secret_file`

### adjust\_permissions

If boolean true, `chmod` will be used to attempt to set the ["secret\_file"](#secret_file)'s
permissions to `0600` after writing.

### ignore\_existing

If boolean true, any existing ["public\_file"](#public_file) / ["secret\_file"](#secret_file) will not be
read; calling a ["commit"](#commit) will cause a forcible key regeneration and rewrite
of the existing certificate files.

(Obviously, this should be used with caution.)

lib/Crypt/ZCert.pm  view on Meta::CPAN


  confess "commit() called but no public_file / secret_file set"
    unless $self->has_public_file
      and  $self->public_file
      and  $self->secret_file;

  my $zcert = $self->export_zcert;
  
  $self->public_file->spew( $zcert->public );
  $self->secret_file->spew( $zcert->secret );
  $self->secret_file->chmod(0600) if $self->adjust_permissions;

  $self
}


print
  qq[<OvrLrdQ> only copy of keys to decrypt inside encrypted duplicity backup\n],
  qq[<Schroedingers_hat> Yo dawg, I herd you liked encryption so I put yo keys],
  qq[ in yo encrypted file so you can decrypt while....damnit.\n]
unless caller; 1;

lib/Crypt/ZCert.pm  view on Meta::CPAN


  # ... or as the original Z85:
  my $pub_z85 = $zcert->public_key_z85;
  my $sec_z85 = $zcert->secret_key_z85;

  # Alter metadata:
  $zcert->metadata->set(foo => 'bar');

  # Commit certificate to disk
  # (as '/foo/mycert', '/foo/mycert_secret' pair)
  # Without '->new(adjust_permissions => 0)', _secret becomes chmod 0600:
  $zcert->commit;

  # Retrieve a public/secret ZCert file pair (as ZPL) without writing:
  my $certdata = $zcert->export_zcert;
  my $pubdata  = $certdata->public;
  my $secdata  = $certdata->secret;

  # Retrieve a newly-generated key pair (no certificate):
  my $keypair = Crypt::ZCert->new->generate_keypair;
  my $pub_z85 = $keypair->public;

lib/Crypt/ZCert.pm  view on Meta::CPAN


The path to the secret ZCert; defaults to appending '_secret' to
L</public_file>.

Coerced to a L<Path::Tiny>.

Predicate: C<has_secret_file>

=head3 adjust_permissions

If boolean true, C<chmod> will be used to attempt to set the L</secret_file>'s
permissions to C<0600> after writing.

=head3 ignore_existing

If boolean true, any existing L</public_file> / L</secret_file> will not be
read; calling a L</commit> will cause a forcible key regeneration and rewrite
of the existing certificate files.

(Obviously, this should be used with caution.)



( run in 0.321 second using v1.01-cache-2.11-cpan-8d75d55dd25 )