我正在试着用SubtleCrypto.unwrapkey解开一个钥匙...我的解包算法是:
{name: 'RSA-OAEP', hash: Object{name: 'SHA-1'}, modulusLength: 2048, publicExponent: Uint8Array{0: 1, 1: 0, 2: 1}而我的unwrappedKeyAlgo是:
{ name: 'AES-CBC', altName: 'aes256-CBC',length: 256, usages: pri: ['decrypt', 'unwrapKey'], pub: ['encrypt', 'wrapKey'] }}我的呼叫如下所示:
return webcrypto.subtle.unwrapKey(
'raw',
// wrappedKey
encSymmKey,
// unwrappingKey
keyPair.private,
// unwrapAlgo
keyAlg,
// unwrappedKeyAlgo
symmAlg,
// extractable
true,
['encrypt', 'decrypt']
)我已经尝试了一些不同的方法,但都无济于事,虽然一天中的大部分时间我都得到了一个没有任何消息的OperationError (即error.message是''),但在接近尾声时,我开始得到:
0, 'OperationError', '192-bit AES keys are not supported'即使我看不到192位的钥匙。
有没有人有任何关于如何调试/排除无消息OperationError和/或后者的提示?对于类似主题的问题,什么是首选位置(除了堆栈溢出)?
发布于 2015-11-22 00:17:34
IE11 (根据您的错误判断)在这一点上是错误的。这必须作为一个两步过程来完成,首先解密:
msCrypto.subtle.decrypt(keyAlg, keyPair.private, encSymmKey)然后导入结果'k':
msCrypto.subtle.importKey('raw', k, symmAlg, true, ['encrypt', 'decrypt'])希望这能为您省去一些麻烦;-)
https://stackoverflow.com/questions/32181118
复制相似问题