public class NIOSSLPublicKey

An NIOSSLPublicKey is an abstract handle to a public key owned by BoringSSL.

This object is of minimal utility, as it cannot be used for very many operations in NIOSSL. Its primary purpose is to allow extracting public keys from NIOSSLCertificate objects to be serialized, so that they can be passed to general-purpose cryptography libraries.

  • Extracts the bytes of this public key in the SubjectPublicKeyInfo format.

    The SubjectPublicKeyInfo format is defined in RFC 5280. In addition to the raw key bytes, it also provides an identifier of the algorithm, ensuring that the key can be unambiguously decoded.


    If an error occurred while serializing the key.



    public func toSPKIBytes() throws -> [UInt8]

    Return Value

    The DER-encoded SubjectPublicKeyInfo bytes for this public key.