Data
Extensions for encrypting, decrypting or signing Data using the appropriate algorithm determined by the key’s curve with the provided ECPrivateKey or ECPublicKey.
-
Decrypt the encrypted data using the provided
ECPrivateKey. The signing algorithm used is determined based on the private key’s elliptic curve.Throws
An ECError if the Encrypted data fails to be decrypted.Declaration
Swift
public func decrypt(with key: ECPrivateKey) throws -> DataParameters
ecPrivateKeyThe elliptic curve private key.
Return Value
The plaintext Data.
-
Encrypt the data using the
ECPublicKey. This either uses theSecKeyAlgorithm:eciesEncryptionStandardVariableIVX963SHA256AESGCM, or the equivalent OpenSSL implementation.Throws
An ECError is the plaintext fails to be encrypted.Declaration
Swift
public func encrypt(with key: ECPublicKey) throws -> DataParameters
ecPrivateKeyThe elliptic curve private key.
Return Value
The encrypted Data.
-
Sign the plaintext data using the provided
ECPrivateKey. The Data is signed using ECDSA with either SHA256, SHA384 or SHA512, depending on the key’s curve.Throws
An ECError if a valid signature is unable to be created.Declaration
Swift
public func sign(with key: ECPrivateKey) throws -> ECSignatureReturn Value
An ECSignature on failure.
Data Extension Reference