mirror of https://github.com/jumpserver/jumpserver
perf: 修改rsa key 默认长度
parent
c1185e989a
commit
73b0b23910
|
@ -1,8 +1,8 @@
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from hashlib import md5
|
|
||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
@ -146,7 +146,7 @@ class BasePlaybookManager:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generate_private_key_path(secret, path_dir):
|
def generate_private_key_path(secret, path_dir):
|
||||||
key_name = '.' + md5(secret.encode('utf-8')).hexdigest()
|
key_name = '.' + hashlib.md5(secret.encode('utf-8')).hexdigest()
|
||||||
key_path = os.path.join(path_dir, key_name)
|
key_path = os.path.join(path_dir, key_name)
|
||||||
|
|
||||||
if not os.path.exists(key_path):
|
if not os.path.exists(key_path):
|
||||||
|
|
|
@ -2,15 +2,14 @@ import base64
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from Cryptodome.Cipher import AES, PKCS1_v1_5
|
|
||||||
from Cryptodome.Random import get_random_bytes
|
|
||||||
from Cryptodome.PublicKey import RSA
|
|
||||||
from Cryptodome.Util.Padding import pad
|
|
||||||
from Cryptodome import Random
|
from Cryptodome import Random
|
||||||
from gmssl.sm4 import CryptSM4, SM4_ENCRYPT, SM4_DECRYPT
|
from Cryptodome.Cipher import AES, PKCS1_v1_5
|
||||||
|
from Cryptodome.PublicKey import RSA
|
||||||
|
from Cryptodome.Random import get_random_bytes
|
||||||
|
from Cryptodome.Util.Padding import pad
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
from gmssl.sm4 import CryptSM4, SM4_ENCRYPT, SM4_DECRYPT
|
||||||
|
|
||||||
from common.sdk.gm import piico
|
from common.sdk.gm import piico
|
||||||
|
|
||||||
|
@ -248,7 +247,7 @@ class Crypto:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
def gen_key_pair(length=1024):
|
def gen_key_pair(length=2048):
|
||||||
""" 生成加密key
|
""" 生成加密key
|
||||||
用于登录页面提交用户名/密码时,对密码进行加密(前端)/解密(后端)
|
用于登录页面提交用户名/密码时,对密码进行加密(前端)/解密(后端)
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue