<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "OpenSSL",
  "identifier" : "/documentation/OpenSSL/RSA/PublicKey/init(pemRepresentation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "OpenSSL"
    ],
    "preciseIdentifier" : "s:7OpenSSL3RSAO9PublicKeyV17pemRepresentationAESS_tKcfc"
  },
  "title" : "init(pemRepresentation:)"
}
-->

# init(pemRepresentation:)

Parses an RSA public key from a PEM-encoded SPKI string.

```
init(pemRepresentation: String) throws
```

## Parameters

`pemRepresentation`

The PEM-encoded SPKI public
key. The RFC 7468 framing is mandatory; whitespace around
the markers and inside the base64 body is permitted.

## Discussion

Performs outer-frame validation only: the input must be valid
UTF-8 and must contain both a `-----BEGIN` marker and a
`PUBLIC KEY-----` marker. The check is deliberately narrower
than the private-key counterpart — a traditional PKCS#1
`-----BEGIN RSA PUBLIC KEY-----` header would pass the
`PUBLIC KEY-----` substring test but is rejected by downstream
consumers of `pemData`; normalize to SPKI before calling.

> Warning: Validation is **string-marker-only**. A malformed
> SubjectPublicKeyInfo payload inside a valid PEM frame is
> not detected here. Future provider-backed verification will
> reject such inputs before use.

> Throws: ``doc://OpenSSL/documentation/OpenSSL/OpenSSLError/invalidKey(_:)`` if the input is not
> valid UTF-8 or lacks the expected frame markers.