Instance Methodswift-crypto 3.8.0Crypto
hpkeRepresentation(kem:)
Creates a serialized representation of the public key.
HPKE-NIST-EC-KEMs.swift:59func hpkeRepresentation(kem: HPKE.KEM) throws -> Data
Returns
The serialized representation of the public key.
Throws
CryptoKit/HPKE/Errors/inconsistentCiphersuiteAndKey
if the key encapsulation mechanism requested is incompatible with this public key.
kem: The Key Encapsulation Mechanism to use with the public key.
Other members in extension
Typealiases
typealias EphemeralPrivateKey
The type of the ephemeral private key associated with this public key.
typealias HPKEEphemeralPrivateKey
The type of the ephemeral private key associated with this public key.
Type members
init<D>(D, kem: HPKE.KEM
) throws Creates a NIST P-256 elliptic curve public key for use with Diffie-Hellman key exchange.
init<Bytes>(compactRepresentation: Bytes
) throws Creates a P-256 public key for key agreement from a compact representation of the key.
init<Bytes>(compressedRepresentation: Bytes
) throws Creates a P-256 public key for key agreement from a compressed representation of the key.
init<Bytes>(derRepresentation: Bytes
) throws Creates a P-256 public key for key agreement from a Distinguished Encoding Rules (DER) encoded representation.
init(pemRepresentation: String
) throws Creates a P-256 public key for key agreement from a Privacy-Enhanced Mail (PEM) representation.
init<D>(rawRepresentation: D
) throws Creates a P-256 public key for key agreement from a collection of bytes.
init<Bytes>(x963Representation: Bytes
) throws Creates a P-256 public key for key agreement from an ANSI x9.63 representation.
Instance members
var compactRepresentation: Data?
A compact representation of the public key.
var compressedRepresentation: Data
A compressed representation of the public key.
var derRepresentation: Data
A Distinguished Encoding Rules (DER) encoded representation of the public key.
var pemRepresentation: String
A Privacy-Enhanced Mail (PEM) representation of the public key.
var rawRepresentation: Data
A full representation of the public key.
var x963Representation: Data
An ANSI x9.63 representation of the public key.