Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
a88e6a4c
Commit
a88e6a4c
authored
8 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
crypto: make CRL default expiration same as certificate
parent
c776dad9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/opendht/crypto.h
+3
-1
3 additions, 1 deletion
include/opendht/crypto.h
src/crypto.cpp
+2
-2
2 additions, 2 deletions
src/crypto.cpp
with
5 additions
and
3 deletions
include/opendht/crypto.h
+
3
−
1
View file @
a88e6a4c
...
@@ -333,6 +333,7 @@ class OPENDHT_PUBLIC RevocationList
...
@@ -333,6 +333,7 @@ class OPENDHT_PUBLIC RevocationList
{
{
using
clock
=
std
::
chrono
::
system_clock
;
using
clock
=
std
::
chrono
::
system_clock
;
using
time_point
=
clock
::
time_point
;
using
time_point
=
clock
::
time_point
;
using
duration
=
clock
::
duration
;
public:
public:
RevocationList
();
RevocationList
();
RevocationList
(
const
Blob
&
b
);
RevocationList
(
const
Blob
&
b
);
...
@@ -365,8 +366,9 @@ public:
...
@@ -365,8 +366,9 @@ public:
/**
/**
* Sign this revocation list using provided key and certificate.
* Sign this revocation list using provided key and certificate.
* Validity_period sets the duration until expiration (default to certificate expiration).
*/
*/
void
sign
(
const
PrivateKey
&
,
const
Certificate
&
);
void
sign
(
const
PrivateKey
&
,
const
Certificate
&
,
duration
validity_period
=
{}
);
void
sign
(
const
Identity
&
id
)
{
sign
(
*
id
.
first
,
*
id
.
second
);
}
void
sign
(
const
Identity
&
id
)
{
sign
(
*
id
.
first
,
*
id
.
second
);
}
bool
isSignedBy
(
const
Certificate
&
issuer
)
const
;
bool
isSignedBy
(
const
Certificate
&
issuer
)
const
;
...
...
This diff is collapsed.
Click to expand it.
src/crypto.cpp
+
2
−
2
View file @
a88e6a4c
...
@@ -976,12 +976,12 @@ T endian(T w, Endian endian = Endian::BIG)
...
@@ -976,12 +976,12 @@ T endian(T w, Endian endian = Endian::BIG)
}
}
void
void
RevocationList
::
sign
(
const
PrivateKey
&
key
,
const
Certificate
&
ca
)
RevocationList
::
sign
(
const
PrivateKey
&
key
,
const
Certificate
&
ca
,
duration
validity
)
{
{
if
(
auto
err
=
gnutls_x509_crl_set_version
(
crl
,
2
))
if
(
auto
err
=
gnutls_x509_crl_set_version
(
crl
,
2
))
throw
CryptoException
(
std
::
string
(
"Can't set CRL version: "
)
+
gnutls_strerror
(
err
));
throw
CryptoException
(
std
::
string
(
"Can't set CRL version: "
)
+
gnutls_strerror
(
err
));
auto
now
=
std
::
chrono
::
system_clock
::
now
();
auto
now
=
std
::
chrono
::
system_clock
::
now
();
auto
next_update
=
now
+
std
::
chrono
::
hours
(
24
*
7
)
;
auto
next_update
=
(
validity
==
duration
{})
?
ca
.
getExpiration
()
:
now
+
validity
;
if
(
auto
err
=
gnutls_x509_crl_set_this_update
(
crl
,
std
::
chrono
::
system_clock
::
to_time_t
(
now
)))
if
(
auto
err
=
gnutls_x509_crl_set_this_update
(
crl
,
std
::
chrono
::
system_clock
::
to_time_t
(
now
)))
throw
CryptoException
(
std
::
string
(
"Can't set CRL update time: "
)
+
gnutls_strerror
(
err
));
throw
CryptoException
(
std
::
string
(
"Can't set CRL update time: "
)
+
gnutls_strerror
(
err
));
if
(
auto
err
=
gnutls_x509_crl_set_next_update
(
crl
,
std
::
chrono
::
system_clock
::
to_time_t
(
next_update
)))
if
(
auto
err
=
gnutls_x509_crl_set_next_update
(
crl
,
std
::
chrono
::
system_clock
::
to_time_t
(
next_update
)))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment