-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix: Replace ECAlgorithm with EllipticCurve #5
Conversation
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.
Looks good, though this is a breaking change.
@@ -46,15 +46,14 @@ import OpenSSL | |||
@available(OSX 10.13, *) | |||
public class ECPrivateKey { | |||
/// The Elliptic curve this key was generated from. | |||
public let curveId: String | |||
public let curve: Curve |
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.
Note: change to public API
Sources/CryptorECC/Curve.swift
Outdated
} | ||
|
||
/// A prime256v1 curve. | ||
public static let prime256v1 = Curve.p256 |
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.
These are a new public API
Sources/CryptorECC/ECPublicKey.swift
Outdated
@@ -48,7 +48,7 @@ import OpenSSL | |||
@available(OSX 10.13, *) | |||
public class ECPublicKey { | |||
/// The Elliptic curve this key was generated from. | |||
public let curveId: String | |||
public let curve: Curve |
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.
Note: change to public API
We have kept curveId so that this is no longer a breaking change. |
/// A String description of the curve this key was generated from. | ||
public var curveId: String { | ||
return curve.description | ||
} |
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.
Could we leave the curveId as a constant and set as before during the init?
This pull request replaces ECAlgorithm with Curve.
This is now a public struct that has a public representation of the curve for comparisons and checking on your key and all the internal variables that are used for encrypting and signing.
This was done to replace the "CurveID" String with an Struct version of enum limiting the comparable options.