Fix CDS fetches; use proper hashing mechanism
This commit is contained in:
parent
e4db9358cf
commit
a1c534ec0c
3 changed files with 22 additions and 7 deletions
|
@ -8,6 +8,7 @@ import {
|
|||
CipherType,
|
||||
encrypt,
|
||||
decrypt,
|
||||
HashType,
|
||||
hash,
|
||||
sign,
|
||||
} from './util/synchronousCrypto';
|
||||
|
@ -470,8 +471,8 @@ export async function decryptAesGcm(
|
|||
|
||||
// Hashing
|
||||
|
||||
export async function sha256(data: ArrayBuffer): Promise<ArrayBuffer> {
|
||||
return hash(data);
|
||||
export function sha256(data: ArrayBuffer): ArrayBuffer {
|
||||
return hash(HashType.size256, data);
|
||||
}
|
||||
|
||||
// Utility
|
||||
|
@ -628,7 +629,7 @@ export async function encryptCdsDiscoveryRequest(
|
|||
});
|
||||
const queryDataPlaintext = concatenateBytes(nonce, numbersArray.buffer);
|
||||
const queryDataKey = getRandomBytes(32);
|
||||
const commitment = await sha256(queryDataPlaintext);
|
||||
const commitment = sha256(queryDataPlaintext);
|
||||
const iv = getRandomBytes(12);
|
||||
const queryDataCiphertext = await encryptAesGcm(
|
||||
queryDataKey,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue