1 package make::gnutlscert;
6 use warnings FATAL => qw(all);
10 our @EXPORT = qw(make_gnutls_cert);
13 sub make_gnutls_cert()
15 open (FH, ">certtool.template");
17 my $org = promptstring_s("Please enter the organization name", "My IRC Network");
18 my $unit = promptstring_s("Please enter the unit Name", "Server Admins");
19 my $state = promptstring_s("Pleae enter your state (two letter code)", "CA");
20 my $country = promptstring_s("Please enter your country", "Oompa Loompa Land");
21 my $commonname = promptstring_s("Please enter the certificate common name (hostname)", "irc.mynetwork.com");
22 my $email = promptstring_s("Please enter a contact email address", "oompa\@loompa.com");
24 # X.509 Certificate options
28 # The organization of the subject.
31 # The organizational unit of the subject.
34 # The locality of the subject.
37 # The state of the certificate owner.
40 # The country of the subject. Two letter code.
43 # The common name of the certificate owner.
46 # A user id of the certificate owner.
49 # If the supported DN OIDs are not adequate you can set
51 # For example set the X.520 Title and the X.520 Pseudonym
52 # by using OID and string pairs.
53 #dn_oid = "2.5.4.12" "Dr." "2.5.4.65" "jackal"
55 # This is deprecated and should not be used in new
57 # pkcs9_email = "none\@none.org"
59 # The serial number of the certificate
62 # In how many days, counting from today, this certificate will expire.
67 # A dnsname in case of a WWW server.
68 #dns_name = "www.none.org"
70 # An IP address in case of a server.
71 #ip_address = "192.168.1.1"
73 # An email in case of a person
76 # An URL that has CRLs (certificate revocation lists)
77 # available. Needed in CA certificates.
78 #crl_dist_points = "http://www.getcrl.crl/getcrl/"
80 # Whether this is a CA certificate or not
83 # Whether this certificate will be used for a TLS client
86 # Whether this certificate will be used for a TLS server
89 # Whether this certificate will be used to sign data (needed
90 # in TLS DHE ciphersuites).
93 # Whether this certificate will be used to encrypt data (needed
94 # in TLS RSA ciphersuites). Note that it is prefered to use different
95 # keys for encryption and signing.
98 # Whether this key will be used to sign other certificates.
101 # Whether this key will be used to sign CRLs.
104 # Whether this key will be used to sign code.
107 # Whether this key will be used to sign OCSP data.
110 # Whether this key will be used for time stamping.
114 if ( (my $status = system("certtool --generate-privkey --outfile key.pem")) ne 0) { return 1; }
115 if ( (my $status = system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template certtool.template")) ne 0) { return 1; }
116 unlink("certtool.template");