Skip to content

Commit 527b610

Browse files
committed
ns_spki: fix exception class in OpenSSL::Netscape::SPKI#to_der
It should raise OpenSSL::Netscape::SPKIError instead of OpenSSL::X509::CertificateError. No test cases covered this because it only occurs in exceptional cases, such as memory allocation failure.
1 parent b1f6a04 commit 527b610

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/openssl/ossl_ns_spki.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ ossl_spki_to_der(VALUE self)
115115

116116
GetSPKI(self, spki);
117117
if ((len = i2d_NETSCAPE_SPKI(spki, NULL)) <= 0)
118-
ossl_raise(eX509CertError, NULL);
118+
ossl_raise(eSPKIError, "i2d_NETSCAPE_SPKI");
119119
str = rb_str_new(0, len);
120120
p = (unsigned char *)RSTRING_PTR(str);
121121
if (i2d_NETSCAPE_SPKI(spki, &p) <= 0)
122-
ossl_raise(eX509CertError, NULL);
122+
ossl_raise(eSPKIError, "i2d_NETSCAPE_SPKI");
123123
ossl_str_adjust(str, p);
124124

125125
return str;

0 commit comments

Comments
 (0)