-
Notifications
You must be signed in to change notification settings - Fork 167
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
Make NIST PublicKey
s conform to Hashable
#176
base: main
Are you sure you want to change the base?
Conversation
@@ -88,6 +88,14 @@ extension P256 { | |||
let pemDocument = ASN1.PEMDocument(type: "PUBLIC KEY", derBytes: self.derRepresentation) | |||
return pemDocument.pemString | |||
} | |||
|
|||
public static func ==(lhs: Self, rhs: Self) -> Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equatable, Part of #174 but I was unable to create a diff between just this PR and the source branch of that PR.
@@ -94,6 +94,14 @@ extension ${CURVE} { | |||
let pemDocument = ASN1.PEMDocument(type: "PUBLIC KEY", derBytes: self.derRepresentation) | |||
return pemDocument.pemString | |||
} | |||
|
|||
public static func ==(lhs: Self, rhs: Self) -> Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equatable, Part of #174 but I was unable to create a diff between just this PR and the source branch of that PR.
@@ -453,6 +453,138 @@ class SignatureTests: XCTestCase { | |||
let compressedX963Positive = Data(base64Encoded: "A+QHCXtGd5WWSQgp37FBPXMy+nnSwFK79QQD0ZeNMv7L")! | |||
XCTAssertThrowsError(try P256.Signing.PublicKey(x963Representation: compressedX963Positive)) | |||
} | |||
|
|||
|
|||
func testP256SigningPublicKeyEquatable() throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equatable, Part of #174 but I was unable to create a diff between just this PR and the source branch of that PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking for future CryptoKit updates.
This comment was marked as off-topic.
This comment was marked as off-topic.
Thanks for the input here @Sajjon. I'm going to hide both comments, and report @vivoxfold3's, as the assertion is transparently untrue (this is not your first contribution here, and you and I have spoken several times before. The hide is only to keep this PR on-topic, not because your comment wasn't welcome. |
Make ALL
NIST
PublicKeys conform toHashable
N.B. Merge open PR #174 first (or if #174 is closed, close this one too), since this PR builds on top of that.
Checklist
If you've made changes to
gyb
files.script/generate_boilerplate_files_with_gyb
and included updated generated files in a commit of this pull requestMotivation:
This is the
NIST
analogue counterpart of #175, so the motivation put in there applies here as well.This PR is an addition of open PR #174.
Modifications:
P256
,P384
andP521
's Signing and KeyAgreementPublicKey
beHashable
, by...NISTECPublicKey
to beHashable
and addinghash:into
function inECDH.swift.gyb
Result:
ALL NIST PublicKey's now conform to
Hashable