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
6a44dab6
Commit
6a44dab6
authored
Jul 3, 2015
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
crypto: add doc
parent
7959fe3d
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
+21
-2
21 additions, 2 deletions
include/opendht/crypto.h
with
21 additions
and
2 deletions
include/opendht/crypto.h
+
21
−
2
View file @
6a44dab6
...
...
@@ -57,11 +57,16 @@ class CryptoException : public std::runtime_error {
/**
* Generate an RSA key pair (2048 bits) and a certificate.
* If a certificate authority (ca) is provided, it will be used to
* sign the certificate, otherwise the certificate will be self-signed.
* @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 provste key (bits).
*/
Identity
generateIdentity
(
const
std
::
string
&
name
=
"dhtnode"
,
Identity
ca
=
{},
unsigned
key_length
=
4096
);
/**
* A public key.
*/
struct
PublicKey
:
public
Serializable
{
PublicKey
()
{}
...
...
@@ -88,6 +93,9 @@ private:
PublicKey
&
operator
=
(
const
PublicKey
&
)
=
delete
;
};
/**
* A private key, including the corresponding public key.
*/
struct
PrivateKey
{
PrivateKey
();
...
...
@@ -101,7 +109,18 @@ struct PrivateKey
operator
bool
()
const
{
return
key
;
}
PublicKey
getPublicKey
()
const
;
Blob
serialize
(
const
std
::
string
&
password
=
{})
const
;
/**
* Sign the provided binary object.
* @returns the signed data.
*/
Blob
sign
(
const
Blob
&
)
const
;
/**
* Try to decrypt the provided cypher text.
* In case of failure a CryptoException is thrown.
* @returns the decrypted data.
*/
Blob
decrypt
(
const
Blob
&
cypher
)
const
;
/**
...
...
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