Hello,
I'm writing my Master of Science work, that is group EC DH chat program. I
have everything working with basic version, but now I'm creating version
that is using point compression
I'm sending base64 encoded points to my clients. At arrival I'm parsing
data, decoding and then using point compression to get my data.
I have problem because I see that every client is getting same base64
encoded vector of data and after decoding data is the same, but after point
decompression I sometimes have null values.
This is code that is responsible for decoding point.
for(int loop=0; loop<=vectorSize; loop++)
{
sECPoint = data.substr(0,data.find("|"));
if(debug) {cout << "sECPoint = " << sECPoint << endl; }
if(compression)
{
StringSource ssECPoint(sECPoint, true, new Base64Decoder);
curve.DecodePoint(ecPoint,
ssECPoint,(size_t)ssECPoint.MaxRetrievable());
cout << "ecPoint x = " << ecPoint.x << " y = " << ecPoint.y <<
" id = "<< ecPoint.identity << endl;
}
And debug data looks like that:
CLIENT 1:
Got message:
> 7|AqLZxT5eCQ8VAbaI3tKcbfrV7FsFaDTtCojDjia8P3GO|A7hdjkoyumVPrKYuZ+OdI6mfKIceYjtNYB0PljP8v9o9|AtHH+S6g/NRakt8Mahtaa48BQA==(121
>
> bytes)
> vectorSize = 2
> sECPoint = AqLZxT5eCQ8VAbaI3tKcbfrV7FsFaDTtCojDjia8P3GO
> Base64 decoded data = ���>^ ���Ҝm���[h4
> �Î&�?q
> ecPoint x =
> 73659448608996157458434033290632855494864044423496948234286370214166956831118.
>
> y =
> 60676554079734457985627418807219852894225169807310893567114960256809730577740.
>
> id = 0
> sECPoint = A7hdjkoyumVPrKYuZ+OdI6mfKIceYjtNYB0PljP8v9o9
> Base64 decoded data = �]2�eO��.g��#��(� b;M` �3���=
> ecPoint x =
> 83390862964704996178758200084853607318473675088230803533008391012799544810045.
>
> y =
> 97328381155080965333039977632407768602364037593973576398589306351086699973771.
>
> id = 0
> sECPoint = AtHH+S6g/NRakt8Mahtaa48BQA==
> Base64 decoded data = ���.���Z��
> jk@
> ecPoint x =
> 94886707711745445884410525819223582491051733990049702318726159165764302536737.
>
> y =
> 50522667450611288145076001240272859689443896261480978773366005925504898412810.
>
> id = 0
> Vector after multiply=
> 30896976448500581910508093050185774824068501301116314394328315844216188286142.:11115882227254935504261236661243199606767087734541741408653357138655360257653.
> Vector after multiply=
> 42178174706126398928087425442304591979110468787466211036060341796118366100289.:80441229474098976140710819225858210898503034760320685760510756537795132508545.
> Vector after multiply=
> 108157626803119910024640032093731338116384971012961610971619959624076723018866.:94413469192532847376990875652203430474684800925113351181447584204312778024455.
>
CLIENT 2:
Got message:
> 7|AqLZxT5eCQ8VAbaI3tKcbfrV7FsFaDTtCojDjia8P3GO|A7hdjkoyumVPrKYuZ+OdI6mfKIceYjtNYB0PljP8v9o9|AtHH+S6g/NRakt8Mahtaa48BQA==(121
>
> bytes)
> vectorSize = 2
> sECPoint = AqLZxT5eCQ8VAbaI3tKcbfrV7FsFaDTtCojDjia8P3GO
> Base64 decoded data = ���>^ ���Ҝm���[h4
> �Î&�?q
> ecPoint x =
> 73659448608996157458434033290632855494864044423496948234286370214166956831118.
>
> y =
> 60676554079734457985627418807219852894225169807310893567114960256809730577740.
>
> id = 0
> sECPoint = A7hdjkoyumVPrKYuZ+OdI6mfKIceYjtNYB0PljP8v9o9
> Base64 decoded data = �]2�eO��.g��#��(� b;M` �3���=
> ecPoint x =
> 83390862964704996178758200084853607318473675088230803533008391012799544810045.
>
> y =
> 97328381155080965333039977632407768602364037593973576398589306351086699973771.
>
> id = 0
> sECPoint = AtHH+S6g/NRakt8Mahtaa48BQA==
> Base64 decoded data = ���.���Z��
> jk@
> ecPoint x =
> 94886707711745445884410525819223582491051733990049702319334901720577209600281.
>
> y =
> 115373984143247011804012929870946943881351063663352689606415537465964066067740.
>
> id = 0
> Vector after multiply=
> 3853123436665640573252309455087009483294043611706939294146719507356809653754.:10303321450368467608341926599267658692227201632543094915477092069105302253385.
> Vector after multiply=
> 57469070687705763452453461097452717274597590282479843230370957513268927685907.:24144225323572951554508529552026586624686761036977308613714966376490453275392.
> Vector after multiply=
> 14947644834106663111491065576768141435446207178661943554437145367101595296907.:59151516821318144627894229720563318335642165648603327296674246079738803560974.
>
So you can see that third vecotr base64 is AtHH+S6g/NRakt8Mahtaa48BQA== and
is decoded to same value, but point decompression gives different values:/
I was also tring do decode like this:
StringSource ssECPoint(sECPoint, true, new Base64Decoder);
> curve.DecodePoint(ecPoint, ssECPoint,(size_t)ssECPoint.MaxRetrievable());
>
But then I get nulls insted of different values.
What is interesting is that this behavior is totaly random, sometimes it
works totally fine and sometimes I get this strange results.
Do any of you have idea what could be wrong? I even tried to replace base64
encoding with hex encoding, so in my opinion problem is with point
decompression, but I have no idea where to look for a solution.
Regards,
Piotr Bratkowksi
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.