3

Windows 10에서 IE 11을 사용하여 AES-GCM으로 일부 데이터를 암호화 할 수는 있지만 해독 기능을 사용할 수 없습니다. 예 암호화 JS 번호 :IE 11의 결과에서 데이터를 해독하는 방법 AES-GCM을 사용하여 암호화 작업

let plainText = new Uint8Array([1]); 
let key; 
let keyBuf = window.msCrypto.getRandomValues(new Uint8Array(32)); 
let iv = window.msCrypto.getRandomValues(new Uint8Array(12)); 
let additionalData = window.msCrypto.getRandomValues(new Uint8Array(16)); 
let encResult; 
let importOp = window.msCrypto.subtle.importKey('raw', 
    keyBuf, 
    { name: 'AES-GCM' }, 
    false, 
    ['encrypt', 'decrypt']); 
importOp.oncomplete = function(e) { 
    key = e.target.result; 
    let encryptOp = window.msCrypto.subtle.encrypt({ 
     name: 'AES-GCM', 
     iv: iv, 
     tagLength: 128, 
     additionalData: additionalData 
    }, key, plainText); 
    encryptOp.oncomplete = function (e) { 
     encResult = e.target.result; 
    }; 
}; 

결과 항목 (encResult)는 암호화 된 값이 다른 속성 태그를 갖는 AesGcmEncryptResult이다. 내가 알고있는 것처럼, 나는이을 연결하고 같이 해독하는 암호 텍스트로 전달해야합니다

let cipherText = new Uint8Array(plainText.length + 16); // tagLength/8 
cipherText.set(new Uint8Array(encResult.ciphertext), 0); 
cipherText.set(new Uint8Array(encResult.tag), plainText.length); 
let decryptOp = window.msCrypto.subtle.decrypt({ 
    name: 'AES-GCM', 
    iv: iv, 
    tagLength: 128, 
    additionalData: additionalData 
}, key, cipherText); 

그때의 onComplete와의 OnError 및 화재의 OnError 묶을. 불행히도 IE의 Event 객체는 type = "error"이외에는 아무 것도 말해주지 않습니다.

다른 브라우저를 사용하여 말하지 마십시오 IE 11에서 AES-GCM을 사용하는 방법에 대한 웹에 거의 정보가 있습니다. 이 모든 기능은 Chrome 및 Firefox와 잘 작동합니다 (그러나 다르게). 나는 이것을 IE 11에서 작동 시키도록 특별히 노력하고있다.

내가 무엇이 누락 되었습니까?

답변

3

나는이 (막연하게) 태그 값이 알고리즘 객체에 들어가고 암호 텍스트가 제 3 인수에 들어가는 것을 보여줍니다. 예 :

let decryptOp = window.msCrypto.subtle.decrypt({ 
    name: 'AES-GCM', 
    iv: iv, 
    additionalData: additionalData, 
    tag: new Uint8Array(encResult.tag) 
    }, key, new Uint8Array(encResult.ciphertext)); 

왜 이렇게 찾기가 어려웠습니까? 이 기능에 대한 블로그 게시물이없는 이유는 무엇입니까? 왜 MS의 문서는 세부 사항에 너무 짧습니까?