Пример #1
0
def _3user():
    pA, eA = _pyecc.dh1(u'p521')
    print "A public:    \t%s\nA exp:    \t%s" % (pA, eA)

    pB, eB = _pyecc.dh1(u'p521')
    print "B public:    \t%s\nB exp:    \t%s" % (pB, eB)

    pC, eC = _pyecc.dh1(u'p521')
    print "C public:    \t%s\nC exp:    \t%s" % (pC, eC)

    print
    pAB = _pyecc.dhn(pA, eB, 'p521')
    print "public AB", pAB
    pBA = _pyecc.dhn(pB, eA, 'p521')
    print "public BA", pBA
    pCA = _pyecc.dhn(pC, eA, 'p521')
    print "public CA", pCA

    print
    key, verification = _pyecc.dh3(pCA, eB, u'p521')
    print "key:    \t%s\nverification:\t%s" % (key, verification)
    key, verification = _pyecc.dh3(pBA, eC, u'p521')
    print "key:    \t%s\nverification:\t%s" % (key, verification)
    key, verification = _pyecc.dh3(pAB, eC, u'p521')
    print "key:    \t%s\nverification:\t%s" % (key, verification)
Пример #2
0
def _3user():
    pA, eA = _pyecc.dh1(u'p521')
    print "A public:    \t%s\nA exp:    \t%s" % (pA, eA)

    pB, eB = _pyecc.dh1(u'p521')
    print "B public:    \t%s\nB exp:    \t%s" % (pB, eB)

    pC, eC = _pyecc.dh1(u'p521')
    print "C public:    \t%s\nC exp:    \t%s" % (pC, eC)

    print
    pAB = _pyecc.dhn(pA, eB, 'p521')
    print "public AB", pAB
    pBA = _pyecc.dhn(pB, eA, 'p521')
    print "public BA", pBA
    pCA = _pyecc.dhn(pC, eA, 'p521')
    print "public CA", pCA

    print
    key, verification = _pyecc.dh3(pCA, eB, u'p521')
    print "key:    \t%s\nverification:\t%s" % (key, verification)
    key, verification = _pyecc.dh3(pBA, eC, u'p521')
    print "key:    \t%s\nverification:\t%s" % (key, verification)
    key, verification = _pyecc.dh3(pAB, eC, u'p521')
    print "key:    \t%s\nverification:\t%s" % (key, verification)
Пример #3
0
def _2user():
    # 1st user
    public, exp = _pyecc.dh1(u'p521')
    print "public:    \t%s\nexp:    \t%s" % (public, exp)
    print
    # 2nd user
    public, key, verification = _pyecc.dh2(public, u'p521')
    print "public:    \t%s\nkey:    \t%s\nverification:\t%s" % (public, key, verification)
    print
    # 1st user completing DH
    key, verification = _pyecc.dh3(public, exp, u'p521')
    print "key:    \t%s\nverification:\t%s" % (key, verification)
Пример #4
0
def _2user():
    # 1st user
    public, exp = _pyecc.dh1(u'p521')
    print "public:    \t%s\nexp:    \t%s" % (public, exp)
    print
    # 2nd user
    public, key, verification = _pyecc.dh2(public, u'p521')
    print "public:    \t%s\nkey:    \t%s\nverification:\t%s" % (public, key,
                                                                verification)
    print
    # 1st user completing DH
    key, verification = _pyecc.dh3(public, exp, u'p521')
    print "key:    \t%s\nverification:\t%s" % (key, verification)
Пример #5
0
 def __init__(self, curve="p521"):
     self.curve=curve
     self.key=None
     self.verify=None
     self.public, self.exp = _pyecc.dh1(curve)
Пример #6
0
def wrongkey():
    print "fail wrong key"
    public, exp = _pyecc.dh1(u'p521')
    public, key, verification = _pyecc.dh2('x' * len(public), u'p521')
Пример #7
0
def shortkey():
    print "fail short key"
    public, exp = _pyecc.dh1(u'p521')
    public, key, verification = _pyecc.dh2(public[:-1], u'p521')
Пример #8
0
 def __init__(self, curve="p521"):
     self.curve = curve
     self.key = None
     self.verify = None
     self.public, self.exp = _pyecc.dh1(curve)
Пример #9
0
def wrongkey():
    print "fail wrong key"
    public, exp = _pyecc.dh1(u'p521')
    public, key, verification = _pyecc.dh2('x' * len(public), u'p521')
Пример #10
0
def shortkey():
    print "fail short key"
    public, exp = _pyecc.dh1(u'p521')
    public, key, verification = _pyecc.dh2(public[:-1], u'p521')