Initializer
init(pemRepresentation:)
Creates a secp256k1 public 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 not "PUBLIC KEY"; CryptoKitASN1Error cases for malformed ASN.1 inside the PEM body; CryptoKitError.incorrectParameterSize if the embedded key is neither 33 nor 65 bytes; secp256k1Error.underlyingCryptoError if secp256k1_ec_pubkey_parse rejects the bytes.