chiark / gitweb /
pubkey.c, catacomb/__init__.py: Add bindings for Hamburg's X448.
[catacomb-python] / catacomb / __init__.py
index 9522528ae6b1b930c53a8ec6e02ac6dffba96a28..4c225e7ab2645f52b79d8b657c1b39d84e33f370 100644 (file)
@@ -459,11 +459,15 @@ class _tmp:
 _augment(RSAPriv, _tmp)
 
 ###--------------------------------------------------------------------------
-### Bernstein's elliptic curve crypto.
+### Bernstein's elliptic curve crypto and related schemes.
 
 X25519_BASE = \
   bytes('0900000000000000000000000000000000000000000000000000000000000000')
 
+X448_BASE = \
+  bytes('05000000000000000000000000000000000000000000000000000000'
+        '00000000000000000000000000000000000000000000000000000000')
+
 Z128 = bytes('00000000000000000000000000000000')
 
 class _BoxyPub (object):
@@ -495,6 +499,15 @@ class X25519Priv (_BoxyPriv, X25519Pub):
   def _op(me, k, X): return x25519(k, X)
   def _hashkey(me, z): return hsalsa20_prf(z, Z128)
 
+class X448Pub (_BoxyPub):
+  _PUBSZ = X448_PUBSZ
+  _BASE = X448_BASE
+
+class X448Priv (_BoxyPriv, X448Pub):
+  _KEYSZ = X448_KEYSZ
+  def _op(me, k, X): return x448(k, X)
+  ##def _hashkey(me, z): return ???
+
 class Ed25519Pub (object):
   def __init__(me, pub):
     me.pub = pub