@@ -7,26 +7,103 @@ Crypt::OpenSSL::SignCSR - Sign a Certificate Signing Request in XS.
77``` perl
88use Crypt::OpenSSL::SignCSR;
99
10- my $signer = Crypt::OpenSSL::SignCSR-> new($private_key_pem );
10+ my $signer = Crypt::OpenSSL::SignCSR-> new(
11+ $private_key_pem
12+ { # OPTIONAL
13+ days => $days , # Number of days for the certificate
14+ digest => $digest , # Signature digest default (SHA256)
15+ format => $format , # Output format "text" or "pem" (default)
16+ });
1117my $cert = $signer -> sign(
1218 $request , # CRS in PEM format
13- $days , # number of days for the certificate
14- $digest # Signature digest default (SHAi256)
15- $text , # Boolean (text format output (1) PEM (0)
16- ' ' # FIXME
1719 );
20+
21+ my $ret = $signer -> set_days(3650);
22+ my $ret = $signer -> set_format(" text" );
23+ my $ret = $signer -> set_days(" SHA512" );
24+
25+ $cert = $signer -> sign( $request ); # CRS in PEM format
1826```
1927
2028# DESCRIPTION
2129
2230Allows a Certificate Signing Request (CSR) to be signed to create a
2331X509 PEM encoded Certificate.
2432
25- WARNING: Early release.
33+ # METHODS
34+
35+ ## sign($csr)
36+
37+ Sign the provided CSR in PEM format.
38+
39+ Returns a signed certificate file in the specified format.
40+
41+ Arguments:
42+
43+ ```
44+ * $csr - a PEM format Certificate signing request. You can create one with
45+ Crypt::OpenSSL::PKCS10 or any other product capable of creating a signing request.
46+ ```
47+
48+ ## set\_ digest($digest)
49+
50+ Set the digest that should be used for signing the certificate.
51+
52+ Any openssl supported digest can be specified. If the value provided is not
53+ a valid it will set the openssl default.
54+
55+ Returns true (1) if successful and false (0) for a failure.
56+
57+ Arguments:
58+
59+ ```
60+ * $digest - the specified openssl supported digest (ex SHA1, SHA256, SHA384, SHA512)
61+ ```
62+
63+ ## get\_ digest()
64+
65+ Get the digest that is currently set.
66+
67+ Returns a string
68+
69+ ## set\_ format($format)
70+
71+ Set the format that should be used to output the the certificate.
72+
73+ Supported formats are "text" and "pem" (default).
74+
75+ Returns true (1) if successful and false (0) for a failure.
76+
77+ Arguments:
78+
79+ ```
80+ * $format - the specified output format ("pem", "text")
81+ ```
82+
83+ ## get\_ format()
84+
85+ Get the output format that is currently set.
86+
87+ Returns a string
88+
89+ ## set\_ days($days)
90+
91+ Set the number of days that the Certificate will be valid. The days can
92+ be set via the constructor or modified via set\_ days()
93+
94+ Returns true (1) if successful and false (0) for a failure.
95+
96+ Arguments:
97+
98+ ```
99+ * $days - number of days that the certificate will be valid.
100+ ```
101+
102+ ## get\_ days()
103+
104+ Get the number of days that is currently set.
26105
27- I am almost certainly going to change the way the module is initialized.
28- The Key being kept in memory is probably not the best approach. It will be
29- moved to the sign sub-routine.
106+ Returns a number
30107
31108# EXPORT
32109
0 commit comments