Beispiel #1
0
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]
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
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
Beispiel #5
0
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
Beispiel #6
0
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]
Beispiel #7
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]