Example #1
0
def main():
    global group
    group = PairingGroup(secparam)

    alphabet = ['a', 'b']
    dfa = DFA("ab*a", alphabet)
    builtinFuncs_dfa.DFAObj = dfa
    dfaM = dfa.constructDFA()

    (mpk, msk) = setup(alphabet)

    (blindingFactor0Blinded, skBlinded) = keygen(mpk, msk, dfaM)
    w = dfa.getSymbols("abba")
    M = group.random(GT)
    print("M :", M)
    ct = encrypt(mpk, w, M)

    transformOutputList = transform(skBlinded, ct)
    origM = decout(skBlinded, ct, transformOutputList, blindingFactor0Blinded, blindingFactorKendList1Blinded)



    print("rec M :", origM)
    assert M == origM, "failed decryption"
    print("SUCCESSFUL DECRYPTION!!!") 
Example #2
0
def main():
    global group
    group = PairingGroup("SS512")

    alphabet = ['a', 'b']
    dfa = DFA("ab*a", alphabet)
    builtinFuncs_dfa.DFAObj = dfa
    dfaM = dfa.constructDFA()

    (mpk, msk) = setup(alphabet)

    Q, S, T, q0, F = dfaM

    (blindingFactor0Blinded, skBlinded) = keygen(mpk, msk, Q, T, F)
    w = dfa.getSymbols("abbba")
    M = group.random(GT)
    print("M :", M)
    ct = encrypt(mpk, w, M)

    (transformOutputList, Ti) = transform(skBlinded, ct, dfaM)
    origM = decout(transformOutputList, blindingFactor0Blinded, Ti, dfaM)


    print("rec M :", origM)
    assert M == origM, "failed decryption"
    print("SUCCESSFUL DECRYPTION!!!") 
Example #3
0
def main():
    global group
    #group = PairingGroup(secparam)
    group = PairingGroup("SS512")

    alphabet = ['a', 'b']
    dfa = DFA("ab*a", alphabet)
    builtinFuncs_dfa.DFAObj = dfa
    dfaM = dfa.constructDFA()

    (mpk, msk) = setup(alphabet)

    Q, S, T, q0, F = dfaM

    (blindingFactor0Blinded, skBlinded) = keygen(mpk, msk, Q, T, F)
    w = dfa.getSymbols("abbba")
    M = group.random(GT)
    print("M :", M)
    ct = encrypt(mpk, w, M)

    (transformOutputList, l, Ti, transformOutputListForLoop) = transform(skBlinded, ct, dfaM)
    origM = decout(dfaM, transformOutputList, blindingFactor0Blinded, l, Ti, transformOutputListForLoop)


    print("rec M :", origM)
    assert M == origM, "failed decryption"
    print("SUCCESSFUL DECRYPTION!!!") 
Example #4
0
def main():
    global group
    group = PairingGroup("SS512")

    alphabet = {'a', 'b'}
    dfa = DFA("ab*a", alphabet)
    dfaM = dfa.constructDFA()

    fe = FE_DFA(group, dfa)

    (mpk, msk) = fe.setup(alphabet)
    if debug: print("mpk :=>", mpk, "\n\n")

    sk = fe.keygen(mpk, msk, dfaM)
    if debug: print("sk :=>", sk)

    w = dfa.getSymbols("abba")
    w1 = dfa.getSymbols("aba")
    M = group.random(GT)
    ct = fe.encrypt(mpk, w, M)

    # Explicitly override the string with another valid string
    ct[1] = w1
    print w1 == w

    origM = fe.decrypt(sk, ct)
    assert M == origM, "failed decryption!"
    if debug: print("Successful Decryption!!!!!")
Example #5
0
def main():
    global group
    group = PairingGroup(secparam)

    alphabet = ['a', 'b']
    dfa = DFA("ab*a", alphabet)
    builtinFuncs_dfa.DFAObj = dfa
    dfaM = dfa.constructDFA()

    (mpk, msk) = setup(alphabet)

    sk = keygen(mpk, msk, dfaM)
    w = dfa.getSymbols("abba")
    M = group.random(GT)
    print("M :", M)
    ct = encrypt(mpk, w, M)

    origM = decrypt(sk, ct)
    print("rec M :", origM)
    assert M == origM, "failed decryption"
    print("SUCCESSFUL DECRYPTION!!!") 
Example #6
0
def main():
    global group
    group = PairingGroup(secparam)

    alphabet = ['a', 'b']
    dfa = DFA("ab*a", alphabet)
    builtinFuncs_dfa.DFAObj = dfa
    dfaM = dfa.constructDFA()

    (mpk, msk) = setup(alphabet)

    sk = keygen(mpk, msk, dfaM)
    w = dfa.getSymbols("abba")
    M = group.random(GT)
    print("M :", M)
    ct = encrypt(mpk, w, M)

    origM = decrypt(sk, ct)
    print("rec M :", origM)
    assert M == origM, "failed decryption"
    print("SUCCESSFUL DECRYPTION!!!")
Example #7
0
def main():
    global group
    group = PairingGroup("SS512")
    
    alphabet = {'a', 'b'}
    dfa = DFA("ab*a", alphabet)
    dfaM = dfa.constructDFA()
    
    fe = FE_DFA(group, dfa)
    
    (mpk, msk) = fe.setup(alphabet)
    if debug: print("mpk :=>", mpk, "\n\n")
    
    sk = fe.keygen(mpk, msk, dfaM)
    if debug: print("sk :=>", sk)
    
    w = dfa.getSymbols("abba")
    M = group.random(GT)
    ct = fe.encrypt(mpk, w, M)
    
    origM = fe.decrypt(sk, ct)
    assert M == origM, "failed decryption!"
    if debug: print("Successful Decryption!!!!!")