@@ -52,17 +52,36 @@ def test_emit(self):
52
52
"""Basic sanity check on the code emitters."""
53
53
k = ECDSA256P1 .generate ()
54
54
55
+ pubpem = io .StringIO ()
56
+ k .emit_public_pem (pubpem )
57
+ self .assertIn ("BEGIN PUBLIC KEY" , pubpem .getvalue ())
58
+ self .assertIn ("END PUBLIC KEY" , pubpem .getvalue ())
59
+
55
60
ccode = io .StringIO ()
56
61
k .emit_c_public (ccode )
57
62
self .assertIn ("ecdsa_pub_key" , ccode .getvalue ())
58
63
self .assertIn ("ecdsa_pub_key_len" , ccode .getvalue ())
59
64
65
+ hashccode = io .StringIO ()
66
+ k .emit_c_public_hash (hashccode )
67
+ self .assertIn ("ecdsa_pub_key_hash" , hashccode .getvalue ())
68
+ self .assertIn ("ecdsa_pub_key_hash_len" , hashccode .getvalue ())
69
+
60
70
rustcode = io .StringIO ()
61
71
k .emit_rust_public (rustcode )
62
72
self .assertIn ("ECDSA_PUB_KEY" , rustcode .getvalue ())
63
73
74
+ # raw data - bytes
75
+ pubraw = io .BytesIO ()
76
+ k .emit_raw_public (pubraw )
77
+ self .assertTrue (len (pubraw .getvalue ()) > 0 )
78
+
79
+ hashraw = io .BytesIO ()
80
+ k .emit_raw_public_hash (hashraw )
81
+ self .assertTrue (len (hashraw .getvalue ()) > 0 )
82
+
64
83
def test_emit_pub (self ):
65
- """Basic sanity check on the code emitters."""
84
+ """Basic sanity check on the code emitters, from public key ."""
66
85
pubname = self .tname ("public.pem" )
67
86
k = ECDSA256P1 .generate ()
68
87
k .export_public (pubname )
0 commit comments