示例#1
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
	global group
	global debug
	group = groupObjParam

	N = len(verifyArgsDict)
	z = 0
	delta = {}
	for z in range(0, N):
		delta[z] = prng_bits(80)

	incorrectIndices = []
	__init__(group)


	for z in range(0, N):
		for arg in verifyFuncArgs:
			if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
				sys.exit("ALERT:  Group membership check failed!!!!\n")

		pass

		c , T1 , T2 , T3= verifyArgsDict[z]['sigma'][bodyKey][ 'c' ] , verifyArgsDict[z]['sigma'][bodyKey][ 'T1' ] , verifyArgsDict[z]['sigma'][bodyKey][ 'T2' ] , verifyArgsDict[z]['sigma'][bodyKey][ 'T3' ]
		salpha , sbeta= verifyArgsDict[z]['sigma'][bodyKey][ 's_alpha' ] , verifyArgsDict[z]['sigma'][bodyKey][ 's_beta' ]
		sx , sgamma1 , sgamma2= verifyArgsDict[z]['sigma'][bodyKey][ 's_x' ] , verifyArgsDict[z]['sigma'][bodyKey][ 's_gamma1' ] , verifyArgsDict[z]['sigma'][bodyKey][ 's_gamma2' ]
		R3= verifyArgsDict[z]['sigma'][bodyKey][ 'R3' ]
		R1=( verifyArgsDict[z]['gpk'][bodyKey][ 'u' ] ** salpha ) *( T1 ** -c )
		R2=( verifyArgsDict[z]['gpk'][bodyKey][ 'v' ] ** sbeta ) *( T2 ** -c )
		R4=( T1 ** sx ) *( verifyArgsDict[z]['gpk'][bodyKey][ 'u' ] ** -sgamma1 )
		R5=( T2 ** sx ) *( verifyArgsDict[z]['gpk'][bodyKey][ 'v' ] ** -sgamma2 )
		if c== group.hash(( verifyArgsDict[z]['M'][bodyKey] , T1 , T2 , T3 , R1 , R2 , R3 , R4 , R5 ) , ZR ) :
			if debug : print( "c=> '%s'" % c )
			if debug : print( "Valid Group Signature for message: '%s'" % verifyArgsDict[z]['M'][bodyKey] )
			pass
		else :
			if debug : print( "Not a valid signature for message!!!" )
			incorrectIndices.append(z)

	z = 0
	startSigNum = 0
	endSigNum = N

	dotA = {}
	dotB = {}
	dotC = {}

	for z in range(0, N):
		c , T1 , T2 , T3= verifyArgsDict[z]['sigma'][bodyKey][ 'c' ] , verifyArgsDict[z]['sigma'][bodyKey][ 'T1' ] , verifyArgsDict[z]['sigma'][bodyKey][ 'T2' ] , verifyArgsDict[z]['sigma'][bodyKey][ 'T3' ]
		salpha , sbeta= verifyArgsDict[z]['sigma'][bodyKey][ 's_alpha' ] , verifyArgsDict[z]['sigma'][bodyKey][ 's_beta' ]
		sx , sgamma1 , sgamma2= verifyArgsDict[z]['sigma'][bodyKey][ 's_x' ] , verifyArgsDict[z]['sigma'][bodyKey][ 's_gamma1' ] , verifyArgsDict[z]['sigma'][bodyKey][ 's_gamma2' ]
		R3= verifyArgsDict[z]['sigma'][bodyKey][ 'R3' ]

		dotA[z] =  ( T3 **( sx * delta [ z ] ) *( verifyArgsDict[z]['gpk'][bodyKey] [ 'h' ] **(( -sgamma1 + -sgamma2 ) * delta [ z ] ) * verifyArgsDict[z]['gpk'][bodyKey] [ 'g1' ] **( -c * delta [ z ] ) ) )  
		dotB[z] =  ( verifyArgsDict[z]['gpk'][bodyKey] [ 'h' ] **(( -salpha + -sbeta ) * delta [ z ] ) * T3 **( c * delta [ z ] ) )  
		dotC[z] =   R3 ** delta [ z ]  

	verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, delta, dotA, dotB, dotC)

	return incorrectIndices
示例#2
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
	global group
	global debug, H1, H2, lam_func
	group = groupObjParam

	N = len(verifyArgsDict)
	z = 0
	l= len( verifyArgsDict[z]['L'][bodyKey] )
	delta = {}
	for z in range(0, N):
		delta[z] = prng_bits(80)

	incorrectIndices = []
	lam_func = lambda i,a,b,c: a[i] * (b[i] ** c[i]) # => u * (pk ** h) for all signers
	H1 = lambda x: group.hash(('1', str(x)), G1)
	H2 = lambda a, b, c: group.hash(('2', a, b, c), ZR)
	__init__(group)


	for z in range(0, N):
		for arg in verifyFuncArgs:
			if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
				sys.exit("ALERT:  Group membership check failed!!!!\n")

		pass

	z = 0
	startSigNum = 0
	endSigNum = N

	dotC = {}
	dotB = {}

	for z in range(0, N):
		u , S= verifyArgsDict[z]['sig'][bodyKey][ 'u' ] , verifyArgsDict[z]['sig'][bodyKey][ 'S' ]

		dotC[z] =   S ** delta [ z ]  
	for z in range(0, N):
		dotA_loopVal = group.init(G1, 1)
		for y in range(0, l):
			u , S= verifyArgsDict[z]['sig'][bodyKey][ 'u' ] , verifyArgsDict[z]['sig'][bodyKey][ 'S' ]
			Lt= concat( verifyArgsDict[z]['L'][bodyKey] )
			l= len( verifyArgsDict[z]['L'][bodyKey] )
			h= [ group.init( ZR , 1 ) for i in range( l ) ]
			for i in range( l ) :
				pass
				h [ i ]= H2( verifyArgsDict[z]['M'][bodyKey] , Lt , u [ i ] )
			pk= [ H1( i ) for i in verifyArgsDict[z]['L'][bodyKey] ] # get all signers pub keys

			dotA_loopVal = dotA_loopVal *  ( u [ y ] * pk [ y ] ** h [ y ] )  

		dotB[z] =   dotA_loopVal ** delta [ z ]  

	verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, delta, dotC, dotB)

	return incorrectIndices
示例#3
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
    global group
    global lam_func, hashObj, debug
    group = groupObjParam

    N = len(verifyArgsDict)
    z = 0
    l = 5
    delta = {}
    for z in range(0, N):
        delta[z] = prng_bits(80)

    incorrectIndices = []
    lam_func = lambda i, a, b: a[i]**b[i]
    __init__(group)

    for z in range(0, N):
        for arg in verifyFuncArgs:
            if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
                sys.exit("ALERT:  Group membership check failed!!!!\n")

        pass

    z = 0
    startSigNum = 0
    endSigNum = N

    dotA = {}
    dotB = {}
    dotD = {}
    sumE = {}

    A, g2 = verifyArgsDict[z]['mpk'][bodyKey]['A'], verifyArgsDict[z]['mpk'][
        bodyKey]['g2']

    for z in range(0, N):
        (S1, S2, S3) = verifyArgsDict[z]['sig'][bodyKey]['S1'], verifyArgsDict[
            z]['sig'][bodyKey]['S2'], verifyArgsDict[z]['sig'][bodyKey]['S3']

        dotA[z] = S1**delta[z]
        dotB[z] = S2**delta[z]
        dotD[z] = S3**delta[z]
        sumE[z] = delta[z]

    verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, A,
                        delta, dotA, dotB, dotD, sumE)

    return incorrectIndices
示例#4
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
    global group
    global H, debug, H, H3
    group = groupObjParam

    N = len(verifyArgsDict)
    z = 0
    delta = {}
    for z in range(0, N):
        delta[z] = prng_bits(80)

    incorrectIndices = []
    H3 = lambda a, b: group.hash(('3', str(a), str(b)), ZR)
    H = lambda prefix, x: group.hash((str(prefix), str(x)), G1)
    __init__(group)

    for z in range(0, N):
        for arg in verifyFuncArgs:
            if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
                sys.exit("ALERT:  Group membership check failed!!!!\n")

        pass

    z = 0
    startSigNum = 0
    endSigNum = N

    dotA = {}
    dotB = {}
    dotC = {}

    a = H(1, verifyArgsDict[z]['M'][bodyKey]['t1'])
    h = H(2, verifyArgsDict[z]['M'][bodyKey]['t2'])

    for z in range(0, N):
        b = H3(verifyArgsDict[z]['M'][bodyKey]['str'],
               verifyArgsDict[z]['M'][bodyKey]['t3'])

        dotA[z] = verifyArgsDict[z]['sig'][bodyKey]**delta[z]
        dotB[z] = verifyArgsDict[z]['pk'][bodyKey]**delta[z]
        dotC[z] = verifyArgsDict[z]['pk'][bodyKey]**(b * delta[z])

    verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, a, h,
                        delta, dotA, dotB, dotC)

    return incorrectIndices
示例#5
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
	global group
	global lam_func, hashObj, debug
	group = groupObjParam

	N = len(verifyArgsDict)
	z = 0
	l = 5
	delta = {}
	for z in range(0, N):
		delta[z] = prng_bits(80)

	incorrectIndices = []
	lam_func = lambda i,a,b: a[i] ** b[i]
	__init__(group)


	for z in range(0, N):
		for arg in verifyFuncArgs:
			if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
				sys.exit("ALERT:  Group membership check failed!!!!\n")

		pass

	z = 0
	startSigNum = 0
	endSigNum = N

	dotA = {}
	dotB = {}
	dotD = {}
	sumE = {}

	A , g2= verifyArgsDict[z]['mpk'][bodyKey][ 'A' ] , verifyArgsDict[z]['mpk'][bodyKey][ 'g2' ]

	for z in range(0, N):
		( S1 , S2 , S3 )= verifyArgsDict[z]['sig'][bodyKey][ 'S1' ] , verifyArgsDict[z]['sig'][bodyKey][ 'S2' ] , verifyArgsDict[z]['sig'][bodyKey][ 'S3' ]

		dotA[z] =   S1 ** delta [ z ]  
		dotB[z] =   S2 ** delta [ z ]  
		dotD[z] =   S3 ** delta [ z ]  
		sumE[z] =   delta [ z ]  

	verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, A, delta, dotA, dotB, dotD, sumE)

	return incorrectIndices
示例#6
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
	global group
	global H, debug, H, H3
	group = groupObjParam

	N = len(verifyArgsDict)
	z = 0
	delta = {}
	for z in range(0, N):
		delta[z] = prng_bits(80)

	incorrectIndices = []
	H3 = lambda a,b: group.hash(('3', str(a), str(b)), ZR)
	H = lambda prefix,x: group.hash((str(prefix), str(x)), G1)
	__init__(group)


	for z in range(0, N):
		for arg in verifyFuncArgs:
			if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
				sys.exit("ALERT:  Group membership check failed!!!!\n")

		pass

	z = 0
	startSigNum = 0
	endSigNum = N

	dotA = {}
	dotB = {}
	dotC = {}

	a= H( 1 , verifyArgsDict[z]['M'][bodyKey][ 't1' ] )
	h= H( 2 , verifyArgsDict[z]['M'][bodyKey][ 't2' ] )

	for z in range(0, N):
		b= H3( verifyArgsDict[z]['M'][bodyKey][ 'str' ] , verifyArgsDict[z]['M'][bodyKey][ 't3' ] )

		dotA[z] =   verifyArgsDict[z]['sig'][bodyKey] ** delta [ z ]  
		dotB[z] =   verifyArgsDict[z]['pk'][bodyKey] ** delta [ z ]  
		dotC[z] =   verifyArgsDict[z]['pk'][bodyKey] **( b * delta [ z ] )  

	verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, a, h, delta, dotA, dotB, dotC)

	return incorrectIndices
示例#7
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
	global group
	global debug, H1, H2
	group = groupObjParam

	N = len(verifyArgsDict)
	z = 0
	delta = {}
	for z in range(0, N):
		delta[z] = prng_bits(80)

	incorrectIndices = []
	H2 = lambda x,y: group.hash((x,y), ZR)
	H1 = lambda x: group.hash(x, G1)
	__init__(group)


	for z in range(0, N):
		for arg in verifyFuncArgs:
			if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
				sys.exit("ALERT:  Group membership check failed!!!!\n")

		pass

	z = 0
	startSigNum = 0
	endSigNum = N

	dotA = {}
	dotB = {}
	dotC = {}

	for z in range(0, N):
		S1= verifyArgsDict[z]['sig'][bodyKey][ 'S1' ]
		S2= verifyArgsDict[z]['sig'][bodyKey][ 'S2' ]
		a= H2( verifyArgsDict[z]['M'][bodyKey] , S1 )

		dotA[z] =   S2 ** delta [ z ]  
		dotB[z] =   verifyArgsDict[z]['pk'][bodyKey] **( a * delta [ z ] )  
		dotC[z] =   S1 ** delta [ z ]  

	verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, delta, dotA, dotB, dotC)

	return incorrectIndices
示例#8
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
    global group
    global debug, H1, H2
    group = groupObjParam

    N = len(verifyArgsDict)
    z = 0
    delta = {}
    for z in range(0, N):
        delta[z] = prng_bits(80)

    incorrectIndices = []
    H2 = lambda x, y: group.hash((x, y), ZR)
    H1 = lambda x: group.hash(x, G1)
    __init__(group)

    for z in range(0, N):
        for arg in verifyFuncArgs:
            if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
                sys.exit("ALERT:  Group membership check failed!!!!\n")

        pass

    z = 0
    startSigNum = 0
    endSigNum = N

    dotA = {}
    dotB = {}
    dotC = {}

    for z in range(0, N):
        S1 = verifyArgsDict[z]['sig'][bodyKey]['S1']
        S2 = verifyArgsDict[z]['sig'][bodyKey]['S2']
        a = H2(verifyArgsDict[z]['M'][bodyKey], S1)

        dotA[z] = S2**delta[z]
        dotB[z] = verifyArgsDict[z]['pk'][bodyKey]**(a * delta[z])
        dotC[z] = S1**delta[z]

    verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, delta,
                        dotA, dotB, dotC)

    return incorrectIndices
示例#9
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
    global group
    global debug, H
    group = groupObjParam

    N = len(verifyArgsDict)
    z = 0
    At, Bt, Ct = getPKdict(verifyArgsDict[z]['mpk'][bodyKey],
                           verifyArgsDict[z]['pk'][bodyKey],
                           ['At', 'Bt', 'Ct'])
    l = len(At.keys())
    delta = {}
    for z in range(0, N):
        delta[z] = prng_bits(80)

    incorrectIndices = []
    H = lambda a: group.hash(('1', str(a)), ZR)
    __init__(group)

    for z in range(0, N):
        for arg in verifyFuncArgs:
            if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
                sys.exit("ALERT:  Group membership check failed!!!!\n")

        pass

    z = 0
    startSigNum = 0
    endSigNum = N

    dotD = {}

    D = pair(verifyArgsDict[z]['mpk'][bodyKey]['g1'],
             verifyArgsDict[z]['mpk'][bodyKey]['g2'])

    for z in range(0, N):

        dotD[z] = D**delta[z]

    verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, D,
                        delta, dotD)

    return incorrectIndices
示例#10
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
	global group
	global debug, H
	group = groupObjParam

	N = len(verifyArgsDict)
	z = 0
	At , Bt , Ct= getPKdict( verifyArgsDict[z]['mpk'][bodyKey] , verifyArgsDict[z]['pk'][bodyKey] , [ 'At' , 'Bt' , 'Ct' ] )
	l= len( At.keys( ) )
	delta = {}
	for z in range(0, N):
		delta[z] = prng_bits(80)

	incorrectIndices = []
	H = lambda a: group.hash(('1', str(a)), ZR)
	__init__(group)


	for z in range(0, N):
		for arg in verifyFuncArgs:
			if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
				sys.exit("ALERT:  Group membership check failed!!!!\n")

		pass

	z = 0
	startSigNum = 0
	endSigNum = N

	dotD = {}

	D= pair( verifyArgsDict[z]['mpk'][bodyKey][ 'g1' ] , verifyArgsDict[z]['mpk'][bodyKey][ 'g2' ] )

	for z in range(0, N):

		dotD[z] =   D ** delta [ z ]  

	verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, D, delta, dotD)

	return incorrectIndices
示例#11
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
    global group
    global debug
    group = groupObjParam

    N = len(verifyArgsDict)
    z = 0
    delta = {}
    for z in range(0, N):
        delta[z] = prng_bits(80)

    incorrectIndices = []
    __init__(group)

    for z in range(0, N):
        for arg in verifyFuncArgs:
            if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
                sys.exit("ALERT:  Group membership check failed!!!!\n")

        pass

    z = 0
    startSigNum = 0
    endSigNum = N

    dotA = {}
    dotB = {}

    for z in range(0, N):
        M = verifyArgsDict[z]['message'][bodyKey]
        h = group.hash(M, G1)

        dotA[z] = h**delta[z]
        dotB[z] = verifyArgsDict[z]['sig'][bodyKey]**delta[z]

    verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, delta,
                        dotA, dotB)

    return incorrectIndices
示例#12
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
	global group
	global debug
	group = groupObjParam

	N = len(verifyArgsDict)
	z = 0
	delta = {}
	for z in range(0, N):
		delta[z] = prng_bits(80)

	incorrectIndices = []
	__init__(group)


	for z in range(0, N):
		for arg in verifyFuncArgs:
			if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
				sys.exit("ALERT:  Group membership check failed!!!!\n")

		pass

	z = 0
	startSigNum = 0
	endSigNum = N

	dotA = {}
	dotB = {}

	for z in range(0, N):
		M= verifyArgsDict[z]['message'][bodyKey]
		h= group.hash( M , G1 )

		dotA[z] =   h ** delta [ z ]  
		dotB[z] =   verifyArgsDict[z]['sig'][bodyKey] ** delta [ z ]  

	verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, delta, dotA, dotB)

	return incorrectIndices
示例#13
0
def run_Batch_Sorted(verifyArgsDict, groupObjParam, verifyFuncArgs):
    global group
    global debug
    group = groupObjParam

    N = len(verifyArgsDict)
    z = 0
    delta = {}
    for z in range(0, N):
        delta[z] = prng_bits(80)

    incorrectIndices = []
    __init__(group)

    for z in range(0, N):
        for arg in verifyFuncArgs:
            if (group.ismember(verifyArgsDict[z][arg][bodyKey]) == False):
                sys.exit("ALERT:  Group membership check failed!!!!\n")

        pass

        c, T1, T2, T3 = verifyArgsDict[z]['sigma'][bodyKey][
            'c'], verifyArgsDict[z]['sigma'][bodyKey]['T1'], verifyArgsDict[z][
                'sigma'][bodyKey]['T2'], verifyArgsDict[z]['sigma'][bodyKey][
                    'T3']
        salpha, sbeta = verifyArgsDict[z]['sigma'][bodyKey][
            's_alpha'], verifyArgsDict[z]['sigma'][bodyKey]['s_beta']
        sx, sgamma1, sgamma2 = verifyArgsDict[z]['sigma'][bodyKey][
            's_x'], verifyArgsDict[z]['sigma'][bodyKey][
                's_gamma1'], verifyArgsDict[z]['sigma'][bodyKey]['s_gamma2']
        R3 = verifyArgsDict[z]['sigma'][bodyKey]['R3']
        R1 = (verifyArgsDict[z]['gpk'][bodyKey]['u']**salpha) * (T1**-c)
        R2 = (verifyArgsDict[z]['gpk'][bodyKey]['v']**sbeta) * (T2**-c)
        R4 = (T1**sx) * (verifyArgsDict[z]['gpk'][bodyKey]['u']**-sgamma1)
        R5 = (T2**sx) * (verifyArgsDict[z]['gpk'][bodyKey]['v']**-sgamma2)
        if c == group.hash(
            (verifyArgsDict[z]['M'][bodyKey], T1, T2, T3, R1, R2, R3, R4, R5),
                ZR):
            if debug: print("c=> '%s'" % c)
            if debug:
                print("Valid Group Signature for message: '%s'" %
                      verifyArgsDict[z]['M'][bodyKey])
            pass
        else:
            if debug: print("Not a valid signature for message!!!")
            incorrectIndices.append(z)

    z = 0
    startSigNum = 0
    endSigNum = N

    dotA = {}
    dotB = {}
    dotC = {}

    for z in range(0, N):
        c, T1, T2, T3 = verifyArgsDict[z]['sigma'][bodyKey][
            'c'], verifyArgsDict[z]['sigma'][bodyKey]['T1'], verifyArgsDict[z][
                'sigma'][bodyKey]['T2'], verifyArgsDict[z]['sigma'][bodyKey][
                    'T3']
        salpha, sbeta = verifyArgsDict[z]['sigma'][bodyKey][
            's_alpha'], verifyArgsDict[z]['sigma'][bodyKey]['s_beta']
        sx, sgamma1, sgamma2 = verifyArgsDict[z]['sigma'][bodyKey][
            's_x'], verifyArgsDict[z]['sigma'][bodyKey][
                's_gamma1'], verifyArgsDict[z]['sigma'][bodyKey]['s_gamma2']
        R3 = verifyArgsDict[z]['sigma'][bodyKey]['R3']

        dotA[z] = (T3**(sx * delta[z]) *
                   (verifyArgsDict[z]['gpk'][bodyKey]['h']**(
                       (-sgamma1 + -sgamma2) * delta[z]) *
                    verifyArgsDict[z]['gpk'][bodyKey]['g1']**(-c * delta[z])))
        dotB[z] = (verifyArgsDict[z]['gpk'][bodyKey]['h']**(
            (-salpha + -sbeta) * delta[z]) * T3**(c * delta[z]))
        dotC[z] = R3**delta[z]

    verifySigsRecursive(verifyArgsDict, group, incorrectIndices, 0, N, delta,
                        dotA, dotB, dotC)

    return incorrectIndices