@@ -664,30 +664,51 @@ def test_export_using_private_wrapkey(self, session):
664664 private_wrapkey .delete ()
665665
666666 def test_get_public_key (self , session ):
667- key = rsa .generate_private_key (
667+ import_key = rsa .generate_private_key (
668+ public_exponent = 0x10001 , key_size = 2048 , backend = default_backend ()
669+ )
670+ export_key = rsa .generate_private_key (
668671 public_exponent = 0x10001 , key_size = 2048 , backend = default_backend ()
669672 )
670673
671- wrapkey = WrapKey .put (
674+ export_wrapkey = PublicWrapKey .put (
675+ session ,
676+ 0 ,
677+ "Test Get Public Key (PublicWrapKey)" ,
678+ 1 ,
679+ CAPABILITY .EXPORT_WRAPPED ,
680+ CAPABILITY .EXPORTABLE_UNDER_WRAP ,
681+ export_key .public_key (),
682+ )
683+ import_wrapkey = WrapKey .put (
672684 session ,
673685 0 ,
674- "Test Get Public Key" ,
686+ "Test Get Public Key (WrapKey) " ,
675687 1 ,
676688 CAPABILITY .EXPORT_WRAPPED ,
677689 ALGORITHM .RSA_2048 ,
678690 CAPABILITY .NONE ,
679- key ,
691+ import_key ,
680692 )
681693
682- pub = wrapkey .get_public_key ()
683- assert pub .public_bytes (
694+ import_pub = import_wrapkey .get_public_key ()
695+ export_pub = export_wrapkey .get_public_key ()
696+ assert import_pub .public_bytes (
684697 encoding = serialization .Encoding .PEM ,
685698 format = serialization .PublicFormat .SubjectPublicKeyInfo ,
686- ) == key .public_key ().public_bytes (
699+ ) == import_key .public_key ().public_bytes (
687700 encoding = serialization .Encoding .PEM ,
688701 format = serialization .PublicFormat .SubjectPublicKeyInfo ,
689702 )
690- wrapkey .delete ()
703+ assert export_pub .public_bytes (
704+ encoding = serialization .Encoding .PEM ,
705+ format = serialization .PublicFormat .SubjectPublicKeyInfo ,
706+ ) == export_key .public_key ().public_bytes (
707+ encoding = serialization .Encoding .PEM ,
708+ format = serialization .PublicFormat .SubjectPublicKeyInfo ,
709+ )
710+ import_wrapkey .delete ()
711+ export_wrapkey .delete ()
691712
692713 def test_export_ed25519 (self , session ):
693714 wrapkey = WrapKey .put (
0 commit comments