XML::Sig - A toolkit to help sign and verfify XML Signatures
When given a string of XML, it will return the same string with a signature generated from the key provided when the XML::Sig object was initialized.
This method presumes that there is one and only one element in your XML document with an ID (case sensitive) attribute. This is the element that will be the basis for the signature. It will also correspond to the URI attribute in the Reference element that will be contained by the signature. If no ID attribute can be found on an element, the signature will not be created.
Returns true or false based upon whether the signature is valid or not.
When using XML::Sig exclusively to verify a signature, no key needs to be specified during initialization given that the public key should be transmitted with the signature.
Each of the following options are also accessors on the main File::Download object.
The path to a file containing the contents of a private key. This option is used only when generating signatures.
The XML canonicalization library to use. Options currently are:
* XML::CanonicalizerXML (default) * XML::Canonicalizer
Takes a true (1) or false (0) value and indicates how you want the signature to be encoded. When true, an X509 certificate will be encoded in the signature. Otherwise the native encoding format for RSA and DSA will be used.
Fetch the newest and greatest perl version:
my $xml = '<foo ID="abc">123</foo>'; my $signer = XML::Sig->new({ canonicalizer => 'XML-CanonizeXML', key => 'path/to/private.key', }); my $signed = $signer->sign($xml); print "Signed XML: $signed\n"; $signer->verify($signed) or die "Signature Invalid."; print "Signature valid.\n";
Author: Byrne Reese <byrne@majordojo.com>
Thanks to Manni Heumann who wrote Google::SAML::Response from which this module borrows heavily in order to create digital signatures.
2 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
You forgot a '=back' before '=head1'
To install XML::Sig, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Sig
CPAN shell
perl -MCPAN -e shell install XML::Sig
For more information on module installation, please visit the detailed CPAN module installation guide.