summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-07-22 15:31:33 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-07-22 15:31:33 +0700
commit3a1d465dcde21e2cc5fa0589a2cbbde1f08fb681 (patch)
tree0f9c7559a9232cb2581e259893ec5d40cee8114d
parentUpdate NistObjectIdentifiers (diff)
downloadBouncyCastle.NET-ed25519-3a1d465dcde21e2cc5fa0589a2cbbde1f08fb681.tar.xz
Add explanatory comment for "wrong AES OIDs"
-rw-r--r--crypto/src/security/GeneratorUtilities.cs6
-rw-r--r--crypto/src/security/ParameterUtilities.cs6
-rw-r--r--crypto/src/security/SecurityUtilities.cs13
3 files changed, 19 insertions, 6 deletions
diff --git a/crypto/src/security/GeneratorUtilities.cs b/crypto/src/security/GeneratorUtilities.cs
index cb6ca9c1b..e9525b377 100644
--- a/crypto/src/security/GeneratorUtilities.cs
+++ b/crypto/src/security/GeneratorUtilities.cs
@@ -38,7 +38,7 @@ namespace Org.BouncyCastle.Security
             AddKgAlgorithm("AES",
                 "AESWRAP");
             AddKgAlgorithm("AES128",
-                "2.16.840.1.101.3.4.2",
+                SecurityUtilities.WrongAes128,
                 NistObjectIdentifiers.IdAes128Cbc,
                 NistObjectIdentifiers.IdAes128Ccm,
                 NistObjectIdentifiers.IdAes128Cfb,
@@ -47,7 +47,7 @@ namespace Org.BouncyCastle.Security
                 NistObjectIdentifiers.IdAes128Ofb,
                 NistObjectIdentifiers.IdAes128Wrap);
             AddKgAlgorithm("AES192",
-                "2.16.840.1.101.3.4.22",
+                SecurityUtilities.WrongAes192,
                 NistObjectIdentifiers.IdAes192Cbc,
                 NistObjectIdentifiers.IdAes192Ccm,
                 NistObjectIdentifiers.IdAes192Cfb,
@@ -56,7 +56,7 @@ namespace Org.BouncyCastle.Security
                 NistObjectIdentifiers.IdAes192Ofb,
                 NistObjectIdentifiers.IdAes192Wrap);
             AddKgAlgorithm("AES256",
-                "2.16.840.1.101.3.4.42",
+                SecurityUtilities.WrongAes256,
                 NistObjectIdentifiers.IdAes256Cbc,
                 NistObjectIdentifiers.IdAes256Ccm,
                 NistObjectIdentifiers.IdAes256Cfb,
diff --git a/crypto/src/security/ParameterUtilities.cs b/crypto/src/security/ParameterUtilities.cs
index d393e3d36..c1f4492b3 100644
--- a/crypto/src/security/ParameterUtilities.cs
+++ b/crypto/src/security/ParameterUtilities.cs
@@ -29,7 +29,7 @@ namespace Org.BouncyCastle.Security
             AddAlgorithm("AES",
                 "AESWRAP");
             AddAlgorithm("AES128",
-                "2.16.840.1.101.3.4.2",
+                SecurityUtilities.WrongAes128,
                 NistObjectIdentifiers.IdAes128Cbc,
                 NistObjectIdentifiers.IdAes128Ccm,
                 NistObjectIdentifiers.IdAes128Cfb,
@@ -38,7 +38,7 @@ namespace Org.BouncyCastle.Security
                 NistObjectIdentifiers.IdAes128Ofb,
                 NistObjectIdentifiers.IdAes128Wrap);
             AddAlgorithm("AES192",
-                "2.16.840.1.101.3.4.22",
+                SecurityUtilities.WrongAes192,
                 NistObjectIdentifiers.IdAes192Cbc,
                 NistObjectIdentifiers.IdAes192Ccm,
                 NistObjectIdentifiers.IdAes192Cfb,
@@ -47,7 +47,7 @@ namespace Org.BouncyCastle.Security
                 NistObjectIdentifiers.IdAes192Ofb,
                 NistObjectIdentifiers.IdAes192Wrap);
             AddAlgorithm("AES256",
-                "2.16.840.1.101.3.4.42",
+                SecurityUtilities.WrongAes256,
                 NistObjectIdentifiers.IdAes256Cbc,
                 NistObjectIdentifiers.IdAes256Ccm,
                 NistObjectIdentifiers.IdAes256Cfb,
diff --git a/crypto/src/security/SecurityUtilities.cs b/crypto/src/security/SecurityUtilities.cs
new file mode 100644
index 000000000..ff24c6e1e
--- /dev/null
+++ b/crypto/src/security/SecurityUtilities.cs
@@ -0,0 +1,13 @@
+namespace Org.BouncyCastle.Security
+{
+    internal static class SecurityUtilities
+    {
+        /*
+         * These three got introduced in some messages as a result of a typo in an early document. We don't produce
+         * anything using these OID values, but we'll read them.
+         */
+        internal static readonly string WrongAes128 = "2.16.840.1.101.3.4.2";
+        internal static readonly string WrongAes192 = "2.16.840.1.101.3.4.22";
+        internal static readonly string WrongAes256 = "2.16.840.1.101.3.4.42";
+    }
+}