def main():
    groupObj = ECGroup(prime192v1)
    pkenc = CS98(groupObj)
    hyenc = HybridEnc(pkenc)

    (pk, sk) = hyenc.keygen()

    m = b'this is a new message'
    cipher = hyenc.encrypt(pk, m)
    orig_m = hyenc.decrypt(pk, sk, cipher)
    assert m == orig_m, "Failed Decryption"
    if debug: print("Successful Decryption!!")
示例#2
0
    def testEC_CS98(self):
        groupObj = ECGroup(prime192v1)
        pkenc = CS98(groupObj)

        (pk, sk) = pkenc.keygen()

        # message len should be group.bitsize() len for prime192v1 (or 20 bytes)
        M = b'the hello world msg1'
        ciphertext = pkenc.encrypt(pk, M)
        message = pkenc.decrypt(pk, sk, ciphertext)

        assert M == message, "Failed Decryption!!!"
        if debug: print("SUCCESSFUL DECRYPTION!!! => %s" % message)
示例#3
0
    def testEC_CS98(self):
        groupObj = ECGroup(prime192v1)
        pkenc = CS98(groupObj)

        (pk, sk) = pkenc.keygen()
        M = b"hello world!!!"

        ciphertext = pkenc.encrypt(pk, M)

        message = pkenc.decrypt(pk, sk, ciphertext)

        assert M == message, "Failed Decryption!!!"
        if debug: print("SUCCESSFUL DECRYPTION!!! => %s" % message)
示例#4
0
    def testCS98(self):
        p = integer(
            156053402631691285300957066846581395905893621007563090607988086498527791650834395958624527746916581251903190331297268907675919283232442999706619659475326192111220545726433895802392432934926242553363253333261282122117343404703514696108330984423475697798156574052962658373571332699002716083130212467463571362679
        )
        q = integer(
            78026701315845642650478533423290697952946810503781545303994043249263895825417197979312263873458290625951595165648634453837959641616221499853309829737663096055610272863216947901196216467463121276681626666630641061058671702351757348054165492211737848899078287026481329186785666349501358041565106233731785681339
        )
        groupObj = IntegerGroup()
        pkenc = CS98(groupObj, p, q)

        (pk, sk) = pkenc.keygen(1024)
        M = b"hello world. test message"
        ciphertext = pkenc.encrypt(pk, M)

        message = pkenc.decrypt(pk, sk, ciphertext)

        assert M == message, "UNSUCCESSFUL!!!! :-( why?"
        if debug: print("SUCCESSFULLY RECOVERED => %s" % message)
示例#5
0
from pre_mg07a_jet import PreGA


from ible import ible


    
###################################################

debug = True

# Message size := secparam / 8 (byte)
#group = PairingGroup('SS512', secparam=1024)
group = PairingGroup('SS512')
groupcs98 = ECGroup(prime192v2)
pkenc = CS98(groupcs98)

# Create pre cipher: __init__
pre = PreGA(group, pkenc)
# PRE SETUP
(msk, params) = pre.setup()
    
# Extarct the Sym key: bytes
#SymKey = extract_key(group.random(GT))

k = 'k' * 16  # 128 bits
SymKey = k.encode('utf-8')

# ID
ID = "*****@*****.**"