Instance Methodswift-certificates 1.13.0X509
serializeAsPEM
CertificatePrivateKey.swift:339- iOS
- 14+
- macOS
- 11.0+
- Mac Catalyst
- 14+
- tvOS
- 14+
- visionOS
- 1.0+
- watchOS
- 7+
func serializeAsPEM() throws -> PEMDocument func serializeAsPEM() throws -> PEMDocument s4X50911CertificateV10PrivateKeyV14serializeAsPEM9SwiftASN111PEMDocumentVyKF What are these?3DUENimport X509A library for working with X.509 certificates.
struct PrivateKeyA private key that can be used with a certificate.
struct Certificatestruct PEMDocumentA PEM document is some data, and a discriminator type that is used to advertise the content.
init(_ rsa: _RSA.Signing.PrivateKey) Construct a private key wrapping a RSA private key.
init(_ ed25519: Curve25519.Signing.PrivateKey) Construct a private key wrapping an Ed25519 private key.
init(_ p256: P256.Signing.PrivateKey) Construct a private key wrapping a P256 private key.
init(_ p384: P384.Signing.PrivateKey) Construct a private key wrapping a P384 private key.
init(_ p521: P521.Signing.PrivateKey) Construct a private key wrapping a P521 private key.
init(derBytes: [UInt8]) throws Initialize a new certificate private key from PKCS8-format DER bytes.
init(pemDocument: PEMDocument) throws init(pemEncoded: String) throws var description: String { get }var publicKey: Certificate.PublicKey { get }Obtain the PublicKey corresponding to this private key.
func sign<Bytes>(bytes: Bytes, signatureAlgorithm: Certificate.SignatureAlgorithm) throws -> Certificate.Signature where Bytes : DataProtocol Use the private key to sign the provided bytes with a given signature algorithm.