File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,3 +62,23 @@ async def get_private_key(
6262 def has_private_key (self ) -> bool :
6363 """Check if the private key has been set."""
6464 return self .private_key is not None
65+
66+ @property
67+ def public_pem (self ) -> str :
68+ """Get the public key in PEM format."""
69+ if self .private_key is None :
70+ raise ValueError ("Private key is not set" )
71+ return self .private_key .public_key ().public_bytes (
72+ encoding = serialization .Encoding .PEM ,
73+ format = serialization .PublicFormat .SubjectPublicKeyInfo ,
74+ ).decode ('utf-8' )
75+
76+ @property
77+ def public_uncompressed_point (self ) -> str :
78+ """Get the public key in uncompressed point format."""
79+ if self .private_key is None :
80+ raise ValueError ("Private key is not set" )
81+ return self .private_key .public_key ().public_bytes (
82+ encoding = serialization .Encoding .X962 ,
83+ format = serialization .PublicFormat .UncompressedPoint ,
84+ ).hex ()
You can’t perform that action at this time.
0 commit comments