XML-Compile-WSS-Signature

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN


	Improvements:
	- tests: move template generation from t/31keyinfo.t into t/02templs.t
	- support key-info type X509Data
	- too many to mention!  Close to full rework.

version 1.09:

	Fixes:
	- receive messages without PrefixList  [Karen Etheridge]
	- token and private_key configuration is optional: report errors
	  lazy.

	Improvements:
	- use ::Cache::addPrefixes()

version 1.08: Fri Jan 18 13:37:45 CET 2013

	Changes:
	- elementsToSign() -> takeElementsToSign()

lib/XML/Compile/WSS/Sign.pod  view on Meta::CPAN

 XML::Compile::WSS::Sign is extended by
   XML::Compile::WSS::Sign::HMAC
   XML::Compile::WSS::Sign::RSA

=head1 SYNOPSIS

  # either
  use XML::Compile::WSS::Util qw/DSIG_RSA_SHA1/;
  my $sign = XML::Compile::WSS::Sign->new
    ( sign_method => DSIG_RSA_SHA1
    , private_key => $key
    , ...
    );

  # or
  use XML::Compile::WSS::Sign::RSA;
  my $sign = XML::Compile::WSS::Sign::RSA->new
    ( hashing     => 'SHA1'
    , private_key => $key
    , ...
    );

=head1 DESCRIPTION

=head2 Supported signers

=over 4

=item * RSA

lib/XML/Compile/WSS/Sign/RSA.pm  view on Meta::CPAN

use Crypt::OpenSSL::RSA ();
use File::Slurp         qw/read_file/;
use Scalar::Util        qw/blessed/;


sub init($)
{   my ($self, $args) = @_;
    $self->SUPER::init($args);

    $self->privateKey
      ( $args->{private_key}
      , hashing => $args->{hashing}
      , padding => $args->{padding}
      );
 
    $self->publicKey
      ( $args->{public_key}
      , hashing => $args->{hashing}
      , padding => $args->{padding}
      );
    $self;

lib/XML/Compile/WSS/Sign/RSA.pod  view on Meta::CPAN


=item XML::Compile::WSS::Sign::RSA-E<gt>B<fromConfig>(HASH|PAIRS)

Inherited, see L<XML::Compile::WSS::Sign/"Constructors">

=item XML::Compile::WSS::Sign::RSA-E<gt>B<new>(%options)

 -Option     --Defined in             --Default
  hashing                               <undef>
  padding                               <undef>
  private_key                           undef
  public_key                            <from private key>
  sign_method  XML::Compile::WSS::Sign  DSIG_RSA_SHA1

=over 2

=item hashing => 'SHA1'|'MD5'|...

=item padding => 'NO'|'PKCS1'|...

=item private_key => OBJECT|STRING|FILENAME

Required if you want to use this object to sign. See L<privateKey()|XML::Compile::WSS::Sign::RSA/"Attributes">

=item public_key => OBJECT|STRING|FILENAME

Required if you want to use this object to L<check()|XML::Compile::WSS::Sign::RSA/"Handlers">. See L<publicKey()|XML::Compile::WSS::Sign::RSA/"Attributes">
Usually, you need either the public or the private key, not both.  However,
when you specify a private key, you can ask for the public key as well: it
is included.

t/20signature.t  view on Meta::CPAN

my $wss  = XML::Compile::SOAP::WSS->new;
my $wsdl = XML::Compile::WSDL11->new($wsdlfn);

my $token =  XML::Compile::WSS::SecToken::X509v3->fromFile($certfn);
isa_ok($token, 'XML::Compile::WSS::SecToken::X509v3');

my $sig   = $wss->signature
  ( digest_method   => DSIG_SHA1          # default
  , signer          => DSIG_RSA_SHA1      # default
  , canon_method    => C14N_EXC_NO_COMM   # default
  , private_key     => $privkeyfn
  , token           => $token
  );

$wsdl->compileCalls(transport_hook => \&fake_server);
my ($out, $trace) = $wsdl->call($anyop, One => 1, Two => 2, Three => 3);
#warn "******* CALL END";
#warn Dumper $out;
$trace->printErrors;
#$trace->printResponse;
#my ($out2, $trace2) = $wsdl->call($anyop, One => 1, Two => 2, Three => 3);

t/31keyinfo.t  view on Meta::CPAN

my $schema    = XML::Compile::Cache->new;
ok(defined $schema);

my $wss       = XML::Compile::WSS::Signature->new
  ( version => '1.1'
  , schema  => $schema
  , token   => 'dummy'

  , sign_types  => []
  , sign_put    => []
  , private_key => $privkey_fn
  );

isa_ok($wss, 'XML::Compile::WSS');
isa_ok($wss, 'XML::Compile::WSS::Signature');

### top-level KeyInfo readers and writers

use_ok('XML::Compile::WSS::KeyInfo');
my $ki         = XML::Compile::WSS::KeyInfo->new;
isa_ok($ki, 'XML::Compile::WSS::KeyInfo');

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.733 second using v1.00-cache-2.02-grep-82fe00e-cpan-f73e49a70403 )