An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Hi @이용각 이용각 ,
Thanks for reaching out.
This tolerant behavior is not documented as something you should rely on, and it may differ across runtime versions. So it’s best to treat it as an internal behavior rather than a guaranteed feature.
If you need strict Base64 validation in .NET Framework 4.5, a reliable approach would be:
- Ensure the input length (after removing whitespace) is a multiple of 4.
- Decode using
Convert.FromBase64String. - Re-encode the result using
Convert.ToBase64String. - Compare the re-encoded value with the original input (after normalization).
If they don’t match exactly, you can safely reject the input as non-canonical or malformed.
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.