Take Apple CryptoKit to the command line and perform cryptographic operations securely and efficiently.
โ Create or validate UUID (universally unique value).
โ Perform cryptographically secure hashing (SHA-2 hash with 512, 384 or 256-bit digest).
โ Create or validate HMAC (hash message authentication).
โ Crypt and decrypt using AES-GCM cipher.
โ Crypt and decrypt using ChaCha20-Poly1305 cipher.
โ Symmetric key auto-hash to SHA-256 if needed.
๐ง X25519 key agreement and ed25519 signatures.
๐ง NIST P-521 signatures and key agreement.
๐ง NIST P-384 signatures and key agreement.
๐ง NIST P-256 signatures and key agreement.
Simply run:
$ cryptokit [subcommand]
-h, --help
: Show CryptoKitCLI
help information.--version
: Show CryptoKitCLI
version.$ cryptokit uuid
-c, --check <check>
: Validate UUID string or file path.$ cryptokit hash
-d, --digest <digest>
: SHA-2 hash with the chosen digest. (default: sha512)$ cryptokit hmac
-d, --digest <digest>
: SHA-2 hash with the chosen digest. (default: sha512)-c, --check <check>
: Validate HMAC string or file path.$ cryptokit aes
-n, --nonce <nonce>
: Nonce string or file path.-a, --auth <auth>
: Additional data string or file path.-d, --decrypt
: Decrypt the input and verify authenticity using combined data.-t, --tag <tag>
: Decrypt the input and verify authenticity using authentication tag and nonce.-s, --split
: Print authentication tag and nonce instead of combined data.$ cryptokit poly
-n, --nonce <nonce>
: Nonce string or file path.-a, --auth <auth>
: Additional data string or file path.-d, --decrypt
: Decrypt the input and verify authenticity using combined data.-t, --tag <tag>
: Decrypt the input and verify authenticity using authentication tag and nonce.-s, --split
: Print authentication tag and nonce instead of combined data.Thereโre more than one way to install CryptoKitCLI
.
$ brew install alexruperez/CryptoKitCLI/formula
$ mint install alexruperez/CryptoKitCLI
Make sure Xcode 11.4+ is installed first.
$ git clone https://github.com/alexruperez/CryptoKitCLI.git
$ cd CryptoKitCLI
$ make install
With that installed and in the /usr/local/bin
folder, now itโs ready to serve.
Use as CLI
$ git clone https://github.com/alexruperez/CryptoKitCLI.git
$ cd CryptoKitCLI
$ swift run
Use as dependency
Add the following to your Package.swift fileโs dependencies:
.package(url: "https://github.com/alexruperez/CryptoKitCLI.git", from: "0.1.0")
And then import wherever needed: import CryptoKitCLI
For more information, see the Swift Package Manager documentation.
Alex Rupรฉrez โ @alexruperez โ me@alexruperez.com
CryptoKitCLI is available under the MIT license. See the LICENSE file for more info.