summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-05-02 13:02:54 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-05-02 13:02:54 +0700
commit92b3a61f1c5260d7b82afac116012873866c163e (patch)
tree9c0e7dc6ba25adabfaf608b96c38d693f2317a1d
parentNerdbank.GitVersioning 3.6.128 (diff)
downloadBouncyCastle.NET-ed25519-92b3a61f1c5260d7b82afac116012873866c163e.tar.xz
Update XMSS OIDs
-rw-r--r--crypto/src/asn1/bc/BCObjectIdentifiers.cs48
-rw-r--r--crypto/src/asn1/isara/IsaraObjectIdentifiers.cs23
-rw-r--r--crypto/src/cms/CMSSignedGenerator.cs67
3 files changed, 111 insertions, 27 deletions
diff --git a/crypto/src/asn1/bc/BCObjectIdentifiers.cs b/crypto/src/asn1/bc/BCObjectIdentifiers.cs
index 675350ccf..7f369cd91 100644
--- a/crypto/src/asn1/bc/BCObjectIdentifiers.cs
+++ b/crypto/src/asn1/bc/BCObjectIdentifiers.cs
@@ -77,21 +77,47 @@ namespace Org.BouncyCastle.Asn1.BC
         /**
          * XMSS
          */
-        public static readonly DerObjectIdentifier xmss                      = bc_sig.Branch("2");
-        public static readonly DerObjectIdentifier xmss_with_SHA256          = xmss.Branch("1");
-        public static readonly DerObjectIdentifier xmss_with_SHA512          = xmss.Branch("2");
-        public static readonly DerObjectIdentifier xmss_with_SHAKE128        = xmss.Branch("3");
-        public static readonly DerObjectIdentifier xmss_with_SHAKE256        = xmss.Branch("4");
+        public static readonly DerObjectIdentifier xmss = bc_sig.Branch("2");
+        public static readonly DerObjectIdentifier xmss_SHA256ph = xmss.Branch("1");
+        public static readonly DerObjectIdentifier xmss_SHA512ph = xmss.Branch("2");
+        public static readonly DerObjectIdentifier xmss_SHAKE128ph = xmss.Branch("3");
+        public static readonly DerObjectIdentifier xmss_SHAKE256ph = xmss.Branch("4");
+        public static readonly DerObjectIdentifier xmss_SHA256 = xmss.Branch("5");
+        public static readonly DerObjectIdentifier xmss_SHA512 = xmss.Branch("6");
+        public static readonly DerObjectIdentifier xmss_SHAKE128 = xmss.Branch("7");
+        public static readonly DerObjectIdentifier xmss_SHAKE256 = xmss.Branch("8");
 
         /**
          * XMSS^MT
          */
-        public static readonly DerObjectIdentifier xmss_mt                      = bc_sig.Branch("3");
-        public static readonly DerObjectIdentifier xmss_mt_with_SHA256          = xmss_mt.Branch("1");
-        public static readonly DerObjectIdentifier xmss_mt_with_SHA512          = xmss_mt.Branch("2");
-        public static readonly DerObjectIdentifier xmss_mt_with_SHAKE128        = xmss_mt.Branch("3");
-        public static readonly DerObjectIdentifier xmss_mt_with_SHAKE256        = xmss_mt.Branch("4");
-        
+        public static readonly DerObjectIdentifier xmss_mt = bc_sig.Branch("3");
+        public static readonly DerObjectIdentifier xmss_mt_SHA256ph = xmss_mt.Branch("1");
+        public static readonly DerObjectIdentifier xmss_mt_SHA512ph = xmss_mt.Branch("2");
+        public static readonly DerObjectIdentifier xmss_mt_SHAKE128ph = xmss_mt.Branch("3");
+        public static readonly DerObjectIdentifier xmss_mt_SHAKE256ph = xmss_mt.Branch("4");
+        public static readonly DerObjectIdentifier xmss_mt_SHA256 = xmss_mt.Branch("5");
+        public static readonly DerObjectIdentifier xmss_mt_SHA512 = xmss_mt.Branch("6");
+        public static readonly DerObjectIdentifier xmss_mt_SHAKE128 = xmss_mt.Branch("7");
+        public static readonly DerObjectIdentifier xmss_mt_SHAKE256 = xmss_mt.Branch("8");
+
+        [Obsolete("Use 'xmss_SHA256ph' instead")]
+        public static readonly DerObjectIdentifier xmss_with_SHA256 = xmss_SHA256ph;
+        [Obsolete("Use 'xmss_SHA512ph' instead")]
+        public static readonly DerObjectIdentifier xmss_with_SHA512 = xmss_SHA512ph;
+        [Obsolete("Use 'xmss_SHAKE128ph' instead")]
+        public static readonly DerObjectIdentifier xmss_with_SHAKE128 = xmss_SHAKE128ph;
+        [Obsolete("Use 'xmss_SHAKE256ph' instead")]
+        public static readonly DerObjectIdentifier xmss_with_SHAKE256 = xmss_SHAKE256ph;
+
+        [Obsolete("Use 'xmss_mt_SHA256ph' instead")]
+        public static readonly DerObjectIdentifier xmss_mt_with_SHA256 = xmss_mt_SHA256ph;
+        [Obsolete("Use 'xmss_mt_SHA512ph' instead")]
+        public static readonly DerObjectIdentifier xmss_mt_with_SHA512 = xmss_mt_SHA512ph;
+        [Obsolete("Use 'xmss_mt_SHAKE128ph' instead")]
+        public static readonly DerObjectIdentifier xmss_mt_with_SHAKE128 = xmss_mt_SHAKE128ph;
+        [Obsolete("Use 'xmss_mt_SHAKE256ph' instead")]
+        public static readonly DerObjectIdentifier xmss_mt_with_SHAKE256 = xmss_mt_SHAKE256ph;
+
         /**
          * SPHINCS+
          */
diff --git a/crypto/src/asn1/isara/IsaraObjectIdentifiers.cs b/crypto/src/asn1/isara/IsaraObjectIdentifiers.cs
new file mode 100644
index 000000000..6f6f5bb01
--- /dev/null
+++ b/crypto/src/asn1/isara/IsaraObjectIdentifiers.cs
@@ -0,0 +1,23 @@
+using System;
+
+namespace Org.BouncyCastle.Asn1.Isara
+{
+    public static class IsaraObjectIdentifiers
+    {
+        /*
+        id-alg-xmss  OBJECT IDENTIFIER ::= { itu-t(0)
+                 identified-organization(4) etsi(0) reserved(127)
+                 etsi-identified-organization(0) isara(15) algorithms(1)
+                 asymmetric(1) xmss(13) 0 }
+         */
+        public static readonly DerObjectIdentifier id_alg_xmss = new DerObjectIdentifier("0.4.0.127.0.15.1.1.13.0");
+
+        /*
+          id-alg-xmssmt  OBJECT IDENTIFIER ::= { itu-t(0)
+             identified-organization(4) etsi(0) reserved(127)
+             etsi-identified-organization(0) isara(15) algorithms(1)
+             asymmetric(1) xmssmt(14) 0 }
+         */
+        public static readonly DerObjectIdentifier id_alg_xmssmt = new DerObjectIdentifier("0.4.0.127.0.15.1.1.14.0");
+    }
+}
diff --git a/crypto/src/cms/CMSSignedGenerator.cs b/crypto/src/cms/CMSSignedGenerator.cs
index fd40de469..61a4e9ad6 100644
--- a/crypto/src/cms/CMSSignedGenerator.cs
+++ b/crypto/src/cms/CMSSignedGenerator.cs
@@ -8,6 +8,7 @@ using Org.BouncyCastle.Asn1.Cms;
 using Org.BouncyCastle.Asn1.CryptoPro;
 using Org.BouncyCastle.Asn1.Eac;
 using Org.BouncyCastle.Asn1.GM;
+using Org.BouncyCastle.Asn1.Isara;
 using Org.BouncyCastle.Asn1.Nist;
 using Org.BouncyCastle.Asn1.Oiw;
 using Org.BouncyCastle.Asn1.Pkcs;
@@ -150,15 +151,37 @@ namespace Org.BouncyCastle.Cms
             m_algorithms["SHA256WITHSM2"] = GMObjectIdentifiers.sm2sign_with_sha256;
             m_algorithms["SM3WITHSM2"] = GMObjectIdentifiers.sm2sign_with_sm3;
 
-            m_algorithms["SHA256WITHXMSS"] = BCObjectIdentifiers.xmss_with_SHA256;
-            m_algorithms["SHA512WITHXMSS"] = BCObjectIdentifiers.xmss_with_SHA512;
-            m_algorithms["SHAKE128WITHXMSS"] = BCObjectIdentifiers.xmss_with_SHAKE128;
-            m_algorithms["SHAKE256WITHXMSS"] = BCObjectIdentifiers.xmss_with_SHAKE256;
+            m_algorithms["SHA256WITHXMSS"] = BCObjectIdentifiers.xmss_SHA256ph;
+            m_algorithms["SHA512WITHXMSS"] = BCObjectIdentifiers.xmss_SHA512ph;
+            m_algorithms["SHAKE128WITHXMSS"] = BCObjectIdentifiers.xmss_SHAKE128ph;
+            m_algorithms["SHAKE256WITHXMSS"] = BCObjectIdentifiers.xmss_SHAKE256ph;
 
-            m_algorithms["SHA256WITHXMSSMT"] = BCObjectIdentifiers.xmss_mt_with_SHA256;
-            m_algorithms["SHA512WITHXMSSMT"] = BCObjectIdentifiers.xmss_mt_with_SHA512;
-            m_algorithms["SHAKE128WITHXMSSMT"] = BCObjectIdentifiers.xmss_mt_with_SHAKE128;
-            m_algorithms["SHAKE256WITHXMSSMT"] = BCObjectIdentifiers.xmss_mt_with_SHAKE256;
+            m_algorithms["SHA256WITHXMSSMT"] = BCObjectIdentifiers.xmss_mt_SHA256ph;
+            m_algorithms["SHA512WITHXMSSMT"] = BCObjectIdentifiers.xmss_mt_SHA512ph;
+            m_algorithms["SHAKE128WITHXMSSMT"] = BCObjectIdentifiers.xmss_mt_SHAKE128ph;
+            m_algorithms["SHAKE256WITHXMSSMT"] = BCObjectIdentifiers.xmss_mt_SHAKE256ph;
+
+            m_algorithms["SHA256WITHXMSS-SHA256"] = BCObjectIdentifiers.xmss_SHA256ph;
+            m_algorithms["SHA512WITHXMSS-SHA512"] = BCObjectIdentifiers.xmss_SHA512ph;
+            m_algorithms["SHAKE128WITHXMSS-SHAKE128"] = BCObjectIdentifiers.xmss_SHAKE128ph;
+            m_algorithms["SHAKE256WITHXMSS-SHAKE256"] = BCObjectIdentifiers.xmss_SHAKE256ph;
+
+            m_algorithms["SHA256WITHXMSSMT-SHA256"] = BCObjectIdentifiers.xmss_mt_SHA256ph;
+            m_algorithms["SHA512WITHXMSSMT-SHA512"] = BCObjectIdentifiers.xmss_mt_SHA512ph;
+            m_algorithms["SHAKE128WITHXMSSMT-SHAKE128"] = BCObjectIdentifiers.xmss_mt_SHAKE128ph;
+            m_algorithms["SHAKE256WITHXMSSMT-SHAKE256"] = BCObjectIdentifiers.xmss_mt_SHAKE256ph;
+
+            m_algorithms["XMSS"] = IsaraObjectIdentifiers.id_alg_xmss;
+            m_algorithms["XMSS-SHA256"] = BCObjectIdentifiers.xmss_SHA256;
+            m_algorithms["XMSS-SHA512"] = BCObjectIdentifiers.xmss_SHA512;
+            m_algorithms["XMSS-SHAKE128"] = BCObjectIdentifiers.xmss_SHAKE128;
+            m_algorithms["XMSS-SHAKE256"] = BCObjectIdentifiers.xmss_SHAKE256;
+
+            m_algorithms["XMSSMT"] = IsaraObjectIdentifiers.id_alg_xmssmt;
+            m_algorithms["XMSSMT-SHA256"] = BCObjectIdentifiers.xmss_mt_SHA256;
+            m_algorithms["XMSSMT-SHA512"] = BCObjectIdentifiers.xmss_mt_SHA512;
+            m_algorithms["XMSSMT-SHAKE128"] = BCObjectIdentifiers.xmss_mt_SHAKE128;
+            m_algorithms["XMSSMT-SHAKE256"] = BCObjectIdentifiers.xmss_mt_SHAKE256;
 
 
             //
@@ -202,14 +225,26 @@ namespace Org.BouncyCastle.Cms
             //
             // XMSS
             //
-            noParams.Add(BCObjectIdentifiers.xmss_with_SHA256);
-            noParams.Add(BCObjectIdentifiers.xmss_with_SHA512);
-            noParams.Add(BCObjectIdentifiers.xmss_with_SHAKE128);
-            noParams.Add(BCObjectIdentifiers.xmss_with_SHAKE256);
-            noParams.Add(BCObjectIdentifiers.xmss_mt_with_SHA256);
-            noParams.Add(BCObjectIdentifiers.xmss_mt_with_SHA512);
-            noParams.Add(BCObjectIdentifiers.xmss_mt_with_SHAKE128);
-            noParams.Add(BCObjectIdentifiers.xmss_mt_with_SHAKE256);
+            noParams.Add(BCObjectIdentifiers.xmss_SHA256ph);
+            noParams.Add(BCObjectIdentifiers.xmss_SHA512ph);
+            noParams.Add(BCObjectIdentifiers.xmss_SHAKE128ph);
+            noParams.Add(BCObjectIdentifiers.xmss_SHAKE256ph);
+            noParams.Add(BCObjectIdentifiers.xmss_mt_SHA256ph);
+            noParams.Add(BCObjectIdentifiers.xmss_mt_SHA512ph);
+            noParams.Add(BCObjectIdentifiers.xmss_mt_SHAKE128ph);
+            noParams.Add(BCObjectIdentifiers.xmss_mt_SHAKE256ph);
+
+            noParams.Add(BCObjectIdentifiers.xmss_SHA256);
+            noParams.Add(BCObjectIdentifiers.xmss_SHA512);
+            noParams.Add(BCObjectIdentifiers.xmss_SHAKE128);
+            noParams.Add(BCObjectIdentifiers.xmss_SHAKE256);
+            noParams.Add(BCObjectIdentifiers.xmss_mt_SHA256);
+            noParams.Add(BCObjectIdentifiers.xmss_mt_SHA512);
+            noParams.Add(BCObjectIdentifiers.xmss_mt_SHAKE128);
+            noParams.Add(BCObjectIdentifiers.xmss_mt_SHAKE256);
+
+            noParams.Add(IsaraObjectIdentifiers.id_alg_xmss);
+            noParams.Add(IsaraObjectIdentifiers.id_alg_xmssmt);
 
             //
             // SM2