GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CRYPT::PWSAFE3 (3)

.ds Aq ’

NAME

Crypt::PWSafe3 - Read and write Passwordsafe v3 files

CONTENTS

SYNOPSIS



 use Crypt::PWSafe3;
 my $vault = Crypt::PWSafe3->new(file => filename.psafe3, password => somesecret);

 # fetch all database records
 my @records = $vault->getrecords();
 foreach my $record (@records) {
   print $record->uuid;
   print $record->title;
   print $record->passwd;
   # see Crypt::PWSafe3::Record for more details on accessing records
 }

 # same as above but dont detach records from vault
 foreach my $uuid ($vault->looprecord) {
   # either change a record
   $vault->modifyrecord($uuid, passwd => p1);

   # or just access it directly
   print $vault->{record}->{$uuid}->title;
 }

 # add a new record
 $vault->newrecord(user => u1, passwd => p1, title => t1);

 # modify an existing record
 $vault->modifyrecord($uuid, passwd => p1);

 # replace a record (aka edit it)
 my $record = $vault->getrecord($uuid);
 $record->title(t2);
 $record->passwd(foobar);
 $vault->addrecord($record);

 # mark the vault as modified (not required if
 # changes were done with ::modifyrecord()
 $vault->markmodified();

 # save the vault
 $vault->save();

 # save it under another name using another password
 $vault->save(file => another.pwsafe3, passwd => blah);

 # access database headers
 print $vault->getheader(wholastsaved)->value();
 print scalar localtime($vault->getheader(lastsavetime)->value());

 # add/replace a database header
 my $h = Crypt::PWSafe3::HeaderField->new(name => savedonhost, value => localhost);
 $vault->addheader($h);



DESCRIPTION

Crypt::PWSafe3 provides read and write access to password database files created by Password Safe V3 (and up) available at http://passwordsafe.sf.net.

METHODS

BInew()

The new() method creates a new Crypt::PWSafe3 object. Any parameters must be given as hash parameters.



 my $vault = Crypt::PWSafe3->new(
                     file     => vault.psafe3,
                     password => secret,
                     whoami   => user1,
                     program  => mypwtool v1,
                     create   => 0,   # or 1
 );



Mandatory parameters:
<B>fileB> Specifies the password safe (v3) file. If it exists it will be read in. Otherwise it will be created if you call <B>B>save()<B>B>.
<B>passwordB> The password required to decrypt the password safe file.
Optional parameters:
<B>whoamiB> Specifies the user who saves the password safe file. If omitted the environment variable USER will be used when calling <B>B>save()<B>B>.
<B>programB> Specifies which program saved the password safe file. If omitted, the content of the perl variable $0 will be used, which contains the name of the current running script.
<B>createB> If set to 0, <B>B>new()<B>B> will fail if the file doesn’t exist, otherwise it will try to create it. Enabled by default.
The optional parameters will become header fields of the password safe file. You can manually set/override more headers. See section addheader() for more details.

BIgetrecords()

Returns a list of all records found in the password safe file. Each element is an <B>Crypt::PWSafe3::RecordB> object.

A record object is identified by its <B>UUID4B> value, which is a unique identifier. You can access the uuid by:



 $record->uuid



Accessing other record properties works the same. For more details, refer to Crypt::PWSafe3::Record.

Please note that record objects accessed this way are copies. If you change such a record object and save the database, nothing will in fact change. In this case you need to put the changed record back into the record list of the Crypt::PWSafe3 object by:



 $vault->addrecord($record):



See section addrecord() for more details on this.

BIlooprecord()

Returns a list of UUIDs of all known records. You can use this list to iterate over the records without copying them and optionally changing them in place.

Example:



 foreach my $uuid ($vault->looprecord) {
   # either change a record
   $vault->modifyrecord($uuid, passwd => p1);

   # or just access it directly
   print $vault->{record}->{$uuid}->title;
 }



modifyrecord(uuid, parameter-hash)

Modifies the record identified by the given UUID using the values of the supplied parameter hash.

Example:



   $vault->modifyrecord($uuid, passwd => p1);



The parameter hash may contain any valid record field type with according values. Refer to Crypt::PWSafe3::Record for details about available fields.

newrecord(parameter-hash)

Create a new record. The UUID of the record will be generated automatically. Refer to Crypt::PWSafe3::Record for details about available fields.

addrecord(Crypt::PWSafe3::Record object)

Add a record to the vault. The record must be an Crypt::PWSafe3::Record object.

deleterecord(uuid)

Delete the record identified by the given UUID.

save([parameter-hash])

Save the current password safe vault back to disk.

If not otherwise specified, use the same file and password as we used to open it initially. If the file doesn’t exist it will be created.

You may specify another filename and password here by using a parameter hash.

Example:



 $vault->save(file => anotherfile.psafe3, passwd => foo);



Please note, that the vault will be written to a temporary file first, then this temporary file will be read in and if that works, it will be moved over the destination file. This way the original file persists if the written database gets corrupted by some unknown reason (a bug for instance).

getheader(name)

Returns a raw <B>Crypt::PWSafe3::HeaderFieldB> object. Refer to Crypt::PWSafe3::HeaderField for details how to access it.

addheader(object)

Adds a header field to the password safe database. The object parameter must be an <B>Crypt::PWSafe3::HeaderFieldB> object.

If the header already exists it will be replaced.

Refer to Crypt::PWSafe3::HeaderField for details how to create new ones .

AUTHOR

T.v.Dein <tlinden@cpan.org>

BUGS

Report bugs to http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Crypt-PWSafe3.

SEE ALSO

Subclasses:

Crypt::PWSafe3::Record Crypt::PWSafe3::Field Crypt::PWSafe3::HeaderField

Password Safe Homepage: <http://passwordsafe.sourceforge.net/>

Another (read-only) perl module: Crypt::Pwsafe

A python port of Password Safe: <http://www.christoph-sommer.de/loxodo/> Many thanks to Christoph Sommer, his python library inspired me a lot and in fact most of the concepts in this module are his ideas ported to perl.

COPYRIGHT

Copyright (c) 2011-2015 by T.v.Dein <tlinden@cpan.org>.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms of the Artistic License 2.0, see: <http://www.perlfoundation.org/artistic_license_2_0>

VERSION

Crypt::PWSafe3 Version 1.21.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 CRYPT::PWSAFE3 (3) 2015-05-21

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.