@@ -46,11 +46,11 @@ def test_import_pem_key(self):
4646 private_key : OKPKey = OKPKey .import_key (private_pem )
4747 public_key : OKPKey = OKPKey .import_key (public_pem )
4848
49- self .assertEqual (private_key .as_pem (), private_pem )
49+ self .assertEqual (private_key .as_pem (private = True ), private_pem )
5050 self .assertEqual (private_key .as_pem (private = False ), public_pem )
5151 self .assertEqual (public_key .as_pem (), public_pem )
5252
53- self .assertIn ("d" , private_key .as_dict ())
53+ self .assertIn ("d" , private_key .as_dict (private = True ))
5454 self .assertNotIn ("d" , public_key .as_dict ())
5555
5656 def test_import_invalid_pem_key (self ):
@@ -88,15 +88,15 @@ def test_all_as_methods(self):
8888 key : OKPKey = OKPKey .import_key (private_json )
8989
9090 # as_dict
91- data = key .as_dict ()
91+ data = key .as_dict (private = True )
9292 self .assertIn ("d" , data )
9393 self .assertEqual (data , private_json )
9494 data = key .as_dict (private = False )
9595 self .assertNotIn ("d" , data )
9696 self .assertEqual (data , public_json )
9797
9898 # as_pem
99- data = key .as_pem ()
99+ data = key .as_pem (private = True )
100100 self .assertIn (b"PRIVATE" , data )
101101 data = key .as_pem (private = False )
102102 self .assertIn (b"PUBLIC" , data )
@@ -107,14 +107,14 @@ def test_all_as_methods(self):
107107
108108 def test_output_with_password (self ):
109109 key = OKPKey .import_key (read_key ("okp-ed25519-private.json" ))
110- pem = key .as_pem (password = "secret" )
110+ pem = key .as_pem (private = True , password = "secret" )
111111 self .assertRaises (TypeError , OKPKey .import_key , pem )
112112 key2 = OKPKey .import_key (pem , password = "secret" )
113113 self .assertEqual (key .as_pem (), key2 .as_pem ())
114114
115115 def test_key_eq (self ):
116116 key1 = OKPKey .generate_key ()
117- key2 = OKPKey .import_key (key1 .as_dict ())
117+ key2 = OKPKey .import_key (key1 .as_dict (private = True ))
118118 self .assertIsNot (key1 , key2 )
119119 self .assertEqual (key1 , key2 )
120120 key3 = OKPKey .generate_key ()
0 commit comments