Commit 1a03a2b2 authored by zhifan huang's avatar zhifan huang

docs: add coment in test.tool

parent 304784ba
......@@ -104,10 +104,17 @@ def create_ca_file(pkey_file, cert_file, serial=0x120010db80042):
def prefix2cn(prefix):
""" prefix binary format
cn, common name, serial/length
"""
return "%u/%u" % (int(prefix, 2), len(prefix))
def serial2prefix(serial):
return bin(serial)[2:].rjust(16, '0')
def serial2prefix(serial, length = 16):
"""serial, decimal of prefix
prefix binary
"""
# return bin(serial)[2:].rjust(16, '0')
return "{:0{}b}".format(serial, length)
# pkey: private key
def decrypt(pkey, incontent):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment