File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed
Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -33,11 +33,10 @@ module OpenSSL::X509
3333
3434 # Create certificate from DER (binary) format
3535 def self.from_der (der : Bytes )
36- ptr = der.to_unsafe
37- x509 = LibCrypto .d2i_x509(nil , pointerof (ptr), der.size.to_i64)
38-
36+ # use the crystal helper
37+ x509, remaining_bytes = from_der?(der)
3938 raise CertificateError .new " Could not parse DER certificate" unless x509
40- new x509
39+ x509
4140 end
4241
4342 def self.from_der (io : IO )
@@ -215,20 +214,6 @@ module OpenSSL::X509
215214 bytes[0 , actual_size]
216215 end
217216
218- # Get the signature algorithm
219- def signature_algorithm : String ?
220- alg = LibCrypto .x509_get0_tbs_sigalg(self )
221- return nil if alg.null?
222-
223- # Convert algorithm OID to string
224- io = IO ::Memory .new
225- bio = OpenSSL ::GETS_BIO .new(io)
226- LibCrypto .i2a_asn1_object(bio, alg.value.algorithm)
227- io.to_s
228- rescue
229- nil
230- end
231-
232217 # Verify the certificate's signature using a public key
233218 # Returns true if signature is valid, false otherwise
234219 def verify_signature (public_key : OpenSSL ::PKey ::PKey ) : Bool
You can’t perform that action at this time.
0 commit comments