On Monday, August 28, 2017 at 10:05:43 PM UTC-4, alido...@gmail.com wrote:
>
> Dear All, 
>
> I am trying to store the PK and signature to sqlite database. I first 
> encoded the keys as: 
>
>  pk[node].BEREncode(CryptoPP::StringSink(pkstring).Ref());
>
>
> and then store them in the database. But as the PK and signature have 
> special characteres, they are not stored correctly into the database. what 
> I used for storing is: 
>
> *char* * PK = (*char**) *malloc* (BC.trans[l].PK.length()+1);
>
> std::*strcpy*(PK,BC.trans[l].PK.c_str());
>
> *char* *zSQL = *sqlite3_mprintf*("INSERT INTO BC (PK  VALUES ('%q');", 
> PK);
>
>  rc = *sqlite3_exec*(db, zSQL, callback, (*void**)data, &zErrMsg);
>
> free(PK); 
>

Use a BLOB, not a string type.

Or, {Hex|Base32|Base64}-encode the key. Also see

  * https://www.cryptopp.com/wiki/HexEncoder
  * https://www.cryptopp.com/wiki/Base32Encoder
  * https://www.cryptopp.com/wiki/Base64Encoder

Jeff

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
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 cryptopp-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to