Initializer
init(pemRepresentation:)
Creates a secp256k1 private key for signing from a Privacy-Enhanced Mail (PEM) representation.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
init(pemRepresentation: String) throws
Parameters
-
pemRepresentation
-
A PEM representation of the key.
Discussion
Throws
CryptoKitASN1Error.invalidPEMDocument if pemRepresentation is not a valid PEM document or its type label is neither "EC PRIVATE KEY" (SEC 1) nor "PRIVATE KEY" (PKCS#8); CryptoKitASN1Error cases for malformed ASN.1 inside the PEM body; secp256k1Error.incorrectKeySize if the decoded scalar is not 32 bytes; secp256k1Error.underlyingCryptoError if secp256k1_ec_seckey_verify rejects the scalar.