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
aa5b8b84
Commit
aa5b8b84
authored
8 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
python: add TrustList wrapper
parent
d0a8a92a
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
python/opendht.pyx
+18
-0
18 additions, 0 deletions
python/opendht.pyx
python/opendht_cpp.pxd
+12
-0
12 additions, 0 deletions
python/opendht_cpp.pxd
with
30 additions
and
0 deletions
python/opendht.pyx
+
18
−
0
View file @
aa5b8b84
...
...
@@ -318,6 +318,24 @@ cdef class Certificate(_WithID):
c
.
_cert
=
cpp
.
make_shared
[
cpp
.
Certificate
](
cpp
.
Certificate
.
generate
(
deref
(
k
.
_key
.
get
()),
name
.
encode
(),
i
.
_id
,
is_ca
))
return
c
cdef
class
VerifyResult
(
object
):
cdef
cpp
.
TrustListVerifyResult
_result
def
__bool__
(
self
):
return
self
.
_result
.
isValid
()
def
__str
(
self
):
return
self
.
_result
.
toString
()
cdef
class
TrustList
(
object
):
cdef
cpp
.
TrustList
_trust
def
add
(
self
,
Certificate
cert
):
self
.
_trust
.
add
(
deref
(
cert
.
_cert
.
get
()))
def
remove
(
self
,
Certificate
cert
):
self
.
_trust
.
remove
(
deref
(
cert
.
_cert
.
get
()))
def
verify
(
self
,
Certificate
cert
):
r
=
VerifyResult
()
r
.
_result
=
self
.
_trust
.
verify
(
deref
(
cert
.
_cert
.
get
()))
return
r
cdef
class
ListenToken
(
object
):
cdef
cpp
.
InfoHash
_h
cdef
cpp
.
shared_future
[
size_t
]
_t
...
...
This diff is collapsed.
Click to expand it.
python/opendht_cpp.pxd
+
12
−
0
View file @
aa5b8b84
...
...
@@ -108,6 +108,18 @@ cdef extern from "opendht/crypto.h" namespace "dht::crypto":
Certificate
generate
(
PrivateKey
key
,
string
name
,
Identity
ca
,
bool
is_ca
)
shared_ptr
[
Certificate
]
issuer
cdef
cppclass
TrustList
:
cppclass
VerifyResult
:
bool
operator
bool
()
const
bool
isValid
()
const
string
toString
()
const
TrustList
()
void
add
(
Certificate
)
void
remove
(
Certificate
)
VerifyResult
verify
(
Certificate
);
ctypedef
TrustList
.
VerifyResult
TrustListVerifyResult
cdef
extern
from
"
opendht/value.h
"
namespace
"
dht
"
:
cdef
cppclass
Value
:
Value
()
except
+
...
...
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