/
tinyca-sha2.patch
197 lines (190 loc) · 7.52 KB
/
tinyca-sha2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
diff -urN tinyca2-0.7.5.org/lib/CA.pm tinyca2-0.7.5/lib/CA.pm
--- tinyca2-0.7.5.org/lib/CA.pm 2006-07-25 22:12:00.000000000 +0200
+++ tinyca2-0.7.5/lib/CA.pm 2015-02-04 06:33:28.719715647 +0100
@@ -1062,6 +1062,7 @@
'outdir' => $self->{$ca}->{'dir'}."/newcerts/",
'keyfile' => $self->{$ca}->{'dir'}."/cacert.key",
'cacertfile' => $self->{$ca}->{'dir'}."/cacert.pem",
+ 'digest' => $opts->{'digest'},
'pass' => $opts->{'passwd'},
'days' => $opts->{'days'},
'parentpw' => $opts->{'parentpw'},
diff -urN tinyca2-0.7.5.org/lib/CERT.pm tinyca2-0.7.5/lib/CERT.pm
--- tinyca2-0.7.5.org/lib/CERT.pm 2006-07-25 22:12:00.000000000 +0200
+++ tinyca2-0.7.5/lib/CERT.pm 2015-02-04 06:33:19.512832137 +0100
@@ -480,6 +480,9 @@
$out = '';
$out .= "Fingerprint (MD5): $opts->{'parsed'}->{'FINGERPRINTMD5'}\n";
$out .= "Fingerprint (SHA1): $opts->{'parsed'}->{'FINGERPRINTSHA1'}\n\n";
+ $out .= "Fingerprint (SHA256): $opts->{'parsed'}->{'FINGERPRINTSHA256'}\n\n";
+ $out .= "Fingerprint (SHA384): $opts->{'parsed'}->{'FINGERPRINTSHA384'}\n\n";
+ $out .= "Fingerprint (SHA512): $opts->{'parsed'}->{'FINGERPRINTSHA512'}\n\n";
} else {
$out = '';
}
diff -urN tinyca2-0.7.5.org/lib/GUI/WORDS.pm tinyca2-0.7.5/lib/GUI/WORDS.pm
--- tinyca2-0.7.5.org/lib/GUI/WORDS.pm 2006-07-25 22:12:00.000000000 +0200
+++ tinyca2-0.7.5/lib/GUI/WORDS.pm 2015-02-04 06:33:19.512832137 +0100
@@ -70,6 +70,9 @@
'STATUS' => _("Status"),
'FINGERPRINTMD5' => _("Fingerprint (MD5)"),
'FINGERPRINTSHA1' => _("Fingerprint (SHA1)"),
+ 'FINGERPRINTSHA256' => _("Fingerprint (SHA256)"),
+ 'FINGERPRINTSHA384' => _("Fingerprint (SHA384)"),
+ 'FINGERPRINTSHA512' => _("Fingerprint (SHA512)"),
_("Not set") => 'none',
_("Ask User") => 'user',
_("critical") => 'critical',
diff -urN tinyca2-0.7.5.org/lib/GUI/X509_infobox.pm tinyca2-0.7.5/lib/GUI/X509_infobox.pm
--- tinyca2-0.7.5.org/lib/GUI/X509_infobox.pm 2006-07-25 22:12:00.000000000 +0200
+++ tinyca2-0.7.5/lib/GUI/X509_infobox.pm 2015-02-04 06:33:01.949085141 +0100
@@ -90,6 +90,15 @@
'center', 0, 0);
$self->{'x509textbox'}->pack_start($self->{'certfingerprintsha1'},
0, 0, 0);
+
+ if(defined($self->{'certfingerprintsha256'})) {
+ $self->{'certfingerprintsha256'}->destroy();
+ }
+ $self->{'certfingerprintsha256'} = GUI::HELPERS::create_label(
+ _("Fingerprint (SHA256)").": ".$parsed->{'FINGERPRINTSHA256'},
+ 'center', 0, 0);
+ $self->{'x509textbox'}->pack_start($self->{'certfingerprintsha256'},
+ 0, 0, 0);
}
if (($mode eq 'cert') || ($mode eq 'cacert')) {
diff -urN tinyca2-0.7.5.org/lib/GUI.pm tinyca2-0.7.5/lib/GUI.pm
--- tinyca2-0.7.5.org/lib/GUI.pm 2015-02-04 06:32:29.398318503 +0100
+++ tinyca2-0.7.5/lib/GUI.pm 2015-02-04 06:33:19.512832137 +0100
@@ -29,14 +29,17 @@
# This hash maps our internal MD names to the displayed digest names.
# Maybe it should live in a crypto-related file instead of a UI-related file?
my %md_algorithms = (
- 'md5' => 'MD5',
- 'sha1' => 'SHA1',
- 'md2' => 'MD2',
- 'mdc2' => 'MDC2',
- 'md4' => 'MD4',
+ 'md5' => 'ins.MD5',
+# duplicate 'sha1' => 'SHA1',
+# n/a 'md2' => 'MD2',
+# n/a 'mdc2' => 'MDC2',
+ 'md4' => 'ins.MD4',
'ripemd160' => 'RIPEMD-160',
# 'sha' => 'SHA',
'sha1' => 'SHA-1',
+ 'sha256' => 'SHA-256',
+ 'sha384' => 'SHA-384',
+ 'sha512' => 'SHA-512',
);
my %bit_lengths = (
@@ -1060,7 +1063,7 @@
$piter = $store->append($root);
$store->set($piter, 0 => $t);
- for my $l (qw(FINGERPRINTMD5 FINGERPRINTSHA1)) {
+ for my $l (qw(FINGERPRINTMD5 FINGERPRINTSHA1 FINGERPRINTSHA256 FINGERPRINTSHA384 FINGERPRINTSHA512)) {
if(defined($parsed->{$l})) {
$citer = $store->append($piter);
$store->set($citer,
diff -urN tinyca2-0.7.5.org/lib/OpenSSL.pm tinyca2-0.7.5/lib/OpenSSL.pm
--- tinyca2-0.7.5.org/lib/OpenSSL.pm 2015-02-04 06:32:29.398318503 +0100
+++ tinyca2-0.7.5/lib/OpenSSL.pm 2015-02-04 06:33:19.516165552 +0100
@@ -674,6 +674,47 @@
GUI::HELPERS::print_warning($t, $ext);
}
+ $cmd = "$self->{'bin'} x509 -noout -fingerprint -sha256 -in $file";
+ $ext = "$cmd\n\n";
+ $pid = open3($wtfh, $rdfh, $rdfh, $cmd);
+ while(<$rdfh>){
+ $ext .= $_;
+ ($k, $v) = split(/=/);
+ $tmp->{'FINGERPRINTSHA256'} = $v if($k =~ /SHA256 Fingerprint/i);
+ chomp($tmp->{'FINGERPRINTSHA256'});
+ }
+ waitpid($pid, 0);
+ $ret = $? >> 8;
+
+ $cmd = "$self->{'bin'} x509 -noout -fingerprint -sha384 -in $file";
+ $ext = "$cmd\n\n";
+ $pid = open3($wtfh, $rdfh, $rdfh, $cmd);
+ while(<$rdfh>){
+ $ext .= $_;
+ ($k, $v) = split(/=/);
+ $tmp->{'FINGERPRINTSHA384'} = $v if($k =~ /SHA384 Fingerprint/i);
+ chomp($tmp->{'FINGERPRINTSHA384'});
+ }
+ waitpid($pid, 0);
+ $ret = $? >> 8;
+
+ $cmd = "$self->{'bin'} x509 -noout -fingerprint -sha512 -in $file";
+ $ext = "$cmd\n\n";
+ $pid = open3($wtfh, $rdfh, $rdfh, $cmd);
+ while(<$rdfh>){
+ $ext .= $_;
+ ($k, $v) = split(/=/);
+ $tmp->{'FINGERPRINTSHA512'} = $v if($k =~ /SHA512 Fingerprint/i);
+ chomp($tmp->{'FINGERPRINTSHA512'});
+ }
+ waitpid($pid, 0);
+ $ret = $? >> 8;
+
+ if($ret) {
+ $t = _("Error reading fingerprint from Certificate");
+ GUI::HELPERS::print_warning($t, $ext);
+ }
+
# get subject in openssl format
$cmd = "$self->{'bin'} x509 -noout -subject -in $file";
$ext = "$cmd\n\n";
diff -urN tinyca2-0.7.5.org/lib/REQ.pm tinyca2-0.7.5/lib/REQ.pm
--- tinyca2-0.7.5.org/lib/REQ.pm 2006-07-25 22:12:00.000000000 +0200
+++ tinyca2-0.7.5/lib/REQ.pm 2015-02-04 06:33:19.516165552 +0100
@@ -59,7 +59,7 @@
GUI::HELPERS::print_error($t);
}
$opts->{'bits'} = 4096;
- $opts->{'digest'} = 'sha1';
+ $opts->{'digest'} = 'sha256';
$opts->{'algo'} = 'rsa';
if(defined($opts) && $opts eq "sign") {
$opts->{'sign'} = 1;
@@ -426,6 +426,12 @@
$opts->{'digest'} = "md5";
} elsif ($opts->{'digest'} =~ /^sha1/) {
$opts->{'digest'} = "sha1";
+ } elsif ($opts->{'digest'} =~ /^sha256/) {
+ $opts->{'digest'} = "sha256";
+ } elsif ($opts->{'digest'} =~ /^sha384/) {
+ $opts->{'digest'} = "sha384";
+ } elsif ($opts->{'digest'} =~ /^sha512/) {
+ $opts->{'digest'} = "sha512";
} elsif ($opts->{'digest'} =~ /^ripemd160/) {
$opts->{'digest'} = "ripemd160";
} else {
diff -ur orig/tinyca-0.7.5/templates/openssl.cnf tinyca-0.7.5/templates/openssl.cnf
--- orig/tinyca-0.7.5/templates/openssl.cnf 2006-07-25 15:12:01.000000000 -0500
+++ tinyca-0.7.5/templates/openssl.cnf 2014-11-01 12:30:43.238590285 -0500
@@ -15,7 +15,7 @@
x509_extensions = client_cert
default_days = 365
default_crl_days= 30
-default_md = sha1
+default_md = sha512
preserve = no
policy = policy_client
@@ -33,7 +33,7 @@
x509_extensions = server_cert
default_days = 365
default_crl_days= 30
-default_md = sha1
+default_md = sha512
preserve = no
policy = policy_server
@@ -51,7 +51,7 @@
x509_extensions = v3_ca
default_days = 365
default_crl_days= 30
-default_md = sha1
+default_md = sha512
preserve = no
policy = policy_ca