Saturday, 15 August 2015

c# - Realibly checking if a string is base64 encoded in .Net -



c# - Realibly checking if a string is base64 encoded in .Net -

before start: yes, have checked other questions , answers on topic both here , elsewhere.

i have found illustration string .net base64 decode though isn't base64 encoded. here example:

rhinocort aqueous 64mcg/dose nasal spray

the .net method convert.frombase64string not throw exception when decoding string isbase64encoded method happily returns true string.

interestingly, if utilize cygwin base64 -d command using string input, fails message invalid input.

even more interestingly, source thought belongs executable (http://libb64.sourceforge.net/) "decodes" same string same result getting .net convert.frombase64string. maintain looking hoping find clue elsewhere right i'm stumped.

any ideas?

there's improve solution checks input string length.

i recommend check @ beginning. if input null or empty homecoming false.

http://www.codeproject.com/questions/177808/how-to-determine-if-a-string-is-base-decoded-or

c# .net base64

No comments:

Post a Comment