init(version:subject:privateKey:attributes:)

Construct a CSR for a specific private key.

CertificateSigningRequest.swift:167
iOS
13+
macOS
10.15+
tvOS
13+
watchOS
6+
init(version: Version, subject: DistinguishedName, privateKey: Certificate.PrivateKey, attributes: Attributes) throws

Parameters

version

The CSR version.

subject

The DistinguishedName of the subject of this CSR

privateKey

The private key associated with this CSR.

attributes

The attributes associated with this CSR

This API can be used to construct a certificate signing request that can be passed to a certificate authority. It will correctly generate a signature over the request.

A default signature algorithm to use for the signature of this CSR is automatically chosen based on the type of the private key.