def RSAdecodeSign(filename): # type: (filename) -> (n, sign) integers = [] # list of integers in ASN.1 file with open(filename, "rb") as file: data = file.read() decoder = asn1.Decoder() decoder.start(data) integers = parse(decoder, integers) return integers[0], integers[2]
def ELGdecodeSign(filename): # type: (filename) -> (b, p, r, a, w, s) integers = [] # list of integers in ASN.1 file with open(filename, "rb") as file: data = file.read() decoder = asn1.Decoder() decoder.start(data) integers = parse(decoder, integers) return integers
def MOdecodeMessage(data): # type: (data) -> (len, encrypted) integers = [] # list of integers in ASN.1 file decoder = asn1.Decoder() decoder.start(data) integers = parse(decoder, integers) cipher = data[ -integers[-1]:] # get last integrs[last] symbols, this is ciphertext return integers[0], cipher
def RSAdecode(filename): # type: (filename) -> (n, e, c, ciphertext) integers = [] # list of integers in ASN.1 file with open(filename, "rb") as file: data = file.read() decoder = asn1.Decoder() decoder.start(data) integers = parse(decoder, integers) cipher = data[-integers[ -1]:] # get last integrs[last] symbols, this is ciphertext return integers[0], integers[1], integers[2], cipher
def GOSTdecodeSign( filename ): # type: (filename) -> (xq, yq, prime, A, B, xp, yp, q, r, s) integers = [] # list of integers in ASN.1 file with open(filename, "rb") as file: data = file.read() decoder = asn1.Decoder() decoder.start(data) integers = parse(decoder, integers) return integers
def MOdecodeResponse(data): # type: (data) -> t_ab integers = [] # list of integers in ASN.1 file decoder = asn1.Decoder() decoder.start(data) integers = parse(decoder, integers) return integers[0]
def MOdecodeParams(data): # type: (data) -> (p, r, t_a) integers = [] # list of integers in ASN.1 file decoder = asn1.Decoder() decoder.start(data) integers = parse(decoder, integers) return integers[0], integers[1], integers[2]