AAGKeyPairGenerator.h
Go to the documentation of this file.00001
00002
00003
00004 #ifndef AAG_KEY_PAIR_H
00005 #define AAG_KEY_PAIR_H
00006
00007 #include "errormsgs.h"
00008 #include "PairDistanceTest.h"
00009 #include "AAGKeyGeneration.h"
00010
00011
00013
00014
00015
00016
00017
00019
00020 class AAGKeyPairGenerator : public PairGenerator
00021 {
00022 public:
00023 AAGKeyPairGenerator(int n, int min_len, int max_len, int n_sg_gens, int a_decomp,int b_decomp ):
00024 nGens( n ),
00025 minLen( min_len ),
00026 maxLen( max_len ),
00027 nSgGens( n_sg_gens ),
00028 AliceDecompositionLength( a_decomp ),
00029 BobDecompositionLength( b_decomp ) {}
00030
00031 pair<Word,Word> getFalsePair(){
00032
00033 pair <Word,Word> p;
00034 AAGProtocolInstance gaagi = generateAAGInstance( nGens , nSgGens , minLen , maxLen , AliceDecompositionLength , BobDecompositionLength );
00035 vector< Word > aSgp = gaagi.getAlicePublicSbgp( );
00036 vector< Word > aConjSgp = gaagi.getAliceConjSbgp( );
00037
00038
00039 Word a_conj_B;
00040 for ( int i=0;i<aConjSgp.size();i++)
00041 a_conj_B *= aConjSgp[i];
00042
00043
00044 Word a;
00045 for ( int i=0;i<aSgp.size();i++)
00046 a *= aSgp[i];
00047
00048
00049
00050
00051
00052
00053
00054 p.first = a_conj_B;
00055 p.second = a;
00056
00057 return p;
00058
00059 }
00060
00061 pair<Word,Word> getTruePair(){
00062
00063 pair <Word,Word> p;
00064 AAGProtocolInstance gaagi = generateAAGInstance( nGens , nSgGens , minLen , maxLen , AliceDecompositionLength , BobDecompositionLength );
00065 vector< Word > aConjSgp = gaagi.getAliceConjSbgp( );
00066
00067
00068 Word a_conj_B;
00069 for ( int i=0;i<aConjSgp.size();i++)
00070 a_conj_B *= aConjSgp[i];
00071
00072
00073 AAGProtocolInstance gaagi2 = generateAAGInstance( nGens , nSgGens , minLen , maxLen , AliceDecompositionLength , BobDecompositionLength );
00074 vector< Word > aSgp = gaagi2.getAlicePublicSbgp( );
00075 Word a;
00076 for ( int i=0;i<aSgp.size();i++)
00077 a *= aSgp[i];
00078
00079
00080
00081
00082
00083
00084
00085 p.first = a_conj_B;
00086 p.second = a;
00087
00088 return p;
00089
00090 }
00091 private:
00092 int nGens;
00093 int minLen;
00094 int maxLen;
00095 int nSgGens;
00096 int AliceDecompositionLength;
00097 int BobDecompositionLength;
00098 };
00099
00100 #endif