summary refs log tree commit diff
diff options
context:
space:
mode:
-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];