AESKeyWrap
AESKeyWrap is a library that provides algorithms and methods for securely encrypting and decrypting keys using the AES Key Wrap algorithm.
Table of Contents
Installation
To install AESKeyWrap, you can use CocoaPods. Simply add the following line to your Podfile:
pod 'AESKeyWrap'
Then run the command pod install
to install the dependencies.
Usage
To use AESKeyWrap in your project, import the library:
import AESKeyWrap
Once imported, you can use the AESKeyWrap methods to encrypt and decrypt keys with the AES Key Wrap algorithm.
The core methods provided by AESKeyWrap are:
- encryptKey(key: Data, wrappingKey: Data) -> Data: Encrypts the provided key using the specified wrapping key.
- decryptKey(ciphertext: Data, wrappingKey: Data) -> Data: Decrypts the provided ciphertext using the specified wrapping key.
Examples
Here are a few examples of how to use AESKeyWrap:
// Example 1: Encrypt a key using AESKeyWrap
let key = Data(...) // the key to be encrypted
let wrappingKey = Data(...) // the wrapping key
let encryptedKey = AESKeyWrap.encryptKey(key: key, wrappingKey: wrappingKey)
print("Encrypted Key: \(encryptedKey)")
// Example 2: Decrypt a ciphertext using AESKeyWrap
let ciphertext = Data(...) // the ciphertext to be decrypted
let decryptedKey = AESKeyWrap.decryptKey(ciphertext: ciphertext, wrappingKey: wrappingKey)
print("Decrypted Key: \(decryptedKey)")
API Reference
For detailed API reference and additional usage examples, please refer to the official GitHub repository.
License
This library is released under the MIT License.