-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsupported signature algorithm: <blank> #160
Comments
@apowers313 My code bellow work fine with all your data. Check your code for internal mistakes with decoding. require("babel-polyfill");
var asn1js = require("asn1js");
var pkijs = require("pkijs");
const WebCrypto = require("node-webcrypto-ossl");
const webcrypto = new WebCrypto();
const CryptoEngine = pkijs.CryptoEngine;
const Certificate = pkijs.Certificate;
pkijs.setEngine("newEngine", webcrypto, new CryptoEngine({ name: "", crypto: webcrypto, subtle: webcrypto.subtle }));
async function main()
{
const cert1Base64 = "MIICRDCCAS6gAwIBAgIEVWK+oDALBgkqhkiG9w0BAQswLjEsMCoGA1UEAxMjWXViaWNvIFUyRiBSb290IENBIFNlcmlhbCA0NTcyMDA2MzEwIBcNMTQwODAxMDAwMDAwWhgPMjA1MDA5MDQwMDAwMDBaMCoxKDAmBgNVBAMMH1l1YmljbyBVMkYgRUUgU2VyaWFsIDE0MzI1MzQ2ODgwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARLMx93PYFEuZlcvkWFUX4XWDqkdiNpXL6FrEgsgBnyyblGeuBFsOZvExsuoyQ8kf2mAuMY8/xdjSp6uucr0UMJozswOTAiBgkrBgEEAYLECgIEFTEuMy42LjEuNC4xLjQxNDgyLjEuNTATBgsrBgEEAYLlHAIBAQQEAwIFIDALBgkqhkiG9w0BAQsDggEBAKwW2bNutrOpt211lLNPWfT3PtvJ/espNetrRRyr9B0l0+cWFNdHJgTKcqV44yPtt2AEaF8F59G5vgXbbpRA+sXPyTKmyvroUpl3LtsCeCAgPNQUHT7rb2os6Z45V4AyY6urjW7EgKffCErSy6e31td8lMPrwLFm+WBXyvX+OmMeompDN2Kjb77PTPRFCWJf1a8QSap8i8dommZZ6a9d6PDXLCiCUXTFDgarf2oHkIN7bbMqv9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Yzd3qGtKbw7xaF1UsG/5xUb/Btwb2X2g4InpiB/yt/3CpQXpiWX/K4mBvUKiGn05ZsqeY1gx4g0xLBqcU9psmyPzK+Vsgw2jeRQ5JlKDyqE0hebfC1tvFu0CCrJFcw==";
let asn1 = asn1js.fromBER((Buffer.from(cert1Base64, "base64")).buffer);
if(asn1.offset === (-1))
{
console.log("Error parsing ASN.1");
return;
}
const certificate1 = new Certificate({ schema: asn1.result });
const publicKey1 = await certificate1.getPublicKey();
asn1 = asn1js.fromBER((Buffer.from(cert2Base64, "base64")).buffer);
if(asn1.offset === (-1))
{
console.log("Error parsing ASN.1");
return;
}
const certificate2 = new Certificate({ schema: asn1.result });
const publicKey2 = await certificate2.getPublicKey();
}
main(); |
That did the trick, thanks! |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to validate U2F attestations using this code:
https://gist.github.com/apowers313/84202dc09e57bfc690b2dddbcf95a1c2
When trying to retrieve the public key from the root cert, pkijs throws:
Unsupported signature algorithm:
. (To be clear, no algorithm is mentioned in the error message.)It looks to me like the root cert contains a valid RSA public key. Any idea what would be tripping up pkijs?
The text was updated successfully, but these errors were encountered: