Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
46d47828
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
9
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
46d47828
编写于
6月 18, 2008
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update from stable branch.
上级
a01a351c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
6 deletion
+30
-6
engines/e_capi.c
engines/e_capi.c
+30
-6
未找到文件。
engines/e_capi.c
浏览文件 @
46d47828
...
...
@@ -141,6 +141,8 @@ struct CAPI_CTX_st {
/* Certificate store name to use */
LPTSTR
storename
;
LPTSTR
ssl_client_store
;
/* System store flags */
DWORD
store_flags
;
/* Lookup string meanings in load_private_key */
/* Substring of subject: uses "storename" */
...
...
@@ -190,6 +192,7 @@ static int capi_ctx_set_provname_idx(CAPI_CTX *ctx, int idx);
#define CAPI_CMD_LIST_OPTIONS (ENGINE_CMD_BASE + 10)
#define CAPI_CMD_LOOKUP_METHOD (ENGINE_CMD_BASE + 11)
#define CAPI_CMD_STORE_NAME (ENGINE_CMD_BASE + 12)
#define CAPI_CMD_STORE_FLAGS (ENGINE_CMD_BASE + 13)
static
const
ENGINE_CMD_DEFN
capi_cmd_defns
[]
=
{
{
CAPI_CMD_LIST_CERTS
,
...
...
@@ -245,6 +248,10 @@ static const ENGINE_CMD_DEFN capi_cmd_defns[] = {
"store_name"
,
"certificate store name, default
\"
MY
\"
"
,
ENGINE_CMD_FLAG_STRING
},
{
CAPI_CMD_STORE_FLAGS
,
"store_flags"
,
"Certificate store flags: 1 = system store"
,
ENGINE_CMD_FLAG_NUMERIC
},
{
0
,
NULL
,
NULL
,
0
}
};
...
...
@@ -291,6 +298,20 @@ static int capi_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
CAPI_trace
(
ctx
,
"Setting store name to %s
\n
"
,
p
);
break
;
case
CAPI_CMD_STORE_FLAGS
:
if
(
i
&
1
)
{
ctx
->
store_flags
|=
CERT_SYSTEM_STORE_LOCAL_MACHINE
;
ctx
->
store_flags
&=
~
CERT_SYSTEM_STORE_CURRENT_USER
;
}
else
{
ctx
->
store_flags
|=
CERT_SYSTEM_STORE_CURRENT_USER
;
ctx
->
store_flags
&=
~
CERT_SYSTEM_STORE_LOCAL_MACHINE
;
}
CAPI_trace
(
ctx
,
"Setting flags to %d
\n
"
,
i
);
break
;
case
CAPI_CMD_DEBUG_LEVEL
:
ctx
->
debug_level
=
(
int
)
i
;
CAPI_trace
(
ctx
,
"Setting debug level to %d
\n
"
,
ctx
->
debug_level
);
...
...
@@ -410,8 +431,7 @@ static int capi_init(ENGINE *e)
ctx
->
certselectdlg
=
(
CERTDLG
)
GetProcAddress
(
cryptui
,
"CryptUIDlgSelectCertificateFromStore"
);
if
(
kernel
)
ctx
->
getconswindow
=
(
GETCONSWIN
)
GetProcAddress
(
kernel
,
"GetConsoleWindow"
);
if
(
cryptui
)
// if (cryptui && !OPENSSL_isservice())
if
(
cryptui
&&
!
OPENSSL_isservice
())
ctx
->
client_cert_select
=
cert_select_dialog
;
}
#endif
...
...
@@ -1255,7 +1275,8 @@ HCERTSTORE capi_open_store(CAPI_CTX *ctx, char *storename)
storename
=
"MY"
;
CAPI_trace
(
ctx
,
"Opening certificate store %s
\n
"
,
storename
);
hstore
=
CertOpenSystemStore
(
0
,
storename
);
hstore
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_A
,
0
,
0
,
ctx
->
store_flags
,
storename
);
if
(
!
hstore
)
{
CAPIerr
(
CAPI_F_CAPI_OPEN_STORE
,
CAPI_R_ERROR_OPENING_STORE
);
...
...
@@ -1346,6 +1367,7 @@ static CAPI_KEY *capi_get_key(CAPI_CTX *ctx, const char *contname, char *provnam
{
CAPI_KEY
*
key
;
key
=
OPENSSL_malloc
(
sizeof
(
CAPI_KEY
));
contname
,
provname
,
ptype
);
CAPI_trace
(
ctx
,
"capi_get_key, contname=%s, provname=%s, type=%d
\n
"
,
contname
,
provname
,
ptype
);
if
(
!
CryptAcquireContext
(
&
key
->
hprov
,
contname
,
provname
,
ptype
,
0
))
...
...
@@ -1372,7 +1394,7 @@ static CAPI_KEY *capi_get_key(CAPI_CTX *ctx, const char *contname, char *provnam
static
CAPI_KEY
*
capi_get_cert_key
(
CAPI_CTX
*
ctx
,
PCCERT_CONTEXT
cert
)
{
CAPI_KEY
*
key
;
CAPI_KEY
*
key
=
NULL
;
CRYPT_KEY_PROV_INFO
*
pinfo
=
NULL
;
char
*
provname
=
NULL
,
*
contname
=
NULL
;
pinfo
=
capi_get_prov_info
(
ctx
,
cert
);
...
...
@@ -1381,8 +1403,7 @@ static CAPI_KEY *capi_get_cert_key(CAPI_CTX *ctx, PCCERT_CONTEXT cert)
provname
=
wide_to_asc
(
pinfo
->
pwszProvName
);
contname
=
wide_to_asc
(
pinfo
->
pwszContainerName
);
if
(
!
provname
||
!
contname
)
return
0
;
goto
err
;
key
=
capi_get_key
(
ctx
,
contname
,
provname
,
pinfo
->
dwProvType
,
pinfo
->
dwKeySpec
);
...
...
@@ -1455,6 +1476,9 @@ static CAPI_CTX *capi_ctx_new()
ctx
->
keytype
=
AT_KEYEXCHANGE
;
ctx
->
storename
=
NULL
;
ctx
->
ssl_client_store
=
NULL
;
ctx
->
store_flags
=
CERT_STORE_OPEN_EXISTING_FLAG
|
CERT_STORE_READONLY_FLAG
|
CERT_SYSTEM_STORE_CURRENT_USER
;
ctx
->
lookup_method
=
CAPI_LU_SUBSTR
;
ctx
->
debug_level
=
0
;
ctx
->
debug_file
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录