How to use the @aws-crypto/serialize.uInt32BE function in @aws-crypto/serialize

To help you get started, we’ve selected a few @aws-crypto/serialize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-encryption-sdk-javascript / modules / raw-keyring / src / raw_aes_encrypted_data_keys.ts View on Github external
function rawAesEncryptedDataKey (
    keyNamespace: string,
    keyName: string,
    iv: Uint8Array,
    ciphertext: Uint8Array,
    authTag: Uint8Array
  ): EncryptedDataKey {
    const ivLength = iv.byteLength
    const authTagBitLength = authTag.byteLength * 8
    const encryptedDataKey = concatBuffers(ciphertext, authTag)
    const providerId = keyNamespace
    const rawInfo = concatBuffers(fromUtf8(keyName), uInt32BE(authTagBitLength), uInt32BE(ivLength), iv)
    const providerInfo = toUtf8(rawInfo)
    return new EncryptedDataKey({ encryptedDataKey, providerId, providerInfo, rawInfo })
  }
}