WebCrypto compatible encryption with Bash and OpenSSL.
This package implements the Webcryptobox encryption API.
Compatible packages:
There is also a CLI tool: wcb.sh
This script relies the following packages:
- OpenSSL
- cat, grep and xxd
Make sure they're installed on your system and globally callable.
Include the library in your script:
. webcryptobox.sh
The Bash library provides the following functions.
Functions for handling symmetric AES-256-CBC encryption.
Generate AES key.
Encrypt file contents with AES key.
Decrypt file contents with AES key.
Functions for handling asymmetric ECDH P-521 AES-256-CBC encryption.
Generate a private EC key PEM.
Given a private EC key PEM, output the corresponding public EC key PEM.
Calculate a fingerprint of the public key from either a private key or a public key PEM. Hashfunction can either be sha1
or sha256
.
Derive an AES key from private and public key pair provides as PEMs.
Derive a password from private and public key pair provides as PEMs with given length. Length must be less than 32 bytes.
Encrypts a private key PEM with a passphrase.
Decrypts an encrypted private key PEM with a passphrase.
Encrypts a private key PEM for private and public key pair given as PEMs.
Decrypts an encrypted private key PEM for private and public key pair given as PEMs.
Encrypts a message for rivate and public key pair given as PEMs.
Decrypts an encrypted message for private and public key pair given as PEMs.
This project is licensed under the Apache 2.0 License.
© 2022 Johannes J. Schmidt