Skip to content

Commit cc4d405

Browse files
committed
ocsp: update keys used in tests
Use generic keys whenever possible.
1 parent ef4fa5e commit cc4d405

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Rake::TestTask.new(:test_fips_internal) do |t|
3030
'test/openssl/test_digest.rb',
3131
'test/openssl/test_hmac.rb',
3232
'test/openssl/test_kdf.rb',
33-
'test/openssl/test_ocsp.rb',
3433
'test/openssl/test_pkcs12.rb',
3534
'test/openssl/test_ts.rb',
3635
]

test/openssl/test_ocsp.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def setup
1313
# @cert2 @ocsp_cert
1414

1515
ca_subj = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=TestCA")
16-
@ca_key = Fixtures.pkey("rsa1024")
16+
@ca_key = Fixtures.pkey("rsa-1")
1717
ca_exts = [
1818
["basicConstraints", "CA:TRUE", true],
1919
["keyUsage", "cRLSign,keyCertSign", true],
@@ -22,7 +22,7 @@ def setup
2222
ca_subj, @ca_key, 1, ca_exts, nil, nil)
2323

2424
cert_subj = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=TestCA2")
25-
@cert_key = Fixtures.pkey("rsa1024")
25+
@cert_key = Fixtures.pkey("rsa-2")
2626
cert_exts = [
2727
["basicConstraints", "CA:TRUE", true],
2828
["keyUsage", "cRLSign,keyCertSign", true],
@@ -31,14 +31,14 @@ def setup
3131
cert_subj, @cert_key, 5, cert_exts, @ca_cert, @ca_key)
3232

3333
cert2_subj = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=TestCert")
34-
@cert2_key = Fixtures.pkey("rsa1024")
34+
@cert2_key = Fixtures.pkey("rsa-3")
3535
cert2_exts = [
3636
]
3737
@cert2 = OpenSSL::TestUtils.issue_cert(
3838
cert2_subj, @cert2_key, 10, cert2_exts, @cert, @cert_key)
3939

4040
ocsp_subj = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=TestCAOCSP")
41-
@ocsp_key = Fixtures.pkey("rsa2048")
41+
@ocsp_key = Fixtures.pkey("p256")
4242
ocsp_exts = [
4343
["extendedKeyUsage", "OCSPSigning", true],
4444
]
@@ -63,8 +63,10 @@ def test_certificate_id_issuer_name_hash
6363

6464
def test_certificate_id_issuer_key_hash
6565
cid = OpenSSL::OCSP::CertificateId.new(@cert, @ca_cert)
66-
assert_equal OpenSSL::Digest.hexdigest('SHA1', OpenSSL::ASN1.decode(@ca_cert.to_der).value[0].value[6].value[1].value), cid.issuer_key_hash
67-
assert_equal "d1fef9fbf8ae1bc160cbfa03e2596dd873089213", cid.issuer_key_hash
66+
# content of subjectPublicKey (bit string) in SubjectPublicKeyInfo
67+
spki = OpenSSL::ASN1.decode(@ca_key.public_to_der)
68+
assert_equal OpenSSL::Digest.hexdigest("SHA1", spki.value[1].value),
69+
cid.issuer_key_hash
6870
end
6971

7072
def test_certificate_id_hash_algorithm

0 commit comments

Comments
 (0)