Instance Methodswift-crypto 3.8.0Crypto
signature(for:)
Generates an Elliptic Curve Digital Signature Algorithm (ECDSA) signature of the digest you provide over the P-521 elliptic curve.
ECDSA.swift:468func signature<D>(for digest: D) throws -> P521.Signing.ECDSASignature where D : Digest
Parameters
- digest
The digest of the data to sign.
Returns
The signature corresponding to the digest. The signing algorithm employs randomization to generate a different signature on every call, even for the same data and key.
Other members in extension
Type members
init(compactRepresentable: Bool
) Creates a random P-521 private key for signing.
init<Bytes>(derRepresentation: Bytes
) throws Creates a P-521 private key for signing from a Distinguished Encoding Rules (DER) encoded representation.
init(pemRepresentation: String
) throws Creates a P-521 private key for signing from a Privacy-Enhanced Mail PEM) representation.
init<Bytes>(rawRepresentation: Bytes
) throws Creates a P-521 private key for signing from a collection of bytes.
init<Bytes>(x963Representation: Bytes
) throws Creates a P-521 private key for signing from an ANSI x9.63 representation.
Instance members
var derRepresentation: Data
A Distinguished Encoding Rules (DER) encoded representation of the private key.
var pemRepresentation: String
A Privacy-Enhanced Mail (PEM) representation of the private key.
var publicKey: P521.Signing.PublicKey
The corresponding public key.
var rawRepresentation: Data
A data representation of the private key.
var x963Representation: Data
An ANSI x9.63 representation of the private key.
func signature<D>(for: D
) throws -> P521.Signing.ECDSASignature Generates an Elliptic Curve Digital Signature Algorithm (ECDSA) signature of the data you provide over the P-521 elliptic curve, using SHA-512 as the hash function.