You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
734 B
27 lines
734 B
from enum import Enum, auto
|
|
|
|
from tool.DownloadPathTool import get_config_path
|
|
|
|
port = 8426
|
|
configPath = get_config_path()
|
|
priKeySavePath = f"{configPath}/private.pem"
|
|
pubKeySavePath = f"{configPath}/public.pem"
|
|
|
|
class EncryptType(Enum):
|
|
AES_ECB = auto()
|
|
AES_CBC = auto()
|
|
SM4_ECB = auto()
|
|
SM4_CBC = auto()
|
|
|
|
# 函数:通过文本获取枚举成员
|
|
def getEncryptType(text):
|
|
try:
|
|
return EncryptType[text]
|
|
except KeyError:
|
|
raise ValueError(f"Invalid EncryptType name: {text}")
|
|
|
|
# 函数:通过枚举成员获取文本
|
|
def getEncryptTypeName(encryptType):
|
|
if not isinstance(encryptType, EncryptType):
|
|
raise TypeError("Expected a EncryptType enum member")
|
|
return encryptType.name |