Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

== on certificates seems to compare ... strings? #158

Closed
mcr opened this issue Oct 7, 2017 · 2 comments
Closed

== on certificates seems to compare ... strings? #158

mcr opened this issue Oct 7, 2017 · 2 comments

Comments

@mcr
Copy link
Contributor

mcr commented Oct 7, 2017

Given two instances of a certificate, how can I determine if it's the same certificate?
I feel that == ought to do the trick.
It does not, as I think it looks for eq() (same object).

I can get around this using, for instance: certA.to_der == certB.to_der, which gives me a byte-comparison equality. That's great if they are actually the identical certificate (which in my present case, I care about), but I find nothing to do essentially, if certA.issuer == certB.issuer, then certA.subject == certB.subject.
Should it be == that does this?

@rhenium
Copy link
Member

rhenium commented Oct 10, 2017

I think OpenSSL::X509::Certificate#== should do a byte-by-byte comparison.

@rhenium
Copy link
Member

rhenium commented Oct 22, 2017

#161 has been merged to master. v2.1.0 will include those == methods.

@rhenium rhenium closed this as completed Oct 22, 2017
ct-clearhaus added a commit to clearhaus/pedicel that referenced this issue May 22, 2018
This is to accommodate for the concerns raised by @kse-clearhaus in
#7 (comment)

See also ruby/openssl#158
lawrence-forooghian added a commit to ably-forks/em-http-request that referenced this issue May 14, 2024
Mistake in 9996b7b, which I missed since CI wasn’t running the relevant
tests (as described in 139a59b).

(Older versions of the OpenSSL gem hadn’t implemented certificate #==
method; see ruby/openssl#158.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants