1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-12-25 17:49:52 +03:00

Display key algorithm and parameters in cert dialog

This commit is contained in:
Yihong Wu 2021-09-24 17:12:51 +08:00
parent 2853337b81
commit 9c2a573cf2
8 changed files with 66 additions and 8 deletions

View File

@ -35,6 +35,9 @@
#include <shellapi.h>
#include <shlobj.h>
#include <openssl/evp.h>
#include <openssl/ec.h>
// Process name list of incompatible anti-virus software
static BAD_PROCESS bad_processes[] =
{
@ -5566,17 +5569,58 @@ void PrintCertInfo(HWND hWnd, CERT_DLG *p)
GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notAfter), NULL);
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_NOT_AFTER"), tmp);
// Number of bits
if (x->is_compatible_bit)
{
UniFormat(tmp, sizeof(tmp), _UU("CERT_BITS_FORMAT"), x->bits);
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_BITS"), tmp);
}
// Public key
k = GetKFromX(x);
if (k != NULL)
{
UINT type = EVP_PKEY_base_id(k->pkey);
switch (type)
{
case EVP_PKEY_RSA:
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_KEY_ALGORITHM"), L"RSA");
UniFormat(tmp, sizeof(tmp), _UU("CERT_BITS_FORMAT"), x->bits);
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_BITS"), tmp);
break;
case EVP_PKEY_EC:
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_KEY_ALGORITHM"), L"ECDSA");
UniFormat(tmp, sizeof(tmp), _UU("CERT_BITS_FORMAT"), x->bits);
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_BITS"), tmp);
# ifndef OPENSSL_NO_EC
EC_KEY *key = EVP_PKEY_get0_EC_KEY(k->pkey);
if (key == NULL)
{
break;
}
EC_GROUP *group = EC_KEY_get0_group(key);
if (group == NULL)
{
break;
}
int nid = EC_GROUP_get_curve_name(group);
if (nid == 0)
{
break;
}
if (StrToUni(tmp, sizeof(tmp), OBJ_nid2sn(nid)) > 0)
{
wchar_t *nname = CopyStrToUni(EC_curve_nid2nist(nid));
if (nname)
{
UniFormat(tmp, sizeof(tmp), L"%s (%s)", tmp, nname);
}
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_KEY_PARAMETER"), tmp);
Free(nname);
}
# endif
break;
default:
break;
}
BUF *b = KToBuf(k, false, NULL);
s_tmp = CopyBinToStrEx(b->Buf, b->Size);
StrToUni(tmp, sizeof(tmp), s_tmp);

View File

@ -428,12 +428,14 @@ CERT_ISSUER 发行者
CERT_SUBJECT 主题
CERT_NOT_BEFORE 有效期自
CERT_NOT_AFTER 有效期至
CERT_BITS
CERT_BITS 位
CERT_PUBLIC_KEY 公钥
CERT_DIGEST_MD5 摘要 (MD5)
CERT_DIGEST_SHA1 摘要 (SHA-1)
CERT_NO_SERIAL 没有序列号
CERT_BITS_FORMAT %u bits
CERT_KEY_ALGORITHM 公钥算法
CERT_KEY_PARAMETER 参数
#关于证书认证对话框

View File

@ -432,6 +432,8 @@ CERT_DIGEST_MD5 Digest (MD5)
CERT_DIGEST_SHA1 Digest (SHA-1)
CERT_NO_SERIAL There is no serial number
CERT_BITS_FORMAT %u bits
CERT_KEY_ALGORITHM Public Key Algorithm
CERT_KEY_PARAMETER Parameters
# Concerning certificate confirmation dialogs

View File

@ -434,6 +434,8 @@ CERT_DIGEST_MD5 ダイジェスト (MD5)
CERT_DIGEST_SHA1 ダイジェスト (SHA-1)
CERT_NO_SERIAL シリアル番号はありません
CERT_BITS_FORMAT %u bits
CERT_KEY_ALGORITHM 公開鍵アルゴリズム
CERT_KEY_PARAMETER パラメータ
# 証明書確認ダイアログ関係

View File

@ -438,6 +438,8 @@ CERT_DIGEST_MD5 다이제스트 (MD5)
CERT_DIGEST_SHA1 다이제스트 (SHA-1)
CERT_NO_SERIAL 일련 번호가 없습니다
CERT_BITS_FORMAT %u bits
CERT_KEY_ALGORITHM 공개 키 알고리즘
CERT_KEY_PARAMETER 매개변수
# 인증서 확인 대화 관계

View File

@ -448,6 +448,8 @@ CERT_DIGEST_MD5 Resumo (MD5)
CERT_DIGEST_SHA1 Resumo (SHA-1)
CERT_NO_SERIAL There is no serial number
CERT_BITS_FORMAT %u bits
CERT_KEY_ALGORITHM Public Key Algorithm
CERT_KEY_PARAMETER Parameters
# Concerning certificate confirmation dialogs

View File

@ -432,6 +432,8 @@ CERT_DIGEST_MD5 Digest (MD5)
CERT_DIGEST_SHA1 Digest (SHA-1)
CERT_NO_SERIAL There is no serial number
CERT_BITS_FORMAT %u bits
CERT_KEY_ALGORITHM Public Key Algorithm
CERT_KEY_PARAMETER Parameters
# Concerning certificate confirmation dialogs

View File

@ -438,6 +438,8 @@ CERT_DIGEST_MD5 摘要 (MD5)
CERT_DIGEST_SHA1 摘要 (SHA-1)
CERT_NO_SERIAL 沒有序號
CERT_BITS_FORMAT %u bits
CERT_KEY_ALGORITHM 公開金鑰演算法
CERT_KEY_PARAMETER 參數
#關於證書認證對話方塊