1.1.0 • Published 4 years ago
@worldcerts/oa-encryption v1.1.0
OpenCerts Encryption Library
This library is used for encrypting OpenCerts files in transit
API
Table of Contents
- ENCRYPTION_PARAMETERS
- generateEncryptionKey
- encodeDocument
- decodeDocument
- IEncryptionResults
- encryptString
- decryptString
ENCRYPTION_PARAMETERS
Default options from responses here https://crypto.stackexchange.com/questions/26783/ciphertext-and-tag-size-and-iv-transmission-with-aes-in-gcm-mode/26787
algorithm
keyLength
ivLength
tagLength
version
generateEncryptionKey
Generates a random key represented as a hexadecimal string
Parameters
keyLengthInBits
number Key length (optional, defaultENCRYPTION_PARAMETERS.keyLength
)
encodeDocument
Parameters
document
string
decodeDocument
Parameters
encoded
string
IEncryptionResults
encryptString
Encrypts a given string with symmetric AES
Parameters
Returns IEncryptionResults cipherText cipher text in base64
Returns any iv iv in base64
Returns any tag authenticated encryption tag in base64
Returns any key encryption key in hexadecimal
Returns any type The encryption algorithm identifier
decryptString
Decrypts a given ciphertext along with its associated variables
Parameters
$0
IEncryptionResults$0.cipherText
$0.tag
$0.iv
$0.key
$0.type
cipherText
string cipher text base64 encodedtag
string aes authentication tag base64 encodediv
string iv base64 encodedkey
string decryption key hexademical encodedtype
string encryption algorithm identifier
Returns string