CryptoProvider
public protocol CryptoProvider : AnyObject
Provides utility functions for cryptographic operations.
-
Encrypts the given data using the specified key and encryption algorithm.
Declaration
Swift
func encrypt(keyId: String, algorithm: SymmetricKeyEncryptionAlgorithm, data: Data) throws -> DataParameters
keyIdID of the encryption key to use.
algorithmEncryption algorithm to use.
dataData to encrypt.
Return Value
Encrypted data.
-
Encrypts the given data using the specified key and encryption algorithm.
Declaration
Swift
func decrypt(keyId: String, algorithm: SymmetricKeyEncryptionAlgorithm, data: Data) throws -> DataParameters
keyIdID of the encryption key to use.
algorithmEncryption algorithm to use.
dataData to decrypt.
Return Value
Decrypted data.
-
Generate an encryption key to use for encrypting Sudo claims. Any existing keys are not removed to be able to decrypt existing claims but new claims will be encrypted using the newly generated key.
Declaration
Swift
func generateEncryptionKey() throws -> StringReturn Value
Unique ID of the generated key.
-
Get the current (most recently generated) symmetric key ID.
Declaration
Swift
func getSymmetricKeyId() throws -> String?Return Value
Symmetric Key ID.
-
Import encyrption keys to use for encrypting and decrypting Sudo claims.
Declaration
Swift
func importEncryptionKeys(keys: [EncryptionKey], currentKeyId: String) throwsParameters
keysKeys to import.
currentKeyIdID of the key to use for encrypting new claims..
-
Export encryption keys used for encrypting and decrypting Sudo claims.
Declaration
Swift
func exportEncryptionKeys() throws -> [EncryptionKey]Return Value
Encryption keys.
-
Removes all keys associated with this provider.
Declaration
Swift
func reset() throws
CryptoProvider Protocol Reference