I obtain an Internet Identity key as follows:
const pubkey = authClient.getIdentity().getPublicKey();
const der = Buffer.from(pubkey.toDer())
...
const response = await axios.post(`${SCORER_BACKEND}account/verify/ic`, {
pubkey: Buffer.from(der).toString("hex"),
// ...
});
Then, I pass the key hex-encoded to a Python endpoint:
public_key = bytes.fromhex(payload.pubkey)
key = ecdsa.VerifyingKey.from_der(public_key, hashfunc=hashlib.sha256)
Python says:
ecdsa.der.UnexpectedDER: Unexpected object identifier in DER encoding: (1, 3, 6, 1, 4, 1, 56387, 1, 2)
What is my error?
A side note: Bard claims that the key is in RSA format. I wonder: Shouldn’t it be in ECDSA format? Maybe Bard hallutinated?