2023-12-04 18:50:05 +00:00
|
|
|
"""Implementation of the TP-Link AES transport.
|
|
|
|
|
|
|
|
Based on the work of https://github.com/petretiandrea/plugp100
|
|
|
|
under compatible GNU GPL3 license.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import base64
|
|
|
|
import hashlib
|
|
|
|
import logging
|
|
|
|
import time
|
2024-01-23 15:29:27 +00:00
|
|
|
from typing import TYPE_CHECKING, AsyncGenerator, Dict, Optional, cast
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
from cryptography.hazmat.primitives import padding, serialization
|
|
|
|
from cryptography.hazmat.primitives.asymmetric import padding as asymmetric_padding
|
|
|
|
from cryptography.hazmat.primitives.asymmetric import rsa
|
|
|
|
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|
|
|
|
2024-01-03 21:46:08 +00:00
|
|
|
from .credentials import Credentials
|
2023-12-29 19:17:15 +00:00
|
|
|
from .deviceconfig import DeviceConfig
|
2023-12-10 15:41:53 +00:00
|
|
|
from .exceptions import (
|
|
|
|
SMART_AUTHENTICATION_ERRORS,
|
|
|
|
SMART_RETRYABLE_ERRORS,
|
|
|
|
SMART_TIMEOUT_ERRORS,
|
|
|
|
AuthenticationException,
|
|
|
|
RetryableException,
|
|
|
|
SmartDeviceException,
|
|
|
|
SmartErrorCode,
|
|
|
|
TimeoutException,
|
|
|
|
)
|
2024-01-18 09:57:33 +00:00
|
|
|
from .httpclient import HttpClient
|
2023-12-04 18:50:05 +00:00
|
|
|
from .json import dumps as json_dumps
|
|
|
|
from .json import loads as json_loads
|
2024-01-23 14:44:32 +00:00
|
|
|
from .protocol import DEFAULT_CREDENTIALS, BaseTransport, get_default_credentials
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def _sha1(payload: bytes) -> str:
|
|
|
|
sha1_algo = hashlib.sha1() # noqa: S324
|
|
|
|
sha1_algo.update(payload)
|
|
|
|
return sha1_algo.hexdigest()
|
|
|
|
|
|
|
|
|
|
|
|
class AesTransport(BaseTransport):
|
|
|
|
"""Implementation of the AES encryption protocol.
|
|
|
|
|
|
|
|
AES is the name used in device discovery for TP-Link's TAPO encryption
|
|
|
|
protocol, sometimes used by newer firmware versions on kasa devices.
|
|
|
|
"""
|
|
|
|
|
2023-12-29 19:17:15 +00:00
|
|
|
DEFAULT_PORT: int = 80
|
2023-12-04 18:50:05 +00:00
|
|
|
SESSION_COOKIE_NAME = "TP_SESSIONID"
|
|
|
|
COMMON_HEADERS = {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
"requestByApp": "true",
|
|
|
|
"Accept": "application/json",
|
|
|
|
}
|
2024-01-23 15:29:27 +00:00
|
|
|
CONTENT_LENGTH = "Content-Length"
|
|
|
|
KEY_PAIR_CONTENT_LENGTH = 314
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
*,
|
2023-12-29 19:17:15 +00:00
|
|
|
config: DeviceConfig,
|
2023-12-04 18:50:05 +00:00
|
|
|
) -> None:
|
2023-12-29 19:17:15 +00:00
|
|
|
super().__init__(config=config)
|
|
|
|
|
2024-01-03 21:46:08 +00:00
|
|
|
self._login_version = config.connection_type.login_version
|
2024-01-04 18:17:48 +00:00
|
|
|
if (
|
|
|
|
not self._credentials or self._credentials.username is None
|
|
|
|
) and not self._credentials_hash:
|
2024-01-03 21:46:08 +00:00
|
|
|
self._credentials = Credentials()
|
|
|
|
if self._credentials:
|
2024-01-23 14:44:32 +00:00
|
|
|
self._login_params = self._get_login_params(self._credentials)
|
2024-01-03 21:46:08 +00:00
|
|
|
else:
|
|
|
|
self._login_params = json_loads(
|
|
|
|
base64.b64decode(self._credentials_hash.encode()).decode() # type: ignore[union-attr]
|
|
|
|
)
|
2024-01-23 14:44:32 +00:00
|
|
|
self._default_credentials: Optional[Credentials] = None
|
2024-01-18 09:57:33 +00:00
|
|
|
self._http_client: HttpClient = HttpClient(config)
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
self._handshake_done = False
|
|
|
|
|
|
|
|
self._encryption_session: Optional[AesEncyptionSession] = None
|
|
|
|
self._session_expire_at: Optional[float] = None
|
|
|
|
|
2024-01-18 09:57:33 +00:00
|
|
|
self._session_cookie: Optional[Dict[str, str]] = None
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
self._login_token = None
|
|
|
|
|
2024-01-23 15:29:27 +00:00
|
|
|
self._key_pair: Optional[KeyPair] = None
|
|
|
|
|
2023-12-19 14:11:59 +00:00
|
|
|
_LOGGER.debug("Created AES transport for %s", self._host)
|
2023-12-04 18:50:05 +00:00
|
|
|
|
2023-12-29 19:17:15 +00:00
|
|
|
@property
|
|
|
|
def default_port(self):
|
|
|
|
"""Default port for the transport."""
|
|
|
|
return self.DEFAULT_PORT
|
|
|
|
|
2024-01-03 21:46:08 +00:00
|
|
|
@property
|
|
|
|
def credentials_hash(self) -> str:
|
|
|
|
"""The hashed credentials used by the transport."""
|
|
|
|
return base64.b64encode(json_dumps(self._login_params).encode()).decode()
|
|
|
|
|
2024-01-23 14:44:32 +00:00
|
|
|
def _get_login_params(self, credentials):
|
2024-01-03 21:46:08 +00:00
|
|
|
"""Get the login parameters based on the login_version."""
|
2024-01-23 14:44:32 +00:00
|
|
|
un, pw = self.hash_credentials(self._login_version == 2, credentials)
|
2024-01-03 21:46:08 +00:00
|
|
|
password_field_name = "password2" if self._login_version == 2 else "password"
|
|
|
|
return {password_field_name: pw, "username": un}
|
|
|
|
|
2024-01-23 14:44:32 +00:00
|
|
|
@staticmethod
|
|
|
|
def hash_credentials(login_v2, credentials):
|
2023-12-04 18:50:05 +00:00
|
|
|
"""Hash the credentials."""
|
|
|
|
if login_v2:
|
|
|
|
un = base64.b64encode(
|
2024-01-23 14:44:32 +00:00
|
|
|
_sha1(credentials.username.encode()).encode()
|
2023-12-04 18:50:05 +00:00
|
|
|
).decode()
|
|
|
|
pw = base64.b64encode(
|
2024-01-23 14:44:32 +00:00
|
|
|
_sha1(credentials.password.encode()).encode()
|
2023-12-04 18:50:05 +00:00
|
|
|
).decode()
|
|
|
|
else:
|
|
|
|
un = base64.b64encode(
|
2024-01-23 14:44:32 +00:00
|
|
|
_sha1(credentials.username.encode()).encode()
|
2023-12-04 18:50:05 +00:00
|
|
|
).decode()
|
2024-01-23 14:44:32 +00:00
|
|
|
pw = base64.b64encode(credentials.password.encode()).decode()
|
2023-12-04 18:50:05 +00:00
|
|
|
return un, pw
|
|
|
|
|
2023-12-10 15:41:53 +00:00
|
|
|
def _handle_response_error_code(self, resp_dict: dict, msg: str):
|
2023-12-20 17:08:04 +00:00
|
|
|
error_code = SmartErrorCode(resp_dict.get("error_code")) # type: ignore[arg-type]
|
|
|
|
if error_code == SmartErrorCode.SUCCESS:
|
|
|
|
return
|
|
|
|
msg = f"{msg}: {self._host}: {error_code.name}({error_code.value})"
|
|
|
|
if error_code in SMART_TIMEOUT_ERRORS:
|
2023-12-20 19:16:23 +00:00
|
|
|
raise TimeoutException(msg, error_code=error_code)
|
2023-12-20 17:08:04 +00:00
|
|
|
if error_code in SMART_RETRYABLE_ERRORS:
|
2023-12-20 19:16:23 +00:00
|
|
|
raise RetryableException(msg, error_code=error_code)
|
2023-12-20 17:08:04 +00:00
|
|
|
if error_code in SMART_AUTHENTICATION_ERRORS:
|
|
|
|
self._handshake_done = False
|
|
|
|
self._login_token = None
|
2023-12-20 19:16:23 +00:00
|
|
|
raise AuthenticationException(msg, error_code=error_code)
|
|
|
|
raise SmartDeviceException(msg, error_code=error_code)
|
2023-12-10 15:41:53 +00:00
|
|
|
|
2023-12-04 18:50:05 +00:00
|
|
|
async def send_secure_passthrough(self, request: str):
|
|
|
|
"""Send encrypted message as passthrough."""
|
2023-12-19 14:11:59 +00:00
|
|
|
url = f"http://{self._host}/app"
|
2023-12-04 18:50:05 +00:00
|
|
|
if self._login_token:
|
|
|
|
url += f"?token={self._login_token}"
|
|
|
|
|
|
|
|
encrypted_payload = self._encryption_session.encrypt(request.encode()) # type: ignore
|
|
|
|
passthrough_request = {
|
|
|
|
"method": "securePassthrough",
|
|
|
|
"params": {"request": encrypted_payload.decode()},
|
|
|
|
}
|
2024-01-18 09:57:33 +00:00
|
|
|
status_code, resp_dict = await self._http_client.post(
|
|
|
|
url,
|
|
|
|
json=passthrough_request,
|
|
|
|
headers=self.COMMON_HEADERS,
|
|
|
|
cookies_dict=self._session_cookie,
|
|
|
|
)
|
2023-12-08 14:22:58 +00:00
|
|
|
# _LOGGER.debug(f"secure_passthrough response is {status_code}: {resp_dict}")
|
2023-12-10 15:41:53 +00:00
|
|
|
|
|
|
|
if status_code != 200:
|
|
|
|
raise SmartDeviceException(
|
2023-12-19 14:11:59 +00:00
|
|
|
f"{self._host} responded with an unexpected "
|
2023-12-10 15:41:53 +00:00
|
|
|
+ f"status code {status_code} to passthrough"
|
2023-12-04 18:50:05 +00:00
|
|
|
)
|
2023-12-10 15:41:53 +00:00
|
|
|
|
2024-01-18 09:57:33 +00:00
|
|
|
resp_dict = cast(Dict, resp_dict)
|
2023-12-10 15:41:53 +00:00
|
|
|
self._handle_response_error_code(
|
|
|
|
resp_dict, "Error sending secure_passthrough message"
|
|
|
|
)
|
|
|
|
|
|
|
|
response = self._encryption_session.decrypt( # type: ignore
|
|
|
|
resp_dict["result"]["response"].encode()
|
|
|
|
)
|
|
|
|
resp_dict = json_loads(response)
|
|
|
|
return resp_dict
|
2023-12-04 18:50:05 +00:00
|
|
|
|
2024-01-03 21:46:08 +00:00
|
|
|
async def perform_login(self):
|
2023-12-04 18:50:05 +00:00
|
|
|
"""Login to the device."""
|
2024-01-23 14:44:32 +00:00
|
|
|
try:
|
|
|
|
await self.try_login(self._login_params)
|
2024-01-23 21:51:07 +00:00
|
|
|
except AuthenticationException as aex:
|
|
|
|
try:
|
|
|
|
if aex.error_code != SmartErrorCode.LOGIN_ERROR:
|
|
|
|
raise aex
|
|
|
|
if self._default_credentials is None:
|
|
|
|
self._default_credentials = get_default_credentials(
|
|
|
|
DEFAULT_CREDENTIALS["TAPO"]
|
|
|
|
)
|
|
|
|
await self.perform_handshake()
|
|
|
|
await self.try_login(self._get_login_params(self._default_credentials))
|
|
|
|
_LOGGER.debug(
|
|
|
|
"%s: logged in with default credentials",
|
|
|
|
self._host,
|
2024-01-23 14:44:32 +00:00
|
|
|
)
|
2024-01-23 21:51:07 +00:00
|
|
|
except AuthenticationException:
|
|
|
|
raise
|
|
|
|
except Exception as ex:
|
|
|
|
raise AuthenticationException(
|
|
|
|
"Unable to login and trying default "
|
|
|
|
+ "login raised another exception: %s",
|
|
|
|
ex,
|
|
|
|
) from ex
|
2024-01-23 14:44:32 +00:00
|
|
|
|
|
|
|
async def try_login(self, login_params):
|
|
|
|
"""Try to login with supplied login_params."""
|
2023-12-04 18:50:05 +00:00
|
|
|
self._login_token = None
|
2023-12-19 14:11:59 +00:00
|
|
|
login_request = {
|
|
|
|
"method": "login_device",
|
2024-01-23 14:44:32 +00:00
|
|
|
"params": login_params,
|
2023-12-19 14:11:59 +00:00
|
|
|
"request_time_milis": round(time.time() * 1000),
|
|
|
|
}
|
|
|
|
request = json_dumps(login_request)
|
2023-12-29 19:42:02 +00:00
|
|
|
|
|
|
|
resp_dict = await self.send_secure_passthrough(request)
|
|
|
|
self._handle_response_error_code(resp_dict, "Error logging in")
|
2023-12-04 18:50:05 +00:00
|
|
|
self._login_token = resp_dict["result"]["token"]
|
|
|
|
|
2024-01-23 15:29:27 +00:00
|
|
|
async def _generate_key_pair_payload(self) -> AsyncGenerator:
|
|
|
|
"""Generate the request body and return an ascyn_generator.
|
2023-12-04 18:50:05 +00:00
|
|
|
|
2024-01-23 15:29:27 +00:00
|
|
|
This prevents the key pair being generated unless a connection
|
|
|
|
can be made to the device.
|
|
|
|
"""
|
|
|
|
_LOGGER.debug("Generating keypair")
|
|
|
|
self._key_pair = KeyPair.create_key_pair()
|
2023-12-04 18:50:05 +00:00
|
|
|
pub_key = (
|
|
|
|
"-----BEGIN PUBLIC KEY-----\n"
|
2024-01-23 15:29:27 +00:00
|
|
|
+ self._key_pair.get_public_key() # type: ignore[union-attr]
|
2023-12-04 18:50:05 +00:00
|
|
|
+ "\n-----END PUBLIC KEY-----\n"
|
|
|
|
)
|
|
|
|
handshake_params = {"key": pub_key}
|
|
|
|
_LOGGER.debug(f"Handshake params: {handshake_params}")
|
|
|
|
request_body = {"method": "handshake", "params": handshake_params}
|
|
|
|
_LOGGER.debug(f"Request {request_body}")
|
2024-01-23 15:29:27 +00:00
|
|
|
yield json_dumps(request_body).encode()
|
|
|
|
|
|
|
|
async def perform_handshake(self):
|
|
|
|
"""Perform the handshake."""
|
|
|
|
_LOGGER.debug("Will perform handshaking...")
|
|
|
|
|
|
|
|
self._key_pair = None
|
|
|
|
self._handshake_done = False
|
|
|
|
self._session_expire_at = None
|
|
|
|
self._session_cookie = None
|
2023-12-04 18:50:05 +00:00
|
|
|
|
2024-01-23 15:29:27 +00:00
|
|
|
url = f"http://{self._host}/app"
|
|
|
|
# Device needs the content length or it will response with 500
|
|
|
|
headers = {
|
|
|
|
**self.COMMON_HEADERS,
|
|
|
|
self.CONTENT_LENGTH: str(self.KEY_PAIR_CONTENT_LENGTH),
|
|
|
|
}
|
2024-01-18 09:57:33 +00:00
|
|
|
status_code, resp_dict = await self._http_client.post(
|
|
|
|
url,
|
2024-01-23 15:29:27 +00:00
|
|
|
json=self._generate_key_pair_payload(),
|
|
|
|
headers=headers,
|
2024-01-18 09:57:33 +00:00
|
|
|
cookies_dict=self._session_cookie,
|
|
|
|
)
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
_LOGGER.debug(f"Device responded with: {resp_dict}")
|
|
|
|
|
2023-12-10 15:41:53 +00:00
|
|
|
if status_code != 200:
|
|
|
|
raise SmartDeviceException(
|
2023-12-19 14:11:59 +00:00
|
|
|
f"{self._host} responded with an unexpected "
|
2023-12-10 15:41:53 +00:00
|
|
|
+ f"status code {status_code} to handshake"
|
2023-12-04 18:50:05 +00:00
|
|
|
)
|
|
|
|
|
2023-12-10 15:41:53 +00:00
|
|
|
self._handle_response_error_code(resp_dict, "Unable to complete handshake")
|
|
|
|
|
|
|
|
handshake_key = resp_dict["result"]["key"]
|
|
|
|
|
2024-01-18 09:57:33 +00:00
|
|
|
if (
|
|
|
|
cookie := self._http_client.get_cookie( # type: ignore
|
|
|
|
self.SESSION_COOKIE_NAME
|
|
|
|
)
|
|
|
|
) or (
|
|
|
|
cookie := self._http_client.get_cookie( # type: ignore
|
2023-12-10 15:41:53 +00:00
|
|
|
"SESSIONID"
|
2023-12-04 18:50:05 +00:00
|
|
|
)
|
2024-01-18 09:57:33 +00:00
|
|
|
):
|
|
|
|
self._session_cookie = {self.SESSION_COOKIE_NAME: cookie}
|
2023-12-04 18:50:05 +00:00
|
|
|
|
2023-12-10 15:41:53 +00:00
|
|
|
self._session_expire_at = time.time() + 86400
|
2024-01-23 15:29:27 +00:00
|
|
|
if TYPE_CHECKING:
|
|
|
|
assert self._key_pair is not None # pragma: no cover
|
2023-12-10 15:41:53 +00:00
|
|
|
self._encryption_session = AesEncyptionSession.create_from_keypair(
|
2024-01-23 15:29:27 +00:00
|
|
|
handshake_key, self._key_pair
|
2023-12-10 15:41:53 +00:00
|
|
|
)
|
2023-12-04 18:50:05 +00:00
|
|
|
|
2023-12-10 15:41:53 +00:00
|
|
|
self._handshake_done = True
|
2023-12-04 18:50:05 +00:00
|
|
|
|
2023-12-19 14:11:59 +00:00
|
|
|
_LOGGER.debug("Handshake with %s complete", self._host)
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
def _handshake_session_expired(self):
|
|
|
|
"""Return true if session has expired."""
|
|
|
|
return (
|
|
|
|
self._session_expire_at is None
|
|
|
|
or self._session_expire_at - time.time() <= 0
|
|
|
|
)
|
|
|
|
|
|
|
|
async def send(self, request: str):
|
|
|
|
"""Send the request."""
|
2023-12-19 14:11:59 +00:00
|
|
|
if not self._handshake_done or self._handshake_session_expired():
|
|
|
|
await self.perform_handshake()
|
|
|
|
if not self._login_token:
|
2024-01-23 14:44:32 +00:00
|
|
|
try:
|
|
|
|
await self.perform_login()
|
|
|
|
# After a login failure handshake needs to
|
|
|
|
# be redone or a 9999 error is received.
|
|
|
|
except AuthenticationException as ex:
|
|
|
|
self._handshake_done = False
|
|
|
|
raise ex
|
2023-12-04 18:50:05 +00:00
|
|
|
|
2023-12-10 15:41:53 +00:00
|
|
|
return await self.send_secure_passthrough(request)
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
async def close(self) -> None:
|
2024-01-20 12:35:05 +00:00
|
|
|
"""Mark the handshake and login as not done.
|
|
|
|
|
|
|
|
Since we likely lost the connection.
|
|
|
|
"""
|
2023-12-10 15:41:53 +00:00
|
|
|
self._handshake_done = False
|
|
|
|
self._login_token = None
|
2023-12-04 18:50:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AesEncyptionSession:
|
|
|
|
"""Class for an AES encryption session."""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def create_from_keypair(handshake_key: str, keypair):
|
|
|
|
"""Create the encryption session."""
|
|
|
|
handshake_key_bytes: bytes = base64.b64decode(handshake_key.encode("UTF-8"))
|
|
|
|
private_key_data = base64.b64decode(keypair.get_private_key().encode("UTF-8"))
|
|
|
|
|
|
|
|
private_key = serialization.load_der_private_key(private_key_data, None, None)
|
|
|
|
key_and_iv = private_key.decrypt(
|
|
|
|
handshake_key_bytes, asymmetric_padding.PKCS1v15()
|
|
|
|
)
|
|
|
|
if key_and_iv is None:
|
|
|
|
raise ValueError("Decryption failed!")
|
|
|
|
|
|
|
|
return AesEncyptionSession(key_and_iv[:16], key_and_iv[16:])
|
|
|
|
|
|
|
|
def __init__(self, key, iv):
|
|
|
|
self.cipher = Cipher(algorithms.AES(key), modes.CBC(iv))
|
|
|
|
self.padding_strategy = padding.PKCS7(algorithms.AES.block_size)
|
|
|
|
|
|
|
|
def encrypt(self, data) -> bytes:
|
|
|
|
"""Encrypt the message."""
|
|
|
|
encryptor = self.cipher.encryptor()
|
|
|
|
padder = self.padding_strategy.padder()
|
|
|
|
padded_data = padder.update(data) + padder.finalize()
|
|
|
|
encrypted = encryptor.update(padded_data) + encryptor.finalize()
|
|
|
|
return base64.b64encode(encrypted)
|
|
|
|
|
|
|
|
def decrypt(self, data) -> str:
|
|
|
|
"""Decrypt the message."""
|
|
|
|
decryptor = self.cipher.decryptor()
|
|
|
|
unpadder = self.padding_strategy.unpadder()
|
|
|
|
decrypted = decryptor.update(base64.b64decode(data)) + decryptor.finalize()
|
|
|
|
unpadded_data = unpadder.update(decrypted) + unpadder.finalize()
|
|
|
|
return unpadded_data.decode()
|
|
|
|
|
|
|
|
|
|
|
|
class KeyPair:
|
|
|
|
"""Class for generating key pairs."""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def create_key_pair(key_size: int = 1024):
|
|
|
|
"""Create a key pair."""
|
|
|
|
private_key = rsa.generate_private_key(public_exponent=65537, key_size=key_size)
|
|
|
|
public_key = private_key.public_key()
|
|
|
|
|
|
|
|
private_key_bytes = private_key.private_bytes(
|
|
|
|
encoding=serialization.Encoding.DER,
|
|
|
|
format=serialization.PrivateFormat.PKCS8,
|
|
|
|
encryption_algorithm=serialization.NoEncryption(),
|
|
|
|
)
|
|
|
|
public_key_bytes = public_key.public_bytes(
|
|
|
|
encoding=serialization.Encoding.DER,
|
|
|
|
format=serialization.PublicFormat.SubjectPublicKeyInfo,
|
|
|
|
)
|
|
|
|
|
|
|
|
return KeyPair(
|
|
|
|
private_key=base64.b64encode(private_key_bytes).decode("UTF-8"),
|
|
|
|
public_key=base64.b64encode(public_key_bytes).decode("UTF-8"),
|
|
|
|
)
|
|
|
|
|
|
|
|
def __init__(self, private_key: str, public_key: str):
|
|
|
|
self.private_key = private_key
|
|
|
|
self.public_key = public_key
|
|
|
|
|
|
|
|
def get_private_key(self) -> str:
|
|
|
|
"""Get the private key."""
|
|
|
|
return self.private_key
|
|
|
|
|
|
|
|
def get_public_key(self) -> str:
|
|
|
|
"""Get the public key."""
|
|
|
|
return self.public_key
|