mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-11 15:32:39 +00:00
correct the sample code
This commit is contained in:
parent
00ae3b5663
commit
fb51c1df40
@ -309,11 +309,11 @@ For example::
|
|||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from cryptography.hazmat.primitives.serialization import (
|
from cryptography.hazmat.primitives.serialization import (
|
||||||
Encoding,
|
Encoding,
|
||||||
SubjectPublicKeyInfo,
|
PublicFormat,
|
||||||
)
|
)
|
||||||
from foolscap import base32
|
from foolscap import base32
|
||||||
|
|
||||||
spki_bytes = cert.public_key().public_bytes(DER, SubjectPublicKeyInfo)
|
spki_bytes = cert.public_key().public_bytes(Encoding.DER, PublicFormat.SubjectPublicKeyInfo)
|
||||||
spki_sha256 = sha256(spki_bytes).digest()
|
spki_sha256 = sha256(spki_bytes).digest()
|
||||||
spki_digest32 = base32.encode(spki_sha256)
|
spki_digest32 = base32.encode(spki_sha256)
|
||||||
assert spki_digest32 == tub_id
|
assert spki_digest32 == tub_id
|
||||||
|
Loading…
Reference in New Issue
Block a user