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 <noloa...@gmail.com> 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.