aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2017-04-03 17:58:02 -0400
committerRob Austein <sra@hactrn.net>2017-04-03 17:58:02 -0400
commitfaf6905dd3208dc5e479e2a1a2bec624b2420899 (patch)
tree5c8c53f72211398a00ab043b8a37fc81fa8552b6
parent813f1c6988d4f70047486f207fd151f6a5e3bd26 (diff)
Unit tests mostly working with PKCS #8.
A few parsing problems remaining, mostly with objects large enough that PKCS #8 may have pushed them over some buffer size or another. These are all with RSA, where the Python code (PyCrypto) already supported PKCS #8, so most likely it's a problem in the new C code. Python ECDSA PKCS #8 shim code is nasty and could use some cleanup. If practical, we might want to sub-class ecdsa.keys.SigningKey; we might also want to flesh this out into something we can send upstream to the author of the Python ecdsa library.
-rw-r--r--pkcs8.py46
-rw-r--r--unit-tests.py261
2 files changed, 190 insertions, 117 deletions
diff --git a/pkcs8.py b/pkcs8.py
index cbd5c27..cd45ff6 100644
--- a/pkcs8.py
+++ b/pkcs8.py
@@ -24,6 +24,11 @@ from pyasn1.type.constraint import SingleValueConstraint
from pyasn1.codec.der.encoder import encode as DER_Encode
from pyasn1.codec.der.decoder import decode as DER_Decode
+from ecdsa import der as ECDSA_DER
+from ecdsa.util import oid_ecPublicKey, encoded_oid_ecPublicKey
+from ecdsa.keys import SigningKey
+from ecdsa.curves import find_curve
+
class AlgorithmIdentifier(Sequence):
componentType = NamedTypes(
NamedType( "algorithm", ObjectIdentifier()),
@@ -263,6 +268,18 @@ if __name__ == "__main__":
#print; dumpasn1(der_test_keys["ec_pkcs8"])
print; print "Reencoded PKCS #8 {} static data".format("matches" if der == der_test_keys["ec_pkcs8"] else "doesn't match")
+ # Try doing same thing with ecdsa package ASN.1 utilities.
+ sk = SigningKey.from_der(der_test_keys["ec_rfc5915"])
+ vk = ECDSA_DER.encode_bitstring("\x00\x04" + sk.get_verifying_key().to_string())
+ ec = ECDSA_DER.encode_sequence(ECDSA_DER.encode_integer(1),
+ ECDSA_DER.encode_octet_string(sk.to_string()),
+ ECDSA_DER.encode_constructed(1, vk))
+ p8 = ECDSA_DER.encode_sequence(ECDSA_DER.encode_integer(0),
+ ECDSA_DER.encode_sequence(encoded_oid_ecPublicKey,
+ sk.curve.encoded_oid),
+ ECDSA_DER.encode_octet_string(ec))
+ print; print "ECDSA-library PKCS #8 encoding {} pyasn1 PKCS #8 encoding".format("matches" if p8 == der_test_keys["ec_pkcs8"] else "doesn't match")
+
# Generate ECPrivateKey from PKCS #8 and check against static data
ec = ECPrivateKey()
ec["version"] = ec_pkcs8_privateKey["version"]
@@ -275,6 +292,33 @@ if __name__ == "__main__":
print; print "Reencoded PKCS #8 {} static data".format("matches" if der == der_test_keys["ec_rfc5915"] else "doesn't match")
# Paranoia: Make sure we really can load the RFC 5915 we just generated.
- from ecdsa.keys import SigningKey
sk = SigningKey.from_der(der)
print; print "ECDSA Python library parse of reencoded PKCS #8 data: {!r}".format(sk)
+
+ # Same thing with ecdsa package ASN.1 utilities.
+ car, cdr = ECDSA_DER.remove_sequence(der_test_keys["ec_pkcs8"])
+ assert cdr == ""
+ version, cdr = ECDSA_DER.remove_integer(car)
+ assert version == 0
+ car, ec = ECDSA_DER.remove_sequence(cdr)
+ oid, cdr = ECDSA_DER.remove_object(car)
+ assert oid == oid_ecPublicKey
+ oid, cdr = ECDSA_DER.remove_object(cdr)
+ curve = find_curve(oid)
+ assert cdr == ""
+ car, cdr = ECDSA_DER.remove_octet_string(ec)
+ assert cdr == ""
+ car, cdr = ECDSA_DER.remove_sequence(car)
+ assert cdr == ""
+ version, cdr = ECDSA_DER.remove_integer(car)
+ assert version == 1
+ privkey, cdr = ECDSA_DER.remove_octet_string(cdr)
+ tag, car, cdr = ECDSA_DER.remove_constructed(cdr)
+ assert tag == 1
+ assert cdr == ""
+ pubkey, cdr = ECDSA_DER.remove_bitstring(car)
+ assert cdr == ""
+ assert pubkey[:2] == "\x00\x04"
+ sk = SigningKey.from_string(privkey, curve)
+ print; print "ECDSA-library PKCS #8 decoding {} pyasn1 PKCS #8 decoding".format(
+ "matches" if der == sk.to_der() else "doesn't match")
diff --git a/unit-tests.py b/unit-tests.py
index bc7edf7..fbe7e3a 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -57,9 +57,11 @@ except ImportError:
try:
+ from ecdsa import der as ECDSA_DER
from ecdsa.keys import SigningKey as ECDSA_SigningKey, VerifyingKey as ECDSA_VerifyingKey
from ecdsa.ellipticcurve import Point
- from ecdsa.curves import NIST256p, NIST384p, NIST521p
+ from ecdsa.curves import NIST256p, NIST384p, NIST521p, find_curve as ECDSA_find_curve
+ from ecdsa.util import oid_ecPublicKey
if not pycrypto_loaded:
from hashlib import sha256 as SHA256, sha384 as SHA384, sha512 as SHA512
ecdsa_loaded = True
@@ -917,8 +919,8 @@ class PreloadedRSAKey(PreloadedKey):
if pycrypto_loaded:
k1 = RSA.importKey(pem)
k2 = k1.publickey()
- cls(HAL_KEY_TYPE_RSA_PRIVATE, keylen, k1, k1.exportKey("DER"), keylen = keylen)
- cls(HAL_KEY_TYPE_RSA_PUBLIC, keylen, k2, k2.exportKey("DER"), keylen = keylen)
+ cls(HAL_KEY_TYPE_RSA_PRIVATE, keylen, k1, k1.exportKey(format = "DER", pkcs = 8), keylen = keylen)
+ cls(HAL_KEY_TYPE_RSA_PUBLIC, keylen, k2, k2.exportKey(format = "DER" ), keylen = keylen)
def sign(self, text, hash):
return PKCS1_v1_5.PKCS115_SigScheme(self.obj).sign(hash(text))
@@ -928,12 +930,35 @@ class PreloadedRSAKey(PreloadedKey):
class PreloadedECKey(PreloadedKey):
+ @staticmethod
+ def _check(condition):
+ if not condition:
+ raise ECDSA_DER.UnexpectedDER()
+
@classmethod
def importKey(cls, curve, pem):
if ecdsa_loaded:
- k1 = ECDSA_SigningKey.from_pem(pem)
+ der = ECDSA_DER.unpem(pem)
+ car, cdr = ECDSA_DER.remove_sequence(der)
+ cls._check(cdr == "")
+ version, cdr = ECDSA_DER.remove_integer(car)
+ cls._check(version == 0)
+ algid, pkinfo = ECDSA_DER.remove_sequence(cdr)
+ oid, cdr = ECDSA_DER.remove_object(algid)
+ cls._check(oid == oid_ecPublicKey)
+ oid, cdr = ECDSA_DER.remove_object(cdr)
+ sk_curve = ECDSA_find_curve(oid)
+ cls._check(cdr == "")
+ car, cdr = ECDSA_DER.remove_octet_string(pkinfo)
+ cls._check(cdr == "")
+ car, cdr = ECDSA_DER.remove_sequence(car)
+ cls._check(cdr == "")
+ version, cdr = ECDSA_DER.remove_integer(car)
+ cls._check(version == 1)
+ privkey, cdr = ECDSA_DER.remove_octet_string(cdr)
+ k1 = ECDSA_SigningKey.from_string(privkey, sk_curve)
k2 = k1.get_verifying_key()
- cls(HAL_KEY_TYPE_EC_PRIVATE, curve, k1, k1.to_der(), curve = curve)
+ cls(HAL_KEY_TYPE_EC_PRIVATE, curve, k1, der, curve = curve)
cls(HAL_KEY_TYPE_EC_PUBLIC, curve, k2, k2.to_der(), curve = curve)
def sign(self, text, hash):
@@ -945,137 +970,141 @@ class PreloadedECKey(PreloadedKey):
# openssl genrsa 1024
PreloadedRSAKey.importKey(1024, '''\
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQC95QlDOvlQhdCe/a7eIoX9SGPVfXfA8/62ilnF+NcwLrhxkr2R
-4EVQB65+9AbxqM8Hqol6fhZzmDs48cl2tOFGJpE8iMhiFm4i6SGl2RXYaG0xi+lJ
-FrXXCLFQovIEMuukBE129wra1xIB72tYR14lu8REX+Mhpbuz44M1jlCrlQIDAQAB
-AoGAeU928l8bZIiH9PnlG318kYkMVhd4SGjXQK/zl9hXSC2goNV4i1d1kCHIJMwq
-H3mTALe+aeVg3GnU85Tq+g2llzogoyXl8q902KbvImrM/XSbsue9/oj0OSgw+jKB
-faFzX6FxAtNV5pmU9QiwauBIl/3yPCF9ifim5zg+pWCqLaECQQD59Z/R6TrTHxp6
-w2vH4CJyP5KORcf+eMa50SAriMVBXsJzsBiLLVxKIZfWbQn9gytJqJZKmIHezZQm
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EVNrFzGm+rjZoP8ZGndIue2+z+KQJAJKAY4pzWDK/5nQMUrxwG0yajPqZHB8id
+sd7/t213zOKzSVUsnBI+ble/GLSWPKfeH0HBbparoTOfnSP7y7bvCQJBAJwgUTTU
+EMB20Ue1MndpoQz0h0wJitwnQj9jQ1MTYzqWxNKI/JCNzh1BAnEV269YcvHbxvH6
+XsVNq/sVoqe0Img=
+-----END PRIVATE KEY-----
''')
# openssl genrsa 2048
PreloadedRSAKey.importKey(2048, '''\
------BEGIN RSA PRIVATE KEY-----
-MIIEpAIBAAKCAQEAsbvq6syhDXD/OMVAuLoMceGQLUIiezfShVqFfyMqADjqhFRW
-Wbonn0XV9ZkypU4Ib9n6PtLATNaefhpsUlI4s+20YTlQ7GiwJ9p97/N1o1u060ja
-4LdqhfYtn8GZX+JAfa5NqpmLKCJ58XJ3q28MPLRwYp5yKckjkzchZHFyjs1W7r5a
-JfeJ/vsQusX3klmCehJ1jxSHPh8o6lTjFMnBK8t360YTu0UGK/RUcEAYO7l7FWjd
-8PjZfawXIrOAhCLkVvDFfpsl2oyFIL9d1QE87WdyyZXAtWLs62gnX+kiBq9gUhu5
-GsgcQifHBcRiGZfH0TRIMgIsSjsorzHqJ9uoQwIDAQABAoIBAGqzx5/5A8NfEEpT
-2bxNLcV8xqL1LmBNLh0TMEwYn1GM2fZh74lkwf7T3VTaCVbGlzgXZC4tNneq7XIF
-iPyPEi2rSnyH/XZAj2kNukfBIOHW37HVhloco14TYmajwuGWomMRrtz521pYAF+c
-+g042N7k8Qez2hQOBkaOdYSouz7RNdJUGUocRhcSkh+QZTBwtQxrkuhhHN+zkIri
-+Q09hF2hAliHrh6mow8ci0gRsXnZzsdJfTX8CasHWTIll4gfrvWnUY7iYqB6ynRU
-YN+7IgQXMUFLziIlH1qN+DlEYdznsgAPSS3JdTWh0cvjiO8wTFAnOIdsj+BpKoDB
-PK2zzDkCgYEA3TP8h4Ds/y1tDijE3Sarrg0vWuY97sJmAla4qFHH4hscZ84NDzTM
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5gfeXKqyIGsXrEzqDqT07OHbj/OE7ek9V/KaZS1f87b
+ScvHOLm/gf11/BQvFWJrfe6mzG85pRiI2VcrknrjWAZuYT3dQ3tfgeGGFNK2seeQ
+SlqUMQBIo48pIJDcz9T2m1hShVRG7IYNiQHCRw6XQcu11wHAs3n2VaSvtfnX181E
+RQKCAQEAyTf2T6yEPYNby5sT8uCh+ivB9PbnnwU/Gln6kbAwcvdmcu5C6JE7I/JB
+mP9maYsBrZM+vBL+yyWfjpjYp6x6NYr/QerxJoUuE6NpwXy7kg44oFm/H4c5Ppy1
+E0FXLO30DzC7QMTqfNzkdCmb1Mxes4u5nQu7bbIWKTCgiBilTqEF1uDWaeKtlL9n
+KolX2BYHpljJQBQZ2AGovp65IACoGn3erPyxAt6ypO59PWZVl3+d0vK+MMmM0pQT
+TDWD/XE22Do3loz7ulz8PAT+z4S0LFz/znx1BgsEcg9zDp7QV0vedOzjgGkCpwrb
+w3l5Zt78ppncQDSUdGbI5D75aBTqOg==
+-----END PRIVATE KEY-----
''')
# openssl ecparam -genkey -name prime256v1 | openssl ec
PreloadedECKey.importKey(HAL_CURVE_P256, '''\
------BEGIN EC PRIVATE KEY-----
-MHcCAQEEIPBrVhD1iFF2e8wPkPf4N1038iR8xPgku/CVOT8lcSztoAoGCCqGSM49
-AwEHoUQDQgAE3mB5BmN5Fa4fV74LsDWIpBUxktPqYGJ6WOBrjPs1HWkNU7JHO3qY
-9yy+CXFSPb89GWQgb5wLtNPn4QYMj+KRTA==
------END EC PRIVATE KEY-----
+-----BEGIN PRIVATE KEY-----
+MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg8GtWEPWIUXZ7zA+Q
+9/g3XTfyJHzE+CS78JU5PyVxLO2hRANCAATeYHkGY3kVrh9XvguwNYikFTGS0+pg
+YnpY4GuM+zUdaQ1Tskc7epj3LL4JcVI9vz0ZZCBvnAu00+fhBgyP4pFM
+-----END PRIVATE KEY-----
''')
# openssl ecparam -genkey -name secp384r1 | openssl ec
PreloadedECKey.importKey(HAL_CURVE_P384, '''\
------BEGIN EC PRIVATE KEY-----
-MIGkAgEBBDCVGo35Hbrf3Iys7mWRIm5yjg+6vPIgzbp2jCbDyszBo+wTxmQambG4
-g8yocp4wM6+gBwYFK4EEACKhZANiAATYwa+M8T8jsNHKmMZTvPPflUIfrjuZZo1D
-3kkkmN4r6cTNctjaeRdAfD0X40l4yPnGIP9ParuKVVl1y0TdQ7BS3g/Gj/LP33HD
-ESP8gFDIKFCWSDX0uhmy+HsGsPwgNoY=
------END EC PRIVATE KEY-----
+-----BEGIN PRIVATE KEY-----
+MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDCVGo35Hbrf3Iys7mWR
+Im5yjg+6vPIgzbp2jCbDyszBo+wTxmQambG4g8yocp4wM6+hZANiAATYwa+M8T8j
+sNHKmMZTvPPflUIfrjuZZo1D3kkkmN4r6cTNctjaeRdAfD0X40l4yPnGIP9ParuK
+VVl1y0TdQ7BS3g/Gj/LP33HDESP8gFDIKFCWSDX0uhmy+HsGsPwgNoY=
+-----END PRIVATE KEY-----
''')
# openssl ecparam -genkey -name secp521r1 | openssl ec
PreloadedECKey.importKey(HAL_CURVE_P521, '''\
------BEGIN EC PRIVATE KEY-----
-MIHcAgEBBEIBtf+LKhJNQEJRFQ2cGQPcviwfp9IKSnD5EFTqAPtv7/+t2FtmdHHP
-/fWIlZ7jcC5N9dWy6bKGu3+FqwgZAYLpsqigBwYFK4EEACOhgYkDgYYABADdfcUe
-P0oAZQ5308v5ijcg4hePvhvVi+QKcrwmE9kirXCFoYN1tzPmXZmw8lNJenrbwaNz
-opJR84LBHnomGPogAQGF0aRk0jE8w1j1oMfrrzV6vCWnkh7pyzsDnrLU1HrkWeqw
-ihzwMzYJgFzToDH+fCh7nrBFZZZ9P9gPYMlSM5UMeA==
------END EC PRIVATE KEY-----
+-----BEGIN PRIVATE KEY-----
+MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIBtf+LKhJNQEJRFQ2c
+GQPcviwfp9IKSnD5EFTqAPtv7/+t2FtmdHHP/fWIlZ7jcC5N9dWy6bKGu3+FqwgZ
+AYLpsqihgYkDgYYABADdfcUeP0oAZQ5308v5ijcg4hePvhvVi+QKcrwmE9kirXCF
+oYN1tzPmXZmw8lNJenrbwaNzopJR84LBHnomGPogAQGF0aRk0jE8w1j1oMfrrzV6
+vCWnkh7pyzsDnrLU1HrkWeqwihzwMzYJgFzToDH+fCh7nrBFZZZ9P9gPYMlSM5UM
+eA==
+-----END PRIVATE KEY-----
''')