summary refs log tree commit diff
path: root/crypto/src/util/encoders
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-09-17 11:23:40 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-09-17 11:23:40 +0700
commit73f71ddda7ebd2b57281c7c546138408c8a289ee (patch)
tree6769b27dfa623edf4346dc3cf52e4c16f9e9afd2 /crypto/src/util/encoders
parentFix previous commit for .NET 1.1 (diff)
downloadBouncyCastle.NET-ed25519-73f71ddda7ebd2b57281c7c546138408c8a289ee.tar.xz
Check final padding character in Base64 data.
Diffstat (limited to 'crypto/src/util/encoders')
-rw-r--r--crypto/src/util/encoders/Base64Encoder.cs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/src/util/encoders/Base64Encoder.cs b/crypto/src/util/encoders/Base64Encoder.cs
index 7b53df25a..07294c9a6 100644
--- a/crypto/src/util/encoders/Base64Encoder.cs
+++ b/crypto/src/util/encoders/Base64Encoder.cs
@@ -269,6 +269,9 @@ namespace Org.BouncyCastle.Utilities.Encoders
         {
             if (c3 == padding)
             {
+                if (c4 != padding)
+                    throw new IOException("invalid characters encountered at end of base64 data");
+
                 byte b1 = decodingTable[c1];
                 byte b2 = decodingTable[c2];