Skip to content
GitLab
Explore
Sign in
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
ad234004
Commit
ad234004
authored
8 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
crypto: store CRLs in a set
parent
a88e6a4c
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
+2
-2
2 additions, 2 deletions
include/opendht/crypto.h
src/crypto.cpp
+15
-3
15 additions, 3 deletions
src/crypto.cpp
with
17 additions
and
5 deletions
include/opendht/crypto.h
+
2
−
2
View file @
ad234004
...
...
@@ -314,7 +314,7 @@ struct OPENDHT_PUBLIC Certificate {
std
::
string
print
()
const
;
void
revoke
(
const
PrivateKey
&
,
const
Certificate
&
);
std
::
vector
<
std
::
shared_ptr
<
RevocationList
>>
getRevocationLists
()
const
{
return
revocation_lists
;
}
std
::
vector
<
std
::
shared_ptr
<
RevocationList
>>
getRevocationLists
()
const
;
void
addRevocationList
(
RevocationList
&&
);
void
addRevocationList
(
std
::
shared_ptr
<
RevocationList
>
);
...
...
@@ -325,7 +325,7 @@ struct OPENDHT_PUBLIC Certificate {
private
:
Certificate
(
const
Certificate
&
)
=
delete
;
Certificate
&
operator
=
(
const
Certificate
&
)
=
delete
;
std
::
vector
<
std
::
shared_ptr
<
RevocationList
>>
revocation_lists
;
std
::
set
<
std
::
shared_ptr
<
RevocationList
>>
revocation_lists
;
};
...
...
This diff is collapsed.
Click to expand it.
src/crypto.cpp
+
15
−
3
View file @
ad234004
...
...
@@ -739,8 +739,8 @@ void
Certificate
::
revoke
(
const
PrivateKey
&
key
,
const
Certificate
&
to_revoke
)
{
if
(
revocation_lists
.
empty
())
revocation_lists
.
emplace
_back
(
std
::
make_shared
<
RevocationList
>
());
auto
&
list
=
*
revocation_lists
.
b
ack
(
);
revocation_lists
.
emplace
(
std
::
make_shared
<
RevocationList
>
());
auto
&
list
=
*
(
*
revocation_lists
.
b
egin
()
);
list
.
revoke
(
to_revoke
);
list
.
sign
(
key
,
*
this
);
}
...
...
@@ -754,9 +754,11 @@ Certificate::addRevocationList(RevocationList&& list)
void
Certificate
::
addRevocationList
(
std
::
shared_ptr
<
RevocationList
>
list
)
{
if
(
revocation_lists
.
find
(
list
)
!=
revocation_lists
.
end
())
return
;
// Already in the list
if
(
not
list
->
isSignedBy
(
*
this
))
throw
CryptoException
(
"CRL is not signed by this certificate"
);
revocation_lists
.
emplace
_back
(
std
::
move
(
list
));
revocation_lists
.
emplace
(
std
::
move
(
list
));
}
std
::
chrono
::
system_clock
::
time_point
...
...
@@ -869,6 +871,16 @@ Certificate::generate(const PrivateKey& key, const std::string& name, Identity c
return
ret
;
}
std
::
vector
<
std
::
shared_ptr
<
RevocationList
>>
Certificate
::
getRevocationLists
()
const
{
std
::
vector
<
std
::
shared_ptr
<
RevocationList
>>
ret
;
ret
.
reserve
(
revocation_lists
.
size
());
for
(
const
auto
&
crl
:
revocation_lists
)
ret
.
emplace_back
(
crl
);
return
ret
;
}
RevocationList
::
RevocationList
()
{
gnutls_x509_crl_init
(
&
crl
);
...
...
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