Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
b3ca645f
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
8 个月 前同步成功
通知
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 搜索 >>
提交
b3ca645f
编写于
5月 01, 1999
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New function SSL_CTX_use_certificate_chain_file.
Submitted by: Reviewed by: PR:
上级
65d4927b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
87 addition
and
0 deletion
+87
-0
CHANGES
CHANGES
+6
-0
ssl/ssl.h
ssl/ssl.h
+2
-0
ssl/ssl_err.c
ssl/ssl_err.c
+1
-0
ssl/ssl_rsa.c
ssl/ssl_rsa.c
+78
-0
未找到文件。
CHANGES
浏览文件 @
b3ca645f
...
...
@@ -5,6 +5,12 @@
Changes between 0.9.2b and 0.9.3
*) New function SSL_CTX_use_certificate_chain_file that sets the
"extra_cert"s in addition to the certificate. (This makes sense
only for "PEM" format files, as chains as a whole are not
DER-encoded.)
[Bodo Moeller]
*) Support verify_depth from the SSL API.
x509_vfy.c had what can be considered an off-by-one-error:
Its depth (which was not part of the external interface)
...
...
ssl/ssl.h
浏览文件 @
b3ca645f
...
...
@@ -874,6 +874,7 @@ int SSL_use_certificate_file(SSL *ssl, char *file, int type);
int
SSL_CTX_use_RSAPrivateKey_file
(
SSL_CTX
*
ctx
,
char
*
file
,
int
type
);
int
SSL_CTX_use_PrivateKey_file
(
SSL_CTX
*
ctx
,
char
*
file
,
int
type
);
int
SSL_CTX_use_certificate_file
(
SSL_CTX
*
ctx
,
char
*
file
,
int
type
);
int
SSL_CTX_use_certificate_chain_file
(
SSL_CTX
*
ctx
,
const
char
*
file
);
/* PEM type */
STACK_OF
(
X509_NAME
)
*
SSL_load_client_CA_file
(
const
char
*
file
);
int
SSL_add_file_cert_subjects_to_stack
(
STACK
*
stackCAs
,
const
char
*
file
);
...
...
@@ -1168,6 +1169,7 @@ int SSL_COMP_add_compression_method(int id,char *cm);
#define SSL_F_SSL_CTX_SET_SSL_VERSION 170
#define SSL_F_SSL_CTX_USE_CERTIFICATE 171
#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172
#define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE 220
#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173
#define SSL_F_SSL_CTX_USE_PRIVATEKEY 174
#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175
...
...
ssl/ssl_err.c
浏览文件 @
b3ca645f
...
...
@@ -142,6 +142,7 @@ static ERR_STRING_DATA SSL_str_functs[]=
{
ERR_PACK
(
0
,
SSL_F_SSL_CTX_SET_SSL_VERSION
,
0
),
"SSL_CTX_set_ssl_version"
},
{
ERR_PACK
(
0
,
SSL_F_SSL_CTX_USE_CERTIFICATE
,
0
),
"SSL_CTX_use_certificate"
},
{
ERR_PACK
(
0
,
SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1
,
0
),
"SSL_CTX_use_certificate_ASN1"
},
{
ERR_PACK
(
0
,
SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE
,
0
),
"SSL_CTX_USE_CERTIFICATE_CHAIN_FILE"
},
{
ERR_PACK
(
0
,
SSL_F_SSL_CTX_USE_CERTIFICATE_FILE
,
0
),
"SSL_CTX_use_certificate_file"
},
{
ERR_PACK
(
0
,
SSL_F_SSL_CTX_USE_PRIVATEKEY
,
0
),
"SSL_CTX_use_PrivateKey"
},
{
ERR_PACK
(
0
,
SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1
,
0
),
"SSL_CTX_use_PrivateKey_ASN1"
},
...
...
ssl/ssl_rsa.c
浏览文件 @
b3ca645f
...
...
@@ -735,3 +735,81 @@ int SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, unsigned char *d,
}
#ifndef NO_STDIO
/* Read a file that contains our certificate in "PEM" format,
* possibly followed by a sequence of CA certificates that should be
* sent to the peer in the Certificate message.
*/
int
SSL_CTX_use_certificate_chain_file
(
SSL_CTX
*
ctx
,
const
char
*
file
)
{
BIO
*
in
;
int
ret
=
0
;
X509
*
x
=
NULL
;
in
=
BIO_new
(
BIO_s_file_internal
());
if
(
in
==
NULL
)
{
SSLerr
(
SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE
,
ERR_R_BUF_LIB
);
goto
end
;
}
if
(
BIO_read_filename
(
in
,
file
)
<=
0
)
{
SSLerr
(
SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE
,
ERR_R_SYS_LIB
);
goto
end
;
}
x
=
PEM_read_bio_X509
(
in
,
NULL
,
ctx
->
default_passwd_callback
);
if
(
x
==
NULL
)
{
SSLerr
(
SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE
,
ERR_R_PEM_LIB
);
goto
end
;
}
ret
=
SSL_CTX_use_certificate
(
ctx
,
x
);
if
(
ERR_peek_error
()
!=
0
)
ret
=
0
;
/* Key/certificate mismatch doesn't imply ret==0 ... */
if
(
ret
)
{
/* If we could set up our certificate, now proceed to
* the CA certificates.
*/
X509
*
ca
;
int
r
;
unsigned
long
err
;
if
(
ctx
->
extra_certs
!=
NULL
)
{
sk_X509_pop_free
(
ctx
->
extra_certs
,
X509_free
);
ctx
->
extra_certs
=
NULL
;
}
while
((
ca
=
PEM_read_bio_X509
(
in
,
NULL
,
ctx
->
default_passwd_callback
))
!=
NULL
)
{
r
=
SSL_CTX_add_extra_chain_cert
(
ctx
,
ca
);
if
(
!
r
)
{
X509_free
(
ca
);
ret
=
0
;
goto
end
;
}
/* Note that we must not free r if it was succesully
* added to the chain (while we must free the main
* certificate, since its reference count is increased
* by SSL_CTX_use_certificate). */
}
/* When the while loop ends, it's usually just EOF. */
err
=
ERR_peek_error
();
if
(
ERR_GET_LIB
(
err
)
==
ERR_LIB_PEM
&&
ERR_GET_REASON
(
err
)
==
PEM_R_NO_START_LINE
)
(
void
)
ERR_get_error
();
else
ret
=
0
;
/* some real error */
}
end:
if
(
x
!=
NULL
)
X509_free
(
x
);
if
(
in
!=
NULL
)
BIO_free
(
in
);
return
(
ret
);
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录