NAME
RDF::Crypt::Encrypter - encrypts RDF graphs
DESCRIPTION
An Encrypter object is created using an RSA public key. The object can be used to encrypt an RDF graph for a recipient.
Constructors
new_from_file($file)
-
Given a filename containing a DER or PEM encoded RSA public key, constructs an Encrypter object.
new_from_string($str)
-
Given a string containing a DER or PEM encoded RSA public key, constructs an Encrypter object.
new_from_pubkey($key)
-
Given a Crypt::OpenSSL::RSA public key object, constructs an Encrypter object.
new_from_webid($uri)
-
Given a WebID with one of more FOAF+SSL public keys, constructs an Encrypter object. If multiple public keys are associated with the same WebID, then the one with the largest key size (most secure) is used.
Object Methods
encrypt_model($model)
-
Returns an encrypted serialisation of the data.
The encryption works by serialising the data as RDF/XML, then encrypting it with
encrypt_text
. send_model_by_email($model, \%opts)
-
This method only works on objects that were constructed using
new_from_webid
. Encrypts the model for the holder of the WebID, and sends it to an address specified in the WebID profile using foaf:mbox.Options:
sendmail - hashref of options for Mail::Transport::Sendmail. The mere presence of this hashref will trigger Mail::Transport::Sendmail to be used as the delivery method.
smtp - hashref of options for Mail::Transport::SMTP. The mere presence of this hashref will trigger Mail::Transport::SMTP to be used as the delivery method.
from - email address for the message to come from.
subject - message subject.
filename - filename for encrypted attachment.
headers - hashref of additional mail headers.
Returns a the message's Message-ID, or undef if unsuccessful.
encrypt_text($str)
-
Bonus method - encrypts a literal string which may or may not have anything to do with RDF.
The return value is a base64-encoded string. The base64-decoded value consists of: (1) an initialisation vector, sixteen bytes shorter than the size of the key; (2) a 32-bit big-endian signed integer indicating the length of padding which was added to the payload of the message during encryption; (3) the payload, encrypted using cipher-block chaining with OEAP, with block length sixteen bytes shorter than the key size. These three parts are concatenated together in that order.
SEE ALSO
BUGS
Please report any bugs to http://rt.cpan.org/.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT
Copyright 2010 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.