File Coverage

blib/lib/Net/SSLeay/OO/X509/Context.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1              
2             package Net::SSLeay::OO::X509::Context;
3              
4             # wrapper for X509_STORE_CTX* functions
5             #
6             # Copyright (C) 2009 NZ Registry Services
7             #
8             # This program is free software: you can redistribute it and/or modify
9             # it under the terms of the Artistic License 2.0 or later. You should
10             # have received a copy of the Artistic License the file COPYING.txt.
11             # If not, see <http://www.perlfoundation.org/artistic_license_2_0>
12              
13 1     1   2497 use Moose;
  0            
  0            
14              
15             has 'x509_store_ctx' => isa => 'Int',
16             is => "ro",
17             required => 1,
18             ;
19              
20             sub get_current_cert {
21             my $self = shift;
22             my $x509 = Net::SSLeay::X509_STORE_CTX_get_current_cert(
23             $self->x509_store_ctx, );
24             &Net::SSLeay::OO::Error::die_if_ssl_error("get_current_cert");
25             if ($x509) {
26             require Net::SSLeay::OO::X509;
27             Net::SSLeay::OO::X509->new( x509 => $x509, no_rvinc => 1 );
28             }
29             }
30              
31             # getting all these right is made harder by the lack of OpenSSL docs
32             # for these methods...
33              
34             use Net::SSLeay::OO::Functions 'x509_store_ctx';
35              
36             # un-triaged:
37             # get_error()
38             # get_error_depth()
39             # get_ex_data()
40             # set_cert()
41             # set_error()
42             # set_ex_data()
43             # set_flags()
44              
45             1;
46              
47             __END__
48              
49             =head1 NAME
50              
51             Net::SSLeay::OO::X509::Context - wrapper for X509_STORE_CTX* pointers
52              
53             =head1 SYNOPSIS
54              
55             # ... within callback installed by
56             # Net::SSLeay::OO::Context::set_verify ...
57             my $x509_ctx = Net::SSLeay::OO::X509::Context->new(
58             x509_store_ctx => $x509_store_ctx,
59             );
60             my $cert = $x509_ctx->get_current_cert;
61              
62             =head1 DESCRIPTION
63              
64             This is a class which represents the X509_STORE_CTX* pointers; it is
65             currently poorly understood, the best reference for understanding will
66             be relevant functions within L<Net::SSLeay> (especially the main
67             binding wrapper, F<SSLeay.xs>), and the OpenSSL source code.
68              
69             You should not need to use this class for regular use of the module;
70             if you find a use for it, or would like to help complete or document
71             it, please submit a patch or pull request.
72              
73             =head1 AUTHOR
74              
75             Sam Vilain, L<samv@cpan.org>
76              
77             =head1 COPYRIGHT
78              
79             Copyright (C) 2009 NZ Registry Services
80              
81             This program is free software: you can redistribute it and/or modify
82             it under the terms of the Artistic License 2.0 or later. You should
83             have received a copy of the Artistic License the file COPYING.txt. If
84             not, see <http://www.perlfoundation.org/artistic_license_2_0>
85              
86             =head1 SEE ALSO
87              
88             L<Net::SSLeay::OO>, L<Net::SSLeay::OO::Context/set_verify>
89              
90             =cut
91              
92             # Local Variables:
93             # mode:cperl
94             # indent-tabs-mode: t
95             # cperl-continued-statement-offset: 8
96             # cperl-brace-offset: 0
97             # cperl-close-paren-offset: 0
98             # cperl-continued-brace-offset: 0
99             # cperl-continued-statement-offset: 8
100             # cperl-extra-newline-before-brace: nil
101             # cperl-indent-level: 8
102             # cperl-indent-parens-as-block: t
103             # cperl-indent-wrt-brace: nil
104             # cperl-label-offset: -8
105             # cperl-merge-trailing-else: t
106             # End:
107             # vim: filetype=perl:noexpandtab:ts=3:sw=3