Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
7953b8ff
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
9 个月 前同步成功
通知
8
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看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7953b8ff
编写于
6月 25, 2001
作者:
R
Richard Levitte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make better use of load_cert, load_certs and load_key.
上级
b1460627
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
54 deletion
+15
-54
apps/pkcs8.c
apps/pkcs8.c
+4
-12
apps/spkac.c
apps/spkac.c
+5
-12
apps/verify.c
apps/verify.c
+6
-30
未找到文件。
apps/pkcs8.c
浏览文件 @
7953b8ff
...
...
@@ -217,21 +217,13 @@ int MAIN(int argc, char **argv)
}
#endif
}
if
(
topk8
)
{
if
(
informat
==
FORMAT_PEM
)
pkey
=
PEM_read_bio_PrivateKey
(
in
,
NULL
,
NULL
,
passin
);
else
if
(
informat
==
FORMAT_ASN1
)
pkey
=
d2i_PrivateKey_bio
(
in
,
NULL
);
else
{
BIO_printf
(
bio_err
,
"Bad format specified for key
\n
"
);
return
(
1
);
}
if
(
topk8
)
{
BIO_free
(
in
);
/* Not needed in this section */
pkey
=
load_key
(
bio_err
,
infile
,
informat
,
passin
,
e
,
"key"
);
if
(
!
pkey
)
{
BIO_printf
(
bio_err
,
"Error reading key
\n
"
,
outfile
);
ERR_print_errors
(
bio_err
);
return
(
1
);
}
BIO_free
(
in
);
if
(
!
(
p8inf
=
EVP_PKEY2PKCS8_broken
(
pkey
,
p8_broken
)))
{
BIO_printf
(
bio_err
,
"Error converting key
\n
"
,
outfile
);
ERR_print_errors
(
bio_err
);
...
...
apps/spkac.c
浏览文件 @
7953b8ff
...
...
@@ -84,7 +84,7 @@ int MAIN(int argc, char **argv)
{
ENGINE
*
e
=
NULL
;
int
i
,
badops
=
0
,
ret
=
1
;
BIO
*
in
=
NULL
,
*
out
=
NULL
,
*
key
=
NULL
;
BIO
*
in
=
NULL
,
*
out
=
NULL
;
int
verify
=
0
,
noout
=
0
,
pubkey
=
0
;
char
*
infile
=
NULL
,
*
outfile
=
NULL
,
*
prog
;
char
*
passargin
=
NULL
,
*
passin
=
NULL
;
...
...
@@ -182,17 +182,10 @@ bad:
e
=
setup_engine
(
bio_err
,
engine
,
0
);
if
(
keyfile
)
{
if
(
strcmp
(
keyfile
,
"-"
))
key
=
BIO_new_file
(
keyfile
,
"r"
);
else
key
=
BIO_new_fp
(
stdin
,
BIO_NOCLOSE
);
if
(
!
key
)
{
BIO_printf
(
bio_err
,
"Error opening key file
\n
"
);
ERR_print_errors
(
bio_err
);
goto
end
;
}
pkey
=
PEM_read_bio_PrivateKey
(
key
,
NULL
,
NULL
,
passin
);
pkey
=
load_key
(
bio_err
,
strcmp
(
keyfile
,
"-"
)
?
keyfile
:
NULL
,
FORMAT_PEM
,
passin
,
e
,
"private key"
);
if
(
!
pkey
)
{
BIO_printf
(
bio_err
,
"Error reading private key
\n
"
);
ERR_print_errors
(
bio_err
);
goto
end
;
}
spki
=
NETSCAPE_SPKI_new
();
...
...
@@ -296,8 +289,8 @@ end:
NETSCAPE_SPKI_free
(
spki
);
BIO_free
(
in
);
BIO_free_all
(
out
);
BIO_free
(
key
);
EVP_PKEY_free
(
pkey
);
if
(
passin
)
OPENSSL_free
(
passin
);
apps_shutdown
();
EXIT
(
ret
);
}
apps/verify.c
浏览文件 @
7953b8ff
...
...
@@ -71,7 +71,7 @@
#define PROG verify_main
static
int
MS_CALLBACK
cb
(
int
ok
,
X509_STORE_CTX
*
ctx
);
static
int
check
(
X509_STORE
*
ctx
,
char
*
file
,
STACK_OF
(
X509
)
*
uchain
,
STACK_OF
(
X509
)
*
tchain
,
int
purpose
);
static
int
check
(
X509_STORE
*
ctx
,
char
*
file
,
STACK_OF
(
X509
)
*
uchain
,
STACK_OF
(
X509
)
*
tchain
,
int
purpose
,
ENGINE
*
e
);
static
STACK_OF
(
X509
)
*
load_untrusted
(
char
*
file
);
static
int
v_verbose
=
0
,
vflags
=
0
;
...
...
@@ -208,10 +208,10 @@ int MAIN(int argc, char **argv)
}
}
if
(
argc
<
1
)
check
(
cert_ctx
,
NULL
,
untrusted
,
trusted
,
purpose
);
if
(
argc
<
1
)
check
(
cert_ctx
,
NULL
,
untrusted
,
trusted
,
purpose
,
e
);
else
for
(
i
=
0
;
i
<
argc
;
i
++
)
check
(
cert_ctx
,
argv
[
i
],
untrusted
,
trusted
,
purpose
);
check
(
cert_ctx
,
argv
[
i
],
untrusted
,
trusted
,
purpose
,
e
);
ret
=
0
;
end:
if
(
ret
==
1
)
{
...
...
@@ -227,42 +227,19 @@ end:
if
(
cert_ctx
!=
NULL
)
X509_STORE_free
(
cert_ctx
);
sk_X509_pop_free
(
untrusted
,
X509_free
);
sk_X509_pop_free
(
trusted
,
X509_free
);
apps_shutdown
();
EXIT
(
ret
);
}
static
int
check
(
X509_STORE
*
ctx
,
char
*
file
,
STACK_OF
(
X509
)
*
uchain
,
STACK_OF
(
X509
)
*
tchain
,
int
purpose
)
static
int
check
(
X509_STORE
*
ctx
,
char
*
file
,
STACK_OF
(
X509
)
*
uchain
,
STACK_OF
(
X509
)
*
tchain
,
int
purpose
,
ENGINE
*
e
)
{
X509
*
x
=
NULL
;
BIO
*
in
=
NULL
;
int
i
=
0
,
ret
=
0
;
X509_STORE_CTX
*
csc
;
in
=
BIO_new
(
BIO_s_file
());
if
(
in
==
NULL
)
{
ERR_print_errors
(
bio_err
);
goto
end
;
}
if
(
file
==
NULL
)
BIO_set_fp
(
in
,
stdin
,
BIO_NOCLOSE
);
else
{
if
(
BIO_read_filename
(
in
,
file
)
<=
0
)
{
perror
(
file
);
goto
end
;
}
}
x
=
PEM_read_bio_X509
(
in
,
NULL
,
NULL
,
NULL
);
x
=
load_cert
(
bio_err
,
file
,
FORMAT_PEM
,
NULL
,
e
,
"certificate file"
);
if
(
x
==
NULL
)
{
fprintf
(
stdout
,
"%s: unable to load certificate file
\n
"
,
(
file
==
NULL
)
?
"stdin"
:
file
);
ERR_print_errors
(
bio_err
);
goto
end
;
}
fprintf
(
stdout
,
"%s: "
,(
file
==
NULL
)
?
"stdin"
:
file
);
csc
=
X509_STORE_CTX_new
();
...
...
@@ -288,7 +265,6 @@ end:
else
ERR_print_errors
(
bio_err
);
if
(
x
!=
NULL
)
X509_free
(
x
);
if
(
in
!=
NULL
)
BIO_free
(
in
);
return
(
ret
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录