EccRecoverKey
public class EccRecoverKey
Utilities for recovering supported ECC keys.
-
Default init.
Declaration
Swift
public init()
-
Recover a public key from the private key.
Throws
If the public key cannot be recovered, or another error is encountered.Declaration
Swift
public class func recoverPublicKey(privateKey: Data, curve: EllipticCurveType) throws -> Data
Parameters
privateKey
The private key.
curve
The curve
K1
orR1
.Return Value
The public key.
-
Recover a public key from a signature, message.
Throws
If unable to recover the target public key.Declaration
Swift
public class func recoverPublicKey(signatureDer: Data, message: Data, recid: Int, curve: EllipticCurveType = .r1) throws -> Data
Parameters
signatureDer
The signature in der format.
message
The message.
recid
The recovery id (0-3).
curve
The curve
K1
orR1
.Return Value
The public key.
-
Get the recovery id (recid) for a signature, message and target public key.
Throws
If none of the possible recids recover the target public key.Declaration
Swift
public class func recid(signatureDer: Data, message: Data, targetPublicKey: Data, curve: EllipticCurveType = .r1) throws -> Int
Parameters
signatureDer
The signature in der format.
message
The message.
targetPublicKey
The target public key.
curve
The curve
K1
orR1
.Return Value
The recovery id (0-3).