Introduction
Welcome to the CRDCrypt documentation! Here you will find detailed information on how to use CRDCrypt, a library for secure encryption and decryption in iOS.
Installation
To install CRDCrypt, follow these steps:
- Open your Xcode project
- Go to “File” -> “Swift Packages” -> “Add Package Dependency”
- Enter the package URL: https://github.com/example/CRDCrypt.git
- Choose the version range you want to use
- Add the package to your desired target
- Click on “Finish”
Usage
Encrypting
To encrypt data using CRDCrypt, follow these steps:
- Import the CRDCrypt module in your Swift file:
import CRDCrypt
- Create an instance of the
CRDCryptor
class:let cryptor = CRDCryptor()
- Generate a random encryption key:
let encryptionKey = cryptor.generateEncryptionKey()
- Encrypt your data using the encryption key:
let encryptedData = cryptor.encrypt(data: plainData, encryptionKey: encryptionKey)
Decrypting
To decrypt data using CRDCrypt, follow these steps:
- Import the CRDCrypt module in your Swift file:
import CRDCrypt
- Create an instance of the
CRDCryptor
class:let cryptor = CRDCryptor()
- Decrypt your data using the encryption key:
let decryptedData = cryptor.decrypt(data: encryptedData, encryptionKey: encryptionKey)
Additional Features
Key Generation
The CRDCryptor
class provides methods for generating secure encryption keys:
generateEncryptionKey()
: Generates a random encryption keygenerateEncryptionKey(withPassword: String)
: Generates an encryption key from a user-provided password
Encryption Options
CRDCrypt supports additional encryption options:
setEncryptionMode(_ mode: CRDEncryptionMode)
: Sets the encryption mode (CBC, ECB, etc.)setEncryptionPadding(_ padding: CRDEncryptionPadding)
: Sets the encryption padding (PKCS7, ANSI X.923, etc.)
Resources
For additional information and detailed usage examples, refer to the official CRDCrypt GitHub repository.
Conclusion
CRDCrypt provides a secure and efficient encryption and decryption library for iOS development. With its easy-to-use functions and support for various encryption options, you can confidently protect your sensitive data. If you have any further questions, feel free to consult the official documentation or contact the CRDCrypt team.