KeyknoxCrypto
open class KeyknoxCrypto
extension KeyknoxCrypto: KeyknoxCryptoProtocol
KeyknoxCryptoProtocol implementation using VirgilCrypto
-
VirgilCrypto
Declaration
Swift
public let crypto: VirgilCrypto
-
Init
Declaration
Swift
public init(crypto: VirgilCrypto)
Parameters
crypto
VirgilCrypto instance
-
Decrypts EncryptedKeyknoxValue
Throws
KeyknoxCryptoError.emptyPublicKeysList
is public keys list is emptyKeyknoxManagerError.decryptionFailed
if decryption failed- Rethrows from
VirgilCrypto
Declaration
Swift
public func decrypt(encryptedKeyknoxValue: EncryptedKeyknoxValue, privateKey: VirgilPrivateKey, publicKeys: [VirgilPublicKey]) throws -> DecryptedKeyknoxValue
Parameters
encryptedKeyknoxValue
encrypted value from Keyknox service
privateKey
private key to decrypt data. Should be of type VirgilPrivateKey
publicKeys
allowed public keys to verify signature. Should be of type VirgilPublicKey
Return Value
DecryptedKeyknoxValue
-
Encrypts data for Keyknox
Throws
KeyknoxCryptoError.emptyPublicKeysList
is public keys list is emptyKeyknoxCryptoError.emptyData
if data if empty- Rethrows from
RecipientCipher
,Signer
Declaration
Swift
public func encrypt(data: Data, privateKey: VirgilPrivateKey, publicKeys: [VirgilPublicKey]) throws -> (Data, Data)
Parameters
data
Data to encrypt
privateKey
Private key to sign data. Should be of type VirgilPrivateKey
publicKeys
Public keys to encrypt data. Should be of type VirgilPublicKey
Return Value
Meta information and encrypted blob