=encoding utf8

=head1 NAME

XML::Compile::WSS::SecToken::X509v3 - WSS Security Token X509v3 style

=head1 INHERITANCE

 XML::Compile::WSS::SecToken::X509v3
   is a XML::Compile::WSS::SecToken

=head1 SYNOPSIS

  # Most verbose
  my $certfn = 'cert.pem';
  my $cert   = Crypt::OpenSSL::X509->new_from_file($certfn);
  my $token  = XML::Compile::WSS::SecToken::X509v3->new
    ( id          => 'some-wsu-id'
    , certificate => $cert
    );
  $wss->sigature(token => $token, ...);

  # Shortest
  $wss->signature(token => $cert, ...);

  # More syntax
  my $token = XML::Compile::WSS::SecToken->new
    ( type        => XTP10_X509v3
    , id          => 'some-wsu-id'
    , certificate => $cert
    );

  my $token = XML::Compile::WSS::SecToken::X509v3
    ->fromFile($cert_fn, format => FORMAT_ASN1);

=head1 DESCRIPTION

Use an X509 certificate as security token.

CPAN lists a few modules which wrap a X509 certificate, for the
moment only Crypt::OpenSSL::X509 is supported, patches for other
implementations are welcomed.

See F<docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0.pdf>

Extends L<"DESCRIPTION" in XML::Compile::WSS::SecToken|XML::Compile::WSS::SecToken/"DESCRIPTION">.
 
=head1 METHODS

Extends L<"METHODS" in XML::Compile::WSS::SecToken|XML::Compile::WSS::SecToken/"METHODS">.
 
=over 4

=item XML::Compile::WSS::SecToken::X509v3-E<gt>B<fromFile>($filename, %options)

[1.07] read the certificate from a file.  You can pass all %options provided
by L<new()|XML::Compile::WSS::SecToken::X509v3/"METHODS"> plus some specific parameters.

 -Option--Default
  format  FORMAT_PEM

=over 2

=item format => FORMAT_*

The file format is not always auto-detected, so you may need to
provide it explicition.  The constants are exported by Crypt::OpenSSL::X509

=back

=back

=head2 Constructors

Extends L<"Constructors" in XML::Compile::WSS::SecToken|XML::Compile::WSS::SecToken/"Constructors">.
 
=over 4

=item XML::Compile::WSS::SecToken::X509v3-E<gt>B<fromConfig>($config, %options)

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

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

Either the C<certificate> object or a C<cert_file> must be specified.

 -Option     --Defined in                 --Default
  binary       XML::Compile::WSS::SecToken  undef
  certificate                               undef
  encoding     XML::Compile::WSS::SecToken  WSM10_BASE64
  fingerprint  XML::Compile::WSS::SecToken  <from certificate>
  id           XML::Compile::WSS::SecToken  'my-token'
  type         XML::Compile::WSS::SecToken  XTP10_X509v3
  uri          XML::Compile::WSS::SecToken  <unique>

=over 2

=item binary => BYTES

=item certificate => CERTIFICATE

=item encoding => WSM10*

=item fingerprint => STRING

=item id => wsu::Id

=item type => TOKENTYPE

=item uri => NAME

=back

=back

=head2 Attributes

Extends L<"Attributes" in XML::Compile::WSS::SecToken|XML::Compile::WSS::SecToken/"Attributes">.
 
=over 4

=item $obj-E<gt>B<certificate>()

=item $obj-E<gt>B<encoding>()

Inherited, see L<XML::Compile::WSS::SecToken/"Attributes">

=item $obj-E<gt>B<fingerprint>()

Inherited, see L<XML::Compile::WSS::SecToken/"Attributes">

=item $obj-E<gt>B<id>()

Inherited, see L<XML::Compile::WSS::SecToken/"Attributes">

=item $obj-E<gt>B<type>()

Inherited, see L<XML::Compile::WSS::SecToken/"Attributes">

=back

=head2 Handlers

Extends L<"Handlers" in XML::Compile::WSS::SecToken|XML::Compile::WSS::SecToken/"Handlers">.
 
=over 4

=item $obj-E<gt>B<asBinary>()

Inherited, see L<XML::Compile::WSS::SecToken/"Handlers">

=back

=head1 SEE ALSO

This module is part of XML-Compile-WSS-Signature distribution version 2.02,
built on July 16, 2016. Website: F<http://perl.overmeer.net/xml-compile/>

Please post questions or ideas to the mailinglist at
F<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile> .
For live contact with other developers, visit the C<#xml-compile> channel
on C<irc.perl.org>.

=head1 LICENSE

Copyrights 2012-2016 by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

