/usr/share/perl5/RDF/Crypt/Signer.pm is in librdf-crypt-perl 0.002-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | package RDF::Crypt::Signer;
use 5.010;
use Any::Moose;
with qw(
RDF::Crypt::Role::WithPrivateKey
RDF::Crypt::Role::DoesVerify
RDF::Crypt::Role::DoesSign
RDF::Crypt::Role::StandardSignatureMarkers
RDF::Crypt::Role::ToString
);
use MIME::Base64 qw(
encode_base64
decode_base64
);
use namespace::clean;
BEGIN {
$RDF::Crypt::Signer::AUTHORITY = 'cpan:TOBYINK';
$RDF::Crypt::Signer::VERSION = '0.002';
}
sub sign_bytes
{
my ($self, $text) = @_;
encode_base64(
$self->private_key->sign($text),
q(),
);
}
sub verify_bytes
{
my ($self, $text, $signature) = @_;
!!$self->private_key->verify(
$text,
decode_base64($signature),
);
}
1;
__END__
=head1 NAME
RDF::Crypt::Signer - signs RDF graphs with RSA
=head1 SYNOPSIS
use 5.010;
use File::Slurp qw< slurp >;
use RDF::Crypt::Signer;
use RDF::TrineX::Functions qw< parse >;
my $sign = RDF::Crypt::Signer->new_from_file(
'/path/to/private-key.pem'
);
my $raw = slurp '/path/to/important.ttl';
my $graph = parse '/path/to/important.ttl';
my $detached_sig = $sign->sign_model($graph);
my $turtle_with_embedded_signature = $sign->sign_embed_turtle($raw);
=head1 DESCRIPTION
A Signer object is created using an RSA private key. The object can be used
to sign multiple RDF graphs. The signature should be independent of the RDF
serialisation used, so that Turtle and RDF/XML files containing equivalent
triples should generate the same signature.
RDF::Crypt::Signer can also be used to verify signatures using the private
key of the signer.
=head2 Roles
=over
=item * L<RDF::Crypt::Role::WithPrivateKey>
=item * L<RDF::Crypt::Role::DoesSign>
=item * L<RDF::Crypt::Role::DoesVerify>
=item * L<RDF::Crypt::Role::StandardSignatureMarkers>
=item * L<RDF::Crypt::Role::ToString>
=back
=begin trustme
=item * sign_bytes
=item * verify_bytes
=item * SIG_MARK
=end trustme
=head1 SEE ALSO
L<RDF::Crypt>,
L<RDF::Crypt::Verifier>.
=head1 BUGS
Please report any bugs to L<http://rt.cpan.org/>.
=head1 AUTHOR
Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT
Copyright 2010, 2012 Toby Inkster
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|