aboutsummaryrefslogtreecommitdiff
path: root/rpkid/tests
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/tests')
-rw-r--r--rpkid/tests/smoketest.py14
-rw-r--r--rpkid/tests/yamlconf.py4
-rw-r--r--rpkid/tests/yamltest.py4
3 files changed, 15 insertions, 7 deletions
diff --git a/rpkid/tests/smoketest.py b/rpkid/tests/smoketest.py
index 7f284550..5512b5bc 100644
--- a/rpkid/tests/smoketest.py
+++ b/rpkid/tests/smoketest.py
@@ -134,6 +134,8 @@ pubd_pubd_cert = None
pubd_last_cms_time = None
+ecdsa_params = None
+
class CantRekeyYAMLLeaf(Exception):
"""
Can't rekey YAML leaf.
@@ -380,12 +382,18 @@ class router_cert(object):
Representation for a router_cert object.
"""
+ _ecparams = None
+
+ @classmethod
+ def ecparams(cls):
+ if cls._ecparams is None:
+ cls._ecparams = rpki.x509.KeyParams.generateEC()
+ return cls._ecparams
+
def __init__(self, asn, router_id):
self.asn = rpki.resource_set.resource_set_as("".join(str(asn).split()))
self.router_id = router_id
-
- rpki.log.warn("Code to generate ECDSA keys not written yet, generating RSA as hack for testing")
- self.keypair = rpki.x509.RSA.generate()
+ self.keypair = rpki.x509.ECDSA.generate(self.ecparams())
self.pkcs10 = rpki.x509.PKCS10.create(
keypair = self.keypair,
cn = "ROUTER-%d" % self.asn[0].min,
diff --git a/rpkid/tests/yamlconf.py b/rpkid/tests/yamlconf.py
index 81698fbf..3c71d3cd 100644
--- a/rpkid/tests/yamlconf.py
+++ b/rpkid/tests/yamlconf.py
@@ -467,7 +467,7 @@ class allocation(object):
root_cert = rpki.x509.X509.self_certify(
keypair = root_key,
- subject_key = root_key.get_RSApublic(),
+ subject_key = root_key.get_public(),
serial = 1,
sia = root_sia,
notAfter = rpki.sundial.now() + rpki.sundial.timedelta(days = 365),
@@ -481,7 +481,7 @@ class allocation(object):
with open(cleanpath(test_dir, "root.tal"), "w") as f:
f.write("rsync://%s/root/root.cer\n\n%s" % (
- self.rsync_server, root_key.get_RSApublic().get_Base64()))
+ self.rsync_server, root_key.get_public().get_Base64()))
def mkdir(self, *path):
path = self.path(*path)
diff --git a/rpkid/tests/yamltest.py b/rpkid/tests/yamltest.py
index 08da81f3..9131a595 100644
--- a/rpkid/tests/yamltest.py
+++ b/rpkid/tests/yamltest.py
@@ -553,7 +553,7 @@ def create_root_certificate(db_root):
root_cert = rpki.x509.X509.self_certify(
keypair = root_key,
- subject_key = root_key.get_RSApublic(),
+ subject_key = root_key.get_public(),
serial = 1,
sia = root_sia,
notAfter = rpki.sundial.now() + rpki.sundial.timedelta(days = 365),
@@ -569,7 +569,7 @@ def create_root_certificate(db_root):
f = open(os.path.join(test_dir, "root.tal"), "w")
f.write("rsync://localhost:%d/root/root.cer\n\n" % db_root.pubd.rsync_port)
- f.write(root_key.get_RSApublic().get_Base64())
+ f.write(root_key.get_public().get_Base64())
f.close()