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
8e28e86c
Commit
8e28e86c
authored
8 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
python: improve wrapper for crypto::Certificate
Add Certificate issuer, getName and revoke
parent
65de9622
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/opendht.pyx
+11
-2
11 additions, 2 deletions
python/opendht.pyx
python/opendht_cpp.pxd
+3
-0
3 additions, 0 deletions
python/opendht_cpp.pxd
with
14 additions
and
2 deletions
python/opendht.pyx
+
11
−
2
View file @
8e28e86c
...
...
@@ -278,13 +278,22 @@ cdef class Certificate(_WithID):
return
h
def
toString
(
self
):
return
self
.
_cert
.
get
().
toString
().
decode
()
def
getName
(
self
):
return
self
.
_cert
.
get
().
getName
()
def
revoke
(
self
,
PrivateKey
k
,
Certificate
c
):
self
.
_cert
.
get
().
revoke
(
k
.
_key
,
deref
(
c
.
_cert
.
get
()));
def
__bytes__
(
self
):
return
self
.
_cert
.
get
().
toString
()
if
self
.
_cert
else
b
''
property
issuer
:
def
__get__
(
self
):
c
=
Certificate
()
c
.
_cert
=
self
.
_cert
.
get
().
issuer
return
c
;
@staticmethod
def
generate
(
PrivateKey
k
,
str
name
,
Identity
i
=
Identity
(),
bool
is_ca
=
False
):
c
=
Certificate
()
c
.
_cert
=
cpp
.
make_shared
[
cpp
.
Certificate
](
cpp
.
Certificate
.
generate
(
k
.
_key
,
name
.
encode
(),
i
.
_id
,
is_ca
))
return
c
def
__bytes__
(
self
):
return
self
.
_cert
.
get
().
toString
()
if
self
.
_cert
else
b
''
cdef
class
ListenToken
(
object
):
cdef
cpp
.
InfoHash
_h
...
...
This diff is collapsed.
Click to expand it.
python/opendht_cpp.pxd
+
3
−
0
View file @
8e28e86c
...
...
@@ -96,8 +96,11 @@ cdef extern from "opendht/crypto.h" namespace "dht::crypto":
Certificate
(
string
pem
)
InfoHash
getId
()
const
string
toString
()
const
string
getName
()
const
void
revoke
(
PrivateKey
key
,
Certificate
cert
)
@staticmethod
Certificate
generate
(
PrivateKey
key
,
string
name
,
Identity
ca
,
bool
is_ca
)
shared_ptr
[
Certificate
]
issuer
cdef
extern
from
"
opendht/value.h
"
namespace
"
dht
"
:
cdef
cppclass
Value
:
...
...
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