Re: [cryptopp-users] Chunking a base64 encoded file

2018-04-05 Thread Jeffrey Walton
On Thu, Apr 5, 2018 at 10:54 AM,   wrote:
> Are you saying that Base64 decoder knows precisely how many bytes of input
> to take from the chunk shoved into it by the pipelline, and I would not need
> to worry about how many bytes to pump at a time?

Correct. If all works as expected you get your decoded message when
the destructors run. There may be some data available sooner if you
run a while loop chunking data.

Sometimes you need to call MessageEnd() to tell the machinery to
process all data at this very moment so you can use it before the
destructors run. Otherwise the filter will wait for more data to
stream. See, for example,
https://www.cryptopp.com/wiki/Base64Decoder#Missing_Data .

Jeff

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
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.


Re: [cryptopp-users] Chunking a base64 encoded file

2018-04-05 Thread mahonheiser
Are you saying that Base64 decoder knows precisely how many bytes of input 
to take from the chunk shoved into it by the pipelline, and I would not 
need to worry about how many bytes to pump at a time?

Thanks,
Mahon

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
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.


Re: [cryptopp-users] PGP

2018-04-05 Thread mahonheiser
I honestly don't know how to answer this question in academic terms, but in 
layman terms, if THEY use commonly available PGP tools to generate a public 
and private key pair, and shares their public key with me, I am looking to 
load that key from disk (most likely in ASCII armored form which I naively 
presume being Base64, with whatever hearder and footer PGP puts in during 
the export), and be able to encrypt files so that THEY could decrypt them 
with the above mentioned PGP tools, be it Gnu PG, GPG4Win or anything else 
available. And in reverse, I am looking to be able to generate my own key 
pair, share the public key with them so that they would be able to load it 
into a key manager like Kleopatra and encrypt with it files which I should 
be able to decrypt on my end.

People do not think much of these things in real world: they just use the 
commonly available tool, specify key bitness at best, and go with the flow. 
For me that all sounds like fully supporting PGP. If this is already 
roughed in, a few code samples would be immensely helpful. As far as I 
know, PGP uses RSA keys and Triple DES encryption, but I may be talking out 
of my rear end. Also I know that keys shorter than 4096 bits are no longer 
considered secure with PGP. Here my knowledge ends.

I was able to support the above principles with Bouncy Castle relatively 
easily without having to know much about cryptography, but .NET is very 
onerous for this sort of development, as it does not allow to overwrite 
memory securely without enormous performance hit and has other nasty 
limitations. And this is the main reason I started looking towards a purely 
C++ solution with CryptoPP being the obvious champion.

Regards
Mahon

On Thursday, April 5, 2018 at 4:29:16 AM UTC-4, Jeffrey Walton wrote:
>
>
>
> On Wednesday, April 4, 2018 at 10:25:09 AM UTC-4, mahon...@gmail.com 
> wrote:
>>
>> Jeff,
>>
>> There is no mention of PGP in the roadmap on the Wiki (which is also 1 
>> version behind vs 6.2 mentioned in this group). Are there concrete plans 
>> for including the PGP scheme?
>>
>
> No, not at the moment.
>  
>
>> I am also very much interested in PGP support due to horrible memory 
>> management bestowed on Bouncy Castle by .NET and its mediocre performance. 
>> Crypto++ with its tiny memory footprint and portability is miles ahead of 
>> BC, and if it supported PGP OOB it would be a BC killer. And OpenGPG is a 
>> joke.
>>
>
> Well, to lay tentative plans we would need to know use cases. In 
> particular, what algorithms you need.
>
> It could be the case you have what you need and you only need to glue it 
> together.
>
> Jeff
>
>  
>

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
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.


Re: [cryptopp-users] Re: Base 64 URL Decoding Wtih Base64Decoder?

2018-04-05 Thread Henry Chan
Yeah, I did try to set the 3rd parameter to false to suppress the exception.

Tho, I am having trouble to get the correct hashed string (I didn't paste
that part of the code, which depends on the decoded string); and I wonder
it has something to do with my usage of Base64Decoder, and the exception
caught my attention...

Yes, I guess I will just copy and paste the class if nothing else I can
find.

Thanks for your input :)

On Wed, Apr 4, 2018 at 2:48 PM, Jeffrey Walton  wrote:

>
>
> On Tuesday, April 3, 2018 at 11:46:00 PM UTC-4, hc12...@gmail.com wrote:
>>
>> Hi,
>>
>> I noticed that Base64URLDecoder exists but unfortunately, I am stuck with
>> 5.6.2, which doesn't have it.
>>
>
> It can be available in all versions of the library. Just copy/paste it
> from the existing sources :)
>
>
>> So I followed the recommendation on https://www.cryptopp.com/wiki/
>> Base64Decoder (Changing Alphabets section):
>>
>> // my code snippet
>> std::string decoded_key;
>>
>> const byte ALPHABET[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabc
>> defghijklmnopqrstuvwxyz0123456789-_";
>> int lookup[256];
>> CryptoPP::Base64Decoder::InitializeDecodingLookupArray(lookup,
>> ALPHABET, 64, false);
>>
>> try
>> {
>> CryptoPP::Base64Decoder* pDecoder = new
>> CryptoPP::Base64Decoder();
>> pDecoder->IsolatedInitialize(C
>> ryptoPP::MakeParameters(CryptoPP::Name::DecodingLookupArray(),(const int
>> *)lookup));
>> pDecoder->Attach(new CryptoPP::StringSink(decoded_key));
>> // Decode the key since it is base64url encoded
>> CryptoPP::StringSource src(key, true, pDecoder);
>>
>>
>> But then I got an exception:
>> AlgorithmParametersBase: parameter "DecodingLookupArray" not used
>>
>
> Not sure why you are catching the exception but...
>
> You can add false as a thid parameter to avoid the exception:
>
> MakeParameters(Name::DecodingLookupArray(),(const int *)lookup),
> false);
>
> I'm not sure what trouble you might encounter afterwards, like failure to
> change the alphabet or changing the alphabet for all decoders.
>
> In the end, I recommend the copy/paste method to get it.
>
> Jeff
>
> --
> You received this message because you are subscribed to "Crypto++ Users".
> More information about Crypto++ and this group is available at
> http://www.cryptopp.com and http://groups.google.com/
> forum/#!forum/cryptopp-users.
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Crypto++ Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/cryptopp-users/fe3xWRw_Uso/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> cryptopp-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
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.


Re: [cryptopp-users] PGP

2018-04-05 Thread Jeffrey Walton


On Wednesday, April 4, 2018 at 10:25:09 AM UTC-4, mahon...@gmail.com wrote:
>
> Jeff,
>
> There is no mention of PGP in the roadmap on the Wiki (which is also 1 
> version behind vs 6.2 mentioned in this group). Are there concrete plans 
> for including the PGP scheme?
>

No, not at the moment.
 

> I am also very much interested in PGP support due to horrible memory 
> management bestowed on Bouncy Castle by .NET and its mediocre performance. 
> Crypto++ with its tiny memory footprint and portability is miles ahead of 
> BC, and if it supported PGP OOB it would be a BC killer. And OpenGPG is a 
> joke.
>

Well, to lay tentative plans we would need to know use cases. In 
particular, what algorithms you need.

It could be the case you have what you need and you only need to glue it 
together.

Jeff

 

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
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.