Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
e20b4727
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
接近 2 年 前同步成功
通知
12
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看板
提交
e20b4727
编写于
9月 11, 2015
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for signer_digest option in TS.
Based on PR#2145 Reviewed-by:
N
Matt Caswell
<
matt@openssl.org
>
上级
fa499246
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
75 addition
and
15 deletion
+75
-15
apps/openssl-vms.cnf
apps/openssl-vms.cnf
+1
-0
apps/openssl.cnf
apps/openssl.cnf
+1
-1
apps/ts.c
apps/ts.c
+19
-11
crypto/ts/ts_conf.c
crypto/ts/ts_conf.c
+25
-0
crypto/ts/ts_lcl.h
crypto/ts/ts_lcl.h
+1
-0
crypto/ts/ts_rsp_sign.c
crypto/ts/ts_rsp_sign.c
+9
-1
doc/apps/ts.pod
doc/apps/ts.pod
+12
-0
include/openssl/ts.h
include/openssl/ts.h
+5
-0
test/CAtsa.cnf
test/CAtsa.cnf
+2
-2
未找到文件。
apps/openssl-vms.cnf
浏览文件 @
e20b4727
...
@@ -335,6 +335,7 @@ signer_cert = $dir/tsacert.pem # The TSA signing certificate
...
@@ -335,6 +335,7 @@ signer_cert = $dir/tsacert.pem # The TSA signing certificate
certs = $dir.cacert.pem] # Certificate chain to include in reply
certs = $dir.cacert.pem] # Certificate chain to include in reply
# (optional)
# (optional)
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
signer_digest = sha1 # Signing digest to use. (Optional)
default_policy = tsa_policy1 # Policy if request did not specify it
default_policy = tsa_policy1 # Policy if request did not specify it
# (optional)
# (optional)
...
...
apps/openssl.cnf
浏览文件 @
e20b4727
...
@@ -335,7 +335,7 @@ signer_cert = $dir/tsacert.pem # The TSA signing certificate
...
@@ -335,7 +335,7 @@ signer_cert = $dir/tsacert.pem # The TSA signing certificate
certs = $dir/cacert.pem # Certificate chain to include in reply
certs = $dir/cacert.pem # Certificate chain to include in reply
# (optional)
# (optional)
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
signer_digest = sha1 # Signing digest to use. (Optional)
default_policy = tsa_policy1 # Policy if request did not specify it
default_policy = tsa_policy1 # Policy if request did not specify it
# (optional)
# (optional)
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
...
...
apps/ts.c
浏览文件 @
e20b4727
...
@@ -95,14 +95,14 @@ static ASN1_INTEGER *create_nonce(int bits);
...
@@ -95,14 +95,14 @@ static ASN1_INTEGER *create_nonce(int bits);
/* Reply related functions. */
/* Reply related functions. */
static
int
reply_command
(
CONF
*
conf
,
char
*
section
,
char
*
engine
,
static
int
reply_command
(
CONF
*
conf
,
char
*
section
,
char
*
engine
,
char
*
queryfile
,
char
*
passin
,
char
*
inkey
,
char
*
queryfile
,
char
*
passin
,
char
*
inkey
,
c
har
*
signer
,
char
*
chain
,
const
char
*
policy
,
c
onst
EVP_MD
*
md
,
char
*
signer
,
char
*
chain
,
c
har
*
in
,
int
token_in
,
char
*
out
,
int
token_out
,
c
onst
char
*
policy
,
char
*
in
,
int
token_in
,
int
text
);
char
*
out
,
int
token_out
,
int
text
);
static
TS_RESP
*
read_PKCS7
(
BIO
*
in_bio
);
static
TS_RESP
*
read_PKCS7
(
BIO
*
in_bio
);
static
TS_RESP
*
create_response
(
CONF
*
conf
,
const
char
*
section
,
char
*
engine
,
static
TS_RESP
*
create_response
(
CONF
*
conf
,
const
char
*
section
,
char
*
engine
,
char
*
queryfile
,
char
*
passin
,
char
*
queryfile
,
char
*
passin
,
char
*
inkey
,
c
har
*
signer
,
char
*
chain
,
char
*
inkey
,
c
onst
EVP_MD
*
md
,
char
*
signer
,
const
char
*
policy
);
c
har
*
chain
,
c
onst
char
*
policy
);
static
ASN1_INTEGER
*
serial_cb
(
TS_RESP_CTX
*
ctx
,
void
*
data
);
static
ASN1_INTEGER
*
serial_cb
(
TS_RESP_CTX
*
ctx
,
void
*
data
);
static
ASN1_INTEGER
*
next_serial
(
const
char
*
serialfile
);
static
ASN1_INTEGER
*
next_serial
(
const
char
*
serialfile
);
static
int
save_ts_serial
(
const
char
*
serialfile
,
ASN1_INTEGER
*
serial
);
static
int
save_ts_serial
(
const
char
*
serialfile
,
ASN1_INTEGER
*
serial
);
...
@@ -342,7 +342,7 @@ int ts_main(int argc, char **argv)
...
@@ -342,7 +342,7 @@ int ts_main(int argc, char **argv)
goto
opthelp
;
goto
opthelp
;
}
}
ret
=
!
reply_command
(
conf
,
section
,
engine
,
queryfile
,
ret
=
!
reply_command
(
conf
,
section
,
engine
,
queryfile
,
password
,
inkey
,
signer
,
chain
,
policy
,
password
,
inkey
,
md
,
signer
,
chain
,
policy
,
in
,
token_in
,
out
,
token_out
,
text
);
in
,
token_in
,
out
,
token_out
,
text
);
break
;
break
;
case
OPT_VERIFY
:
case
OPT_VERIFY
:
...
@@ -583,8 +583,8 @@ static ASN1_INTEGER *create_nonce(int bits)
...
@@ -583,8 +583,8 @@ static ASN1_INTEGER *create_nonce(int bits)
static
int
reply_command
(
CONF
*
conf
,
char
*
section
,
char
*
engine
,
static
int
reply_command
(
CONF
*
conf
,
char
*
section
,
char
*
engine
,
char
*
queryfile
,
char
*
passin
,
char
*
inkey
,
char
*
queryfile
,
char
*
passin
,
char
*
inkey
,
c
har
*
signer
,
char
*
chain
,
const
char
*
policy
,
c
onst
EVP_MD
*
md
,
char
*
signer
,
char
*
chain
,
char
*
in
,
int
token_in
,
c
onst
char
*
policy
,
c
har
*
in
,
int
token_in
,
char
*
out
,
int
token_out
,
int
text
)
char
*
out
,
int
token_out
,
int
text
)
{
{
int
ret
=
0
;
int
ret
=
0
;
...
@@ -605,7 +605,7 @@ static int reply_command(CONF *conf, char *section, char *engine,
...
@@ -605,7 +605,7 @@ static int reply_command(CONF *conf, char *section, char *engine,
}
}
}
else
{
}
else
{
response
=
create_response
(
conf
,
section
,
engine
,
queryfile
,
response
=
create_response
(
conf
,
section
,
engine
,
queryfile
,
passin
,
inkey
,
signer
,
chain
,
policy
);
passin
,
inkey
,
md
,
signer
,
chain
,
policy
);
if
(
response
)
if
(
response
)
BIO_printf
(
bio_err
,
"Response has been generated.
\n
"
);
BIO_printf
(
bio_err
,
"Response has been generated.
\n
"
);
else
else
...
@@ -691,8 +691,8 @@ static TS_RESP *read_PKCS7(BIO *in_bio)
...
@@ -691,8 +691,8 @@ static TS_RESP *read_PKCS7(BIO *in_bio)
static
TS_RESP
*
create_response
(
CONF
*
conf
,
const
char
*
section
,
char
*
engine
,
static
TS_RESP
*
create_response
(
CONF
*
conf
,
const
char
*
section
,
char
*
engine
,
char
*
queryfile
,
char
*
passin
,
char
*
queryfile
,
char
*
passin
,
char
*
inkey
,
c
har
*
signer
,
char
*
chain
,
char
*
inkey
,
c
onst
EVP_MD
*
md
,
char
*
signer
,
const
char
*
policy
)
c
har
*
chain
,
c
onst
char
*
policy
)
{
{
int
ret
=
0
;
int
ret
=
0
;
TS_RESP
*
response
=
NULL
;
TS_RESP
*
response
=
NULL
;
...
@@ -717,6 +717,14 @@ static TS_RESP *create_response(CONF *conf, const char *section, char *engine,
...
@@ -717,6 +717,14 @@ static TS_RESP *create_response(CONF *conf, const char *section, char *engine,
goto
end
;
goto
end
;
if
(
!
TS_CONF_set_signer_key
(
conf
,
section
,
inkey
,
passin
,
resp_ctx
))
if
(
!
TS_CONF_set_signer_key
(
conf
,
section
,
inkey
,
passin
,
resp_ctx
))
goto
end
;
goto
end
;
if
(
md
)
{
if
(
!
TS_RESP_CTX_set_signer_digest
(
resp_ctx
,
md
))
goto
end
;
}
else
if
(
!
TS_CONF_set_signer_digest
(
conf
,
section
,
NULL
,
resp_ctx
))
{
goto
end
;
}
if
(
!
TS_CONF_set_def_policy
(
conf
,
section
,
policy
,
resp_ctx
))
if
(
!
TS_CONF_set_def_policy
(
conf
,
section
,
policy
,
resp_ctx
))
goto
end
;
goto
end
;
if
(
!
TS_CONF_set_policies
(
conf
,
section
,
resp_ctx
))
if
(
!
TS_CONF_set_policies
(
conf
,
section
,
resp_ctx
))
...
...
crypto/ts/ts_conf.c
浏览文件 @
e20b4727
...
@@ -75,6 +75,7 @@
...
@@ -75,6 +75,7 @@
#define ENV_SIGNER_CERT "signer_cert"
#define ENV_SIGNER_CERT "signer_cert"
#define ENV_CERTS "certs"
#define ENV_CERTS "certs"
#define ENV_SIGNER_KEY "signer_key"
#define ENV_SIGNER_KEY "signer_key"
#define ENV_SIGNER_DIGEST "signer_digest"
#define ENV_DEFAULT_POLICY "default_policy"
#define ENV_DEFAULT_POLICY "default_policy"
#define ENV_OTHER_POLICIES "other_policies"
#define ENV_OTHER_POLICIES "other_policies"
#define ENV_DIGESTS "digests"
#define ENV_DIGESTS "digests"
...
@@ -304,6 +305,30 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section,
...
@@ -304,6 +305,30 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section,
return
ret
;
return
ret
;
}
}
int
TS_CONF_set_signer_digest
(
CONF
*
conf
,
const
char
*
section
,
const
char
*
md
,
TS_RESP_CTX
*
ctx
)
{
int
ret
=
0
;
const
EVP_MD
*
sign_md
=
NULL
;
if
(
md
==
NULL
)
md
=
NCONF_get_string
(
conf
,
section
,
ENV_SIGNER_DIGEST
);
if
(
md
==
NULL
)
{
ts_CONF_lookup_fail
(
section
,
ENV_SIGNER_DIGEST
);
goto
err
;
}
sign_md
=
EVP_get_digestbyname
(
md
);
if
(
sign_md
==
NULL
)
{
ts_CONF_invalid
(
section
,
ENV_SIGNER_DIGEST
);
goto
err
;
}
if
(
!
TS_RESP_CTX_set_signer_digest
(
ctx
,
sign_md
))
goto
err
;
ret
=
1
;
err:
return
ret
;
}
int
TS_CONF_set_def_policy
(
CONF
*
conf
,
const
char
*
section
,
int
TS_CONF_set_def_policy
(
CONF
*
conf
,
const
char
*
section
,
const
char
*
policy
,
TS_RESP_CTX
*
ctx
)
const
char
*
policy
,
TS_RESP_CTX
*
ctx
)
{
{
...
...
crypto/ts/ts_lcl.h
浏览文件 @
e20b4727
...
@@ -183,6 +183,7 @@ struct ESS_signing_cert {
...
@@ -183,6 +183,7 @@ struct ESS_signing_cert {
struct
TS_resp_ctx
{
struct
TS_resp_ctx
{
X509
*
signer_cert
;
X509
*
signer_cert
;
EVP_PKEY
*
signer_key
;
EVP_PKEY
*
signer_key
;
const
EVP_MD
*
signer_md
;
STACK_OF
(
X509
)
*
certs
;
/* Certs to include in signed data. */
STACK_OF
(
X509
)
*
certs
;
/* Certs to include in signed data. */
STACK_OF
(
ASN1_OBJECT
)
*
policies
;
/* Acceptable policies. */
STACK_OF
(
ASN1_OBJECT
)
*
policies
;
/* Acceptable policies. */
ASN1_OBJECT
*
default_policy
;
/* It may appear in policies, too. */
ASN1_OBJECT
*
default_policy
;
/* It may appear in policies, too. */
...
...
crypto/ts/ts_rsp_sign.c
浏览文件 @
e20b4727
...
@@ -169,6 +169,8 @@ TS_RESP_CTX *TS_RESP_CTX_new()
...
@@ -169,6 +169,8 @@ TS_RESP_CTX *TS_RESP_CTX_new()
return
NULL
;
return
NULL
;
}
}
ctx
->
signer_md
=
EVP_sha256
();
ctx
->
serial_cb
=
def_serial_cb
;
ctx
->
serial_cb
=
def_serial_cb
;
ctx
->
time_cb
=
def_time_cb
;
ctx
->
time_cb
=
def_time_cb
;
ctx
->
extension_cb
=
def_extension_cb
;
ctx
->
extension_cb
=
def_extension_cb
;
...
@@ -215,6 +217,12 @@ int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key)
...
@@ -215,6 +217,12 @@ int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key)
return
1
;
return
1
;
}
}
int
TS_RESP_CTX_set_signer_digest
(
TS_RESP_CTX
*
ctx
,
const
EVP_MD
*
md
)
{
ctx
->
signer_md
=
md
;
return
1
;
}
int
TS_RESP_CTX_set_def_policy
(
TS_RESP_CTX
*
ctx
,
ASN1_OBJECT
*
def_policy
)
int
TS_RESP_CTX_set_def_policy
(
TS_RESP_CTX
*
ctx
,
ASN1_OBJECT
*
def_policy
)
{
{
ASN1_OBJECT_free
(
ctx
->
default_policy
);
ASN1_OBJECT_free
(
ctx
->
default_policy
);
...
@@ -700,7 +708,7 @@ static int ts_RESP_sign(TS_RESP_CTX *ctx)
...
@@ -700,7 +708,7 @@ static int ts_RESP_sign(TS_RESP_CTX *ctx)
}
}
if
((
si
=
PKCS7_add_signature
(
p7
,
ctx
->
signer_cert
,
if
((
si
=
PKCS7_add_signature
(
p7
,
ctx
->
signer_cert
,
ctx
->
signer_key
,
EVP_sha1
()
))
==
NULL
)
{
ctx
->
signer_key
,
ctx
->
signer_md
))
==
NULL
)
{
TSerr
(
TS_F_TS_RESP_SIGN
,
TS_R_PKCS7_ADD_SIGNATURE_ERROR
);
TSerr
(
TS_F_TS_RESP_SIGN
,
TS_R_PKCS7_ADD_SIGNATURE_ERROR
);
goto
err
;
goto
err
;
}
}
...
...
doc/apps/ts.pod
浏览文件 @
e20b4727
...
@@ -28,6 +28,7 @@ B<-reply>
...
@@ -28,6 +28,7 @@ B<-reply>
[B<-passin> password_src]
[B<-passin> password_src]
[B<-signer> tsa_cert.pem]
[B<-signer> tsa_cert.pem]
[B<-inkey> private.pem]
[B<-inkey> private.pem]
[B<-md2>|B<-md4>|B<-md5>|B<-sha>|B<-sha1>|B<-mdc2>|B<-ripemd160>|B<...>]
[B<-chain> certs_file.pem]
[B<-chain> certs_file.pem]
[B<-policy> object_id]
[B<-policy> object_id]
[B<-in> response.tsr]
[B<-in> response.tsr]
...
@@ -215,6 +216,11 @@ variable of the config file. (Optional)
...
@@ -215,6 +216,11 @@ variable of the config file. (Optional)
The signer private key of the TSA in PEM format. Overrides the
The signer private key of the TSA in PEM format. Overrides the
B<signer_key> config file option. (Optional)
B<signer_key> config file option. (Optional)
=item B<-md2>|B<-md4>|B<-md5>|B<-sha>|B<-sha1>|B<-mdc2>|B<-ripemd160>|B<...>
Signing digest to use. Overrides the B<signer_digest> config file
option. (Optional)
=item B<-chain> certs_file.pem
=item B<-chain> certs_file.pem
The collection of certificates in PEM format that will all
The collection of certificates in PEM format that will all
...
@@ -396,6 +402,12 @@ option. (Optional)
...
@@ -396,6 +402,12 @@ option. (Optional)
The private key of the TSA in PEM format. The same as the B<-inkey>
The private key of the TSA in PEM format. The same as the B<-inkey>
command line option. (Optional)
command line option. (Optional)
=item B<signer_digest>
Signing digest to use. The same as the
B<-md2>|B<-md4>|B<-md5>|B<-sha>|B<-sha1>|B<-mdc2>|B<-ripemd160>|B<...>
command line option. (Optional)
=item B<default_policy>
=item B<default_policy>
The default policy to use when the request does not mandate any
The default policy to use when the request does not mandate any
...
...
include/openssl/ts.h
浏览文件 @
e20b4727
...
@@ -371,6 +371,9 @@ int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer);
...
@@ -371,6 +371,9 @@ int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer);
/* This parameter must be set. */
/* This parameter must be set. */
int
TS_RESP_CTX_set_signer_key
(
TS_RESP_CTX
*
ctx
,
EVP_PKEY
*
key
);
int
TS_RESP_CTX_set_signer_key
(
TS_RESP_CTX
*
ctx
,
EVP_PKEY
*
key
);
int
TS_RESP_CTX_set_signer_digest
(
TS_RESP_CTX
*
ctx
,
const
EVP_MD
*
signer_digest
);
/* This parameter must be set. */
/* This parameter must be set. */
int
TS_RESP_CTX_set_def_policy
(
TS_RESP_CTX
*
ctx
,
ASN1_OBJECT
*
def_policy
);
int
TS_RESP_CTX_set_def_policy
(
TS_RESP_CTX
*
ctx
,
ASN1_OBJECT
*
def_policy
);
...
@@ -564,6 +567,8 @@ int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
...
@@ -564,6 +567,8 @@ int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
int
TS_CONF_set_signer_key
(
CONF
*
conf
,
const
char
*
section
,
int
TS_CONF_set_signer_key
(
CONF
*
conf
,
const
char
*
section
,
const
char
*
key
,
const
char
*
pass
,
const
char
*
key
,
const
char
*
pass
,
TS_RESP_CTX
*
ctx
);
TS_RESP_CTX
*
ctx
);
int
TS_CONF_set_signer_digest
(
CONF
*
conf
,
const
char
*
section
,
const
char
*
md
,
TS_RESP_CTX
*
ctx
);
int
TS_CONF_set_def_policy
(
CONF
*
conf
,
const
char
*
section
,
int
TS_CONF_set_def_policy
(
CONF
*
conf
,
const
char
*
section
,
const
char
*
policy
,
TS_RESP_CTX
*
ctx
);
const
char
*
policy
,
TS_RESP_CTX
*
ctx
);
int
TS_CONF_set_policies
(
CONF
*
conf
,
const
char
*
section
,
TS_RESP_CTX
*
ctx
);
int
TS_CONF_set_policies
(
CONF
*
conf
,
const
char
*
section
,
TS_RESP_CTX
*
ctx
);
...
...
test/CAtsa.cnf
浏览文件 @
e20b4727
...
@@ -132,7 +132,7 @@ signer_cert = $dir/tsa_cert1.pem # The TSA signing certificate
...
@@ -132,7 +132,7 @@ signer_cert = $dir/tsa_cert1.pem # The TSA signing certificate
certs = $dir/tsaca.pem # Certificate chain to include in reply
certs = $dir/tsaca.pem # Certificate chain to include in reply
# (optional)
# (optional)
signer_key = $dir/tsa_key1.pem # The TSA private key (optional)
signer_key = $dir/tsa_key1.pem # The TSA private key (optional)
signer_digest = sha1 # Signing digest to use. (Optional)
default_policy = tsa_policy1 # Policy if request did not specify it
default_policy = tsa_policy1 # Policy if request did not specify it
# (optional)
# (optional)
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
...
@@ -156,7 +156,7 @@ signer_cert = $dir/tsa_cert2.pem # The TSA signing certificate
...
@@ -156,7 +156,7 @@ signer_cert = $dir/tsa_cert2.pem # The TSA signing certificate
certs = $dir/demoCA/cacert.pem# Certificate chain to include in reply
certs = $dir/demoCA/cacert.pem# Certificate chain to include in reply
# (optional)
# (optional)
signer_key = $dir/tsa_key2.pem # The TSA private key (optional)
signer_key = $dir/tsa_key2.pem # The TSA private key (optional)
signer_digest = sha1 # Signing digest to use. (Optional)
default_policy = tsa_policy1 # Policy if request did not specify it
default_policy = tsa_policy1 # Policy if request did not specify it
# (optional)
# (optional)
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录