File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,25 @@ def test_not_enabled():
6868 raise AssertionError (f"An unexpected exception was raised: { ex } " )
6969
7070
71+ def test_python_attributes ():
72+ for alg_name in oqs .get_enabled_kem_mechanisms ():
73+ with oqs .KeyEncapsulation (alg_name ) as kem :
74+ if kem .method_name .decode () != alg_name :
75+ raise AssertionError ("Incorrect oqs.KeyEncapsulation.method_name" )
76+ if kem .alg_version is None :
77+ raise AssertionError ("Undefined oqs.KeyEncapsulation.alg_version" )
78+ if not 1 <= kem .claimed_nist_level <= 5 :
79+ raise AssertionError ("Invalid oqs.KeyEncapsulation.claimed_nist_level" )
80+ if kem .length_public_key == 0 :
81+ raise AssertionError ("Incorrect oqs.KeyEncapsulation.length_public_key" )
82+ if kem .length_secret_key == 0 :
83+ raise AssertionError ("Incorrect oqs.KeyEncapsulation.length_secret_key" )
84+ if kem .length_ciphertext == 0 :
85+ raise AssertionError ("Incorrect oqs.KeyEncapsulation.length_signature" )
86+ if kem .length_shared_secret == 0 :
87+ raise AssertionError ("Incorrect oqs.KeyEncapsulation.length_shared_secret" )
88+
89+
7190if __name__ == "__main__" :
7291 try :
7392 import nose2
Original file line number Diff line number Diff line change @@ -115,6 +115,23 @@ def test_not_enabled():
115115 raise AssertionError (f"An unexpected exception was raised: { ex } " )
116116
117117
118+ def test_python_attributes ():
119+ for alg_name in oqs .get_enabled_sig_mechanisms ():
120+ with oqs .Signature (alg_name ) as sig :
121+ if sig .method_name .decode () != alg_name :
122+ raise AssertionError ("Incorrect oqs.Signature.method_name" )
123+ if sig .alg_version is None :
124+ raise AssertionError ("Undefined oqs.Signature.alg_version" )
125+ if not 1 <= sig .claimed_nist_level <= 5 :
126+ raise AssertionError ("Invalid oqs.Signature.claimed_nist_level" )
127+ if sig .length_public_key == 0 :
128+ raise AssertionError ("Incorrect oqs.Signature.length_public_key" )
129+ if sig .length_secret_key == 0 :
130+ raise AssertionError ("Incorrect oqs.Signature.length_secret_key" )
131+ if sig .length_signature == 0 :
132+ raise AssertionError ("Incorrect oqs.Signature.length_signature" )
133+
134+
118135if __name__ == "__main__" :
119136 try :
120137 import nose2
You can’t perform that action at this time.
0 commit comments