INNER CODE UNIT · TypeScript

keyData

StableLib/stablelib · packages/aes-kw/aes-kw.ts:115

        const keyData = new Uint8Array(8 * N);
        const encryptedKeyData = new Uint8Array(wrappedKey);

        for (let j = 5; j >= 0; j--) {
            for (let i = N; i >= 1; i--) {
                writeUint64BE(i + j * N, tmp);
                xor(A, tmp);
                this._inputBuffer.set(A);
                this._inputBuffer.set(encryptedKeyData.subarray((i) * 8, (i + 1) * 8), 8);
                this._cipher.decryptBlock(this._inputBuffer, this._outputBuffer);
                A.set(this._outputBuffer.subarray(0, 8));
                encryptedKeyData.set(this._outputBuffer.subarray(8, 16), i * 8);
            }
        }

        // Integrity check, the A component of the un-wrapped key buffer should
        // equal the default initial value.
        if (compare(A, this._iv) == 0) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…