Initializer
init(derRepresentation:)
Creates a secp256k1 private key for signing from a Distinguished Encoding Rules (DER) encoded representation.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
init<Bytes>(derRepresentation: Bytes) throws where Bytes : RandomAccessCollection, Bytes.Element == UInt8
Parameters
-
derRepresentation
-
A DER-encoded representation of the key.
Discussion
Throws
CryptoKitASN1Error if derRepresentation parses as neither PKCS#8 (RFC 5958) nor SEC 1 EC private-key DER; secp256k1Error.incorrectKeySize if the decoded scalar is not 32 bytes; secp256k1Error.underlyingCryptoError if secp256k1_ec_seckey_verify rejects the scalar.