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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
db5cac45
Commit
db5cac45
authored
9 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
crypto: avoid forward declarations
parent
1c8735e7
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/opendht/crypto.h
+13
-17
13 additions, 17 deletions
include/opendht/crypto.h
with
13 additions
and
17 deletions
include/opendht/crypto.h
+
13
−
17
View file @
db5cac45
...
...
@@ -34,11 +34,6 @@ extern "C" {
namespace
dht
{
namespace
crypto
{
struct
PrivateKey
;
struct
Certificate
;
typedef
std
::
pair
<
std
::
shared_ptr
<
PrivateKey
>
,
std
::
shared_ptr
<
Certificate
>>
Identity
;
class
CryptoException
:
public
std
::
runtime_error
{
public:
CryptoException
(
const
std
::
string
&
str
)
:
std
::
runtime_error
(
str
)
{};
...
...
@@ -52,15 +47,6 @@ class DecryptError : public CryptoException {
DecryptError
(
const
std
::
string
&
str
=
""
)
:
CryptoException
(
str
)
{};
};
/**
* Generate an RSA key pair (4096 bits) and a certificate.
* @param name the name used in the generated certificate
* @param ca if set, the certificate authority that will sign the generated certificate.
* If not set, the generated certificate will be a self-signed CA.
* @param key_length stength of the generated private key (bits).
*/
Identity
generateIdentity
(
const
std
::
string
&
name
=
"dhtnode"
,
Identity
ca
=
{},
unsigned
key_length
=
4096
);
/**
* A public key.
*/
...
...
@@ -155,7 +141,7 @@ private:
PrivateKey
&
operator
=
(
const
PrivateKey
&
)
=
delete
;
Blob
decryptBloc
(
const
uint8_t
*
src
,
size_t
src_size
)
const
;
friend
dht
::
crypto
::
Identity
dht
::
crypto
::
generateIdentity
(
const
std
::
string
&
,
dht
::
crypto
::
Identity
,
unsigned
key_length
);
//
friend dht::crypto::Identity dht::crypto::generateIdentity(const std::string&, dht::crypto::Identity, unsigned key_length);
};
struct
Certificate
{
...
...
@@ -311,10 +297,20 @@ struct Certificate {
private
:
Certificate
(
const
Certificate
&
)
=
delete
;
Certificate
&
operator
=
(
const
Certificate
&
)
=
delete
;
friend
dht
::
crypto
::
Identity
dht
::
crypto
::
generateIdentity
(
const
std
::
string
&
,
dht
::
crypto
::
Identity
,
unsigned
key_length
);
};
using
Identity
=
std
::
pair
<
std
::
shared_ptr
<
PrivateKey
>
,
std
::
shared_ptr
<
Certificate
>>
;
/**
* Generate an RSA key pair (4096 bits) and a certificate.
* @param name the name used in the generated certificate
* @param ca if set, the certificate authority that will sign the generated certificate.
* If not set, the generated certificate will be a self-signed CA.
* @param key_length stength of the generated private key (bits).
*/
Identity
generateIdentity
(
const
std
::
string
&
name
=
"dhtnode"
,
Identity
ca
=
{},
unsigned
key_length
=
4096
);
Blob
hash
(
const
Blob
&
data
);
/**
...
...
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