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