Closed YuryStrozhevsky closed 6 years ago
Sounds like there is no importKey() implemented, @microshine please resolve ASAP.
@YuryStrozhevsky Could you provide more detail?
This code works
//@ts-check
var alg = {
name: "AES-ECB",
length: 256,
};
var format = "raw";
crypto.subtle.generateKey(alg, true, ["encrypt", "decrypt"])
.then((key) => {
console.log(key.key);
return crypto.subtle.exportKey(format, key)
})
.then((raw) => {
return crypto.subtle.importKey(format, raw, alg, true, ["encrypt", "decrypt"]);
})
.then((key) => {
console.log(key.key);
});
@microshine This code does not work:
crypto.importKey("raw",key, { name: "AES-ECB" }, false, ["decrypt"])
Saying
WebCrypto: native 'importKey' for AES-ECB doesn't work. Algorithm: Unrecognized name
I tried
crypto.subtle.importKey("raw",key, { name: "AES-ECB" }, false, ["decrypt"])
crypto.subtle.importKey("raw",key, "AES-ECB", false, ["decrypt"])
crypto.subtle.importKey("raw",key, "aes-ecb", false, ["decrypt"])
@microshine I did not understand your last comment: it is confirming my problem or your are saying I done something wrong?
@YuryStrozhevsky I don't have error on crypto.subtle.importKey
. Send me all incoming params to reproduce this error
@microshine Hmm, I can see on your screenshot exactly the same message:
WebCrypto: native 'importKey' for AES-ECB doesn't work. Algorithm: Unrecognized name
This is warning for native crypto usage
@microshine So how to fix it?
Do you want to remove this log?
@microshine So this is not an error but warning? And the key imported successfully?
yes
@microshine OK, then I close this issue. Instead I need a solution for this issue: before I thought my code is not working because of import but seems it is because of "padding issue".
@YuryStrozhevsky can you provide more detail?
@microshine please investigate