@aws-crypto/kdf-ctr-mode-node
v4.1.0
Published
nodejs kdf ctr mode crypto primitive
Downloads
725,068
Readme
@aws-crypto/kdf-ctr-mode-node
This module exports a Key Derivation Function in Counter Mode with a Pseudo Random function with HMAC SHA 256 for Node.js.
This module is used in the the AWS Encryption SDK for JavaScript to provide key derivation for specific algorithm suites.
Specification: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-108r1.pdf
install
npm install @aws-crypto/kdf-ctr-mode-nodeuse
const digestAlgorithm = 'sha256'
const initialKeyMaterial = gottenFromSomewhereSecure()
const nonce = freshRandomData()
const purpose = Buffer.from('What this derived key is for.', 'utf-8')
const expectedLength = 32
const KDF = require('@aws-crypto/kdf-ctr-mode-node')
const derivedKey = KDF.kdfCounterMode({
digestAlgorithm,
ikm: initialKeyMaterial,
nonce,
purpose,
expectedLength,
})test
npm testlicense
This SDK is distributed under the Apache License, Version 2.0, see LICENSE.txt and NOTICE.txt for more information.
