mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 10:33:33 +00:00
Bug 1768194 - Appease lints.
MANUAL PUSH: Orange fix CLOSED TREE
This commit is contained in:
parent
6afece8ec6
commit
2d642870a6
@ -7,14 +7,21 @@ from pyasn1_modules import pem
|
||||
from pyasn1.type import univ
|
||||
import sys
|
||||
|
||||
|
||||
def public_key_to_string(file, name):
|
||||
out = "static const unsigned char " + name + "[65] = { "
|
||||
with open(file) as f:
|
||||
substrate = pem.readPemFromFile(f, "-----BEGIN PUBLIC KEY-----", "-----END PUBLIC KEY-----")
|
||||
substrate = pem.readPemFromFile(
|
||||
f, "-----BEGIN PUBLIC KEY-----", "-----END PUBLIC KEY-----"
|
||||
)
|
||||
key = decoder.decode(substrate)
|
||||
ident = key[0][0]
|
||||
assert ident[0] == univ.ObjectIdentifier("1.2.840.10045.2.1"), "should be an ECPublicKey"
|
||||
assert ident[1] == univ.ObjectIdentifier("1.2.840.10045.3.1.7"), "should be a EcdsaP256 key"
|
||||
assert ident[0] == univ.ObjectIdentifier(
|
||||
"1.2.840.10045.2.1"
|
||||
), "should be an ECPublicKey"
|
||||
assert ident[1] == univ.ObjectIdentifier(
|
||||
"1.2.840.10045.3.1.7"
|
||||
), "should be a EcdsaP256 key"
|
||||
bits = key[0][1]
|
||||
assert isinstance(bits, univ.BitString), "Should be a bit string"
|
||||
assert len(bits) == 520, "Should be 520 bits (65 bytes)"
|
||||
|
Loading…
Reference in New Issue
Block a user