Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
95ea5318
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
95ea5318
编写于
12月 02, 2012
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add option to get a certificate or CRL from a URL
上级
4842dde8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
79 addition
and
0 deletion
+79
-0
apps/apps.c
apps/apps.c
+70
-0
apps/apps.h
apps/apps.h
+3
-0
apps/crl.c
apps/crl.c
+6
-0
未找到文件。
apps/apps.c
浏览文件 @
95ea5318
...
...
@@ -275,6 +275,8 @@ int str2fmt(char *s)
return
(
FORMAT_PKCS12
);
else
if
((
*
s
==
'E'
)
||
(
*
s
==
'e'
))
return
(
FORMAT_ENGINE
);
else
if
((
*
s
==
'H'
)
||
(
*
s
==
'h'
))
return
FORMAT_HTTP
;
else
if
((
*
s
==
'P'
)
||
(
*
s
==
'p'
))
{
if
(
s
[
1
]
==
'V'
||
s
[
1
]
==
'v'
)
...
...
@@ -783,12 +785,80 @@ static int load_pkcs12(BIO *err, BIO *in, const char *desc,
return
ret
;
}
int
load_cert_crl_http
(
const
char
*
url
,
BIO
*
err
,
X509
**
pcert
,
X509_CRL
**
pcrl
)
{
char
*
host
=
NULL
,
*
port
=
NULL
,
*
path
=
NULL
;
BIO
*
bio
=
NULL
;
OCSP_REQ_CTX
*
rctx
=
NULL
;
int
use_ssl
,
rv
=
0
;
if
(
!
OCSP_parse_url
(
url
,
&
host
,
&
port
,
&
path
,
&
use_ssl
))
goto
err
;
if
(
use_ssl
)
{
if
(
err
)
BIO_puts
(
err
,
"https not supported
\n
"
);
goto
err
;
}
bio
=
BIO_new_connect
(
host
);
if
(
!
bio
||
!
BIO_set_conn_port
(
bio
,
port
))
goto
err
;
rctx
=
OCSP_REQ_CTX_new
(
bio
,
1024
);
if
(
!
rctx
)
goto
err
;
if
(
!
OCSP_REQ_CTX_http
(
rctx
,
"GET"
,
path
))
goto
err
;
if
(
!
OCSP_REQ_CTX_add1_header
(
rctx
,
"Host"
,
host
))
goto
err
;
if
(
pcert
)
{
do
{
rv
=
X509_http_nbio
(
rctx
,
pcert
);
}
while
(
rv
==
-
1
);
}
else
{
do
{
rv
=
X509_CRL_http_nbio
(
rctx
,
pcrl
);
}
while
(
rv
==
-
1
);
}
err:
if
(
host
)
OPENSSL_free
(
host
);
if
(
path
)
OPENSSL_free
(
path
);
if
(
port
)
OPENSSL_free
(
port
);
if
(
bio
)
BIO_free_all
(
bio
);
if
(
rctx
)
OCSP_REQ_CTX_free
(
rctx
);
if
(
rv
!=
1
)
{
if
(
bio
&&
err
)
BIO_printf
(
bio_err
,
"Error loading %s from %s
\n
"
,
pcert
?
"certificate"
:
"CRL"
,
url
);
ERR_print_errors
(
bio_err
);
}
return
rv
;
}
X509
*
load_cert
(
BIO
*
err
,
const
char
*
file
,
int
format
,
const
char
*
pass
,
ENGINE
*
e
,
const
char
*
cert_descrip
)
{
X509
*
x
=
NULL
;
BIO
*
cert
;
if
(
format
==
FORMAT_HTTP
)
{
load_cert_crl_http
(
file
,
err
,
&
x
,
NULL
);
return
x
;
}
if
((
cert
=
BIO_new
(
BIO_s_file
()))
==
NULL
)
{
ERR_print_errors
(
err
);
...
...
apps/apps.h
浏览文件 @
95ea5318
...
...
@@ -245,6 +245,8 @@ int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
int
add_oid_section
(
BIO
*
err
,
CONF
*
conf
);
X509
*
load_cert
(
BIO
*
err
,
const
char
*
file
,
int
format
,
const
char
*
pass
,
ENGINE
*
e
,
const
char
*
cert_descrip
);
int
load_cert_crl_http
(
const
char
*
url
,
BIO
*
err
,
X509
**
pcert
,
X509_CRL
**
pcrl
);
EVP_PKEY
*
load_key
(
BIO
*
err
,
const
char
*
file
,
int
format
,
int
maybe_stdin
,
const
char
*
pass
,
ENGINE
*
e
,
const
char
*
key_descrip
);
EVP_PKEY
*
load_pubkey
(
BIO
*
err
,
const
char
*
file
,
int
format
,
int
maybe_stdin
,
...
...
@@ -354,6 +356,7 @@ void print_cert_checks(BIO *bio, X509 *x,
#define FORMAT_ASN1RSA 10
/* DER RSAPubicKey format */
#define FORMAT_MSBLOB 11
/* MS Key blob format */
#define FORMAT_PVK 12
/* MS PVK file format */
#define FORMAT_HTTP 13
/* Dowload using HTTP */
#define EXT_COPY_NONE 0
#define EXT_COPY_ADD 1
...
...
apps/crl.c
浏览文件 @
95ea5318
...
...
@@ -407,6 +407,12 @@ static X509_CRL *load_crl(char *infile, int format)
X509_CRL
*
x
=
NULL
;
BIO
*
in
=
NULL
;
if
(
format
==
FORMAT_HTTP
)
{
load_cert_crl_http
(
infile
,
bio_err
,
NULL
,
&
x
);
return
x
;
}
in
=
BIO_new
(
BIO_s_file
());
if
(
in
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录