You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/rubyrequire'openssl'includeOpenSSL::X509cert1,cert2=2.times.map{Certificate.new}cert1.serial=1cert1.subject=Name.new([["CN","ONE"]])cert1.issuer=Name.new([["CN","ONE_ISSUER"]])cert2.serial=2cert2.subject=Name.new([["CN","TWO"]])cert2.issuer=Name.new([["CN","TWO_ISSUER"]])### Given that the serial and cn are different, these should not be equal, but they are anywayifcert1 == cert2puts"equal"elseputs"not equal"end
According to the docs:
= OpenSSL::X509::Certificate#==
(from ruby core)
=== Implementation from Certificate
------------------------------------------------------------------------
cert1 == cert2 -> true | false
------------------------------------------------------------------------
Compares the two certificates. Note that this takes into account all
fields, not just the issuer name and the serial number.
Tested on these versions:
openssl gem 3.2.0 on debian 12 with ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]
openssl gem 3.3.0 on OS X 15.2 with ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin24]
The text was updated successfully, but these errors were encountered:
Minimal reproduction:
According to the docs:
Tested on these versions:
The text was updated successfully, but these errors were encountered: