<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "P256K",
  "identifier" : "/documentation/P256K/P256K/Signing/PrivateKey/init(pemRepresentation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "P256K"
    ],
    "preciseIdentifier" : "s:5P256KAAO7SigningO10PrivateKeyV17pemRepresentationAFSS_tKcfc"
  },
  "title" : "init(pemRepresentation:)"
}
-->

# init(pemRepresentation:)

Creates a secp256k1 private key for signing from a Privacy-Enhanced Mail (PEM) representation.

```
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; ``doc://P256K/documentation/P256K/secp256k1Error/incorrectKeySize`` if the decoded scalar is not
> 32 bytes; ``doc://P256K/documentation/P256K/secp256k1Error/underlyingCryptoError`` if `secp256k1_ec_seckey_verify`
> rejects the scalar.