Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
dc047d31
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dc047d31
编写于
8月 19, 2016
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Set certificate times in one function.
Reviewed-by:
N
Rich Salz
<
rsalz@openssl.org
>
上级
3a60d6fa
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
23 deletion
+44
-23
apps/apps.c
apps/apps.c
+34
-0
apps/apps.h
apps/apps.h
+2
-0
apps/ca.c
apps/ca.c
+3
-8
apps/req.c
apps/req.c
+1
-3
apps/x509.c
apps/x509.c
+4
-12
未找到文件。
apps/apps.c
浏览文件 @
dc047d31
...
...
@@ -2589,3 +2589,37 @@ void corrupt_signature(const ASN1_STRING *signature)
unsigned
char
*
s
=
signature
->
data
;
s
[
signature
->
length
-
1
]
^=
0x1
;
}
int
set_cert_times
(
X509
*
x
,
const
char
*
startdate
,
const
char
*
enddate
,
int
days
)
{
int
rv
=
0
;
ASN1_TIME
*
tm
=
ASN1_TIME_new
();
if
(
tm
==
NULL
)
goto
err
;
if
(
startdate
==
NULL
||
strcmp
(
startdate
,
"today"
)
==
0
)
{
if
(
!
X509_gmtime_adj
(
tm
,
0
))
goto
err
;
}
else
if
(
!
ASN1_TIME_set_string
(
tm
,
startdate
))
{
goto
err
;
}
if
(
!
X509_set_notBefore
(
x
,
tm
))
goto
err
;
if
(
enddate
==
NULL
)
{
if
(
!
X509_time_adj_ex
(
tm
,
days
,
0
,
NULL
))
goto
err
;
}
else
if
(
!
ASN1_TIME_set_string
(
tm
,
enddate
))
{
goto
err
;
}
if
(
!
X509_set_notAfter
(
x
,
tm
))
goto
err
;
rv
=
1
;
err:
ASN1_TIME_free
(
tm
);
return
rv
;
}
apps/apps.h
浏览文件 @
dc047d31
...
...
@@ -72,6 +72,8 @@ int has_stdin_waiting(void);
# endif
void
corrupt_signature
(
const
ASN1_STRING
*
signature
);
int
set_cert_times
(
X509
*
x
,
const
char
*
startdate
,
const
char
*
enddate
,
int
days
);
/*
* Common verification options.
...
...
apps/ca.c
浏览文件 @
dc047d31
...
...
@@ -1698,16 +1698,11 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
goto
end
;
}
if
(
strcmp
(
startdate
,
"today"
)
==
0
)
X509_gmtime_adj
(
X509_get_notBefore
(
ret
),
0
);
else
ASN1_TIME_set_string
(
X509_get_notBefore
(
ret
),
startdate
);
if
(
!
set_cert_times
(
ret
,
startdate
,
enddate
,
days
))
goto
end
;
if
(
enddate
==
NULL
)
X509_time_adj_ex
(
X509_get_notAfter
(
ret
),
days
,
0
,
NULL
);
else
{
if
(
enddate
!=
NULL
)
{
int
tdays
;
ASN1_TIME_set_string
(
X509_get_notAfter
(
ret
),
enddate
);
ASN1_TIME_diff
(
&
tdays
,
NULL
,
NULL
,
X509_get_notAfter
(
ret
));
days
=
tdays
;
}
...
...
apps/req.c
浏览文件 @
dc047d31
...
...
@@ -616,9 +616,7 @@ int req_main(int argc, char **argv)
if
(
!
X509_set_issuer_name
(
x509ss
,
X509_REQ_get_subject_name
(
req
)))
goto
end
;
if
(
!
X509_gmtime_adj
(
X509_get_notBefore
(
x509ss
),
0
))
goto
end
;
if
(
!
X509_time_adj_ex
(
X509_get_notAfter
(
x509ss
),
days
,
0
,
NULL
))
if
(
!
set_cert_times
(
x509ss
,
NULL
,
NULL
,
days
))
goto
end
;
if
(
!
X509_set_subject_name
(
x509ss
,
X509_REQ_get_subject_name
(
req
)))
...
...
apps/x509.c
浏览文件 @
dc047d31
...
...
@@ -554,9 +554,9 @@ int x509_main(int argc, char **argv)
goto
end
;
if
(
!
X509_set_subject_name
(
x
,
X509_REQ_get_subject_name
(
req
)))
goto
end
;
if
(
!
set_cert_times
(
x
,
NULL
,
NULL
,
days
))
goto
end
;
X509_gmtime_adj
(
X509_get_notBefore
(
x
),
0
);
X509_time_adj_ex
(
X509_get_notAfter
(
x
),
days
,
0
,
NULL
);
if
(
fkey
)
X509_set_pubkey
(
x
,
fkey
);
else
{
...
...
@@ -983,11 +983,7 @@ static int x509_certify(X509_STORE *ctx, const char *CAfile, const EVP_MD *diges
if
(
!
X509_set_serialNumber
(
x
,
bs
))
goto
end
;
if
(
X509_gmtime_adj
(
X509_get_notBefore
(
x
),
0L
)
==
NULL
)
goto
end
;
/* hardwired expired */
if
(
X509_time_adj_ex
(
X509_get_notAfter
(
x
),
days
,
0
,
NULL
)
==
NULL
)
if
(
!
set_cert_times
(
x
,
NULL
,
NULL
,
days
))
goto
end
;
if
(
clrext
)
{
...
...
@@ -1056,12 +1052,8 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext,
if
(
!
X509_set_issuer_name
(
x
,
X509_get_subject_name
(
x
)))
goto
err
;
if
(
X509_gmtime_adj
(
X509_get_notBefore
(
x
),
0
)
==
NULL
)
if
(
!
set_cert_times
(
x
,
NULL
,
NULL
,
days
)
)
goto
err
;
if
(
X509_time_adj_ex
(
X509_get_notAfter
(
x
),
days
,
0
,
NULL
)
==
NULL
)
goto
err
;
if
(
!
X509_set_pubkey
(
x
,
pkey
))
goto
err
;
if
(
clrext
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录