diff options
author | David Hook <dgh@cryptoworkshop.com> | 2023-08-30 10:03:35 +1000 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2023-08-30 10:03:35 +1000 |
commit | affcd4d2708407130b0c86ab22a0d2e850811e22 (patch) | |
tree | 4f073e52b049829648e652bd7f6cef84eaf2bd8f | |
parent | updated Dilithium OIDs to FIPS pub draft algorithm values (diff) | |
download | BouncyCastle.NET-ed25519-affcd4d2708407130b0c86ab22a0d2e850811e22.tar.xz |
added missing SPHINCS+ shake OIDs, corrected values
-rw-r--r-- | crypto/src/asn1/bc/BCObjectIdentifiers.cs | 24 | ||||
-rw-r--r-- | crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs | 21 | ||||
-rw-r--r-- | crypto/src/pqc/crypto/utils/PqcUtilities.cs | 42 |
3 files changed, 49 insertions, 38 deletions
diff --git a/crypto/src/asn1/bc/BCObjectIdentifiers.cs b/crypto/src/asn1/bc/BCObjectIdentifiers.cs index de8431ecc..451f846f8 100644 --- a/crypto/src/asn1/bc/BCObjectIdentifiers.cs +++ b/crypto/src/asn1/bc/BCObjectIdentifiers.cs @@ -180,17 +180,19 @@ namespace Org.BouncyCastle.Asn1.BC public static readonly DerObjectIdentifier sphincsPlus_haraka_256f_r3_simple = sphincsPlus.Branch("36"); // Interop OIDs. - public static readonly DerObjectIdentifier sphincsPlus_sha2_128s_simple = new DerObjectIdentifier("1.3.9999.6.4.16"); - public static readonly DerObjectIdentifier sphincsPlus_sha2_128f_simple = new DerObjectIdentifier("1.3.9999.6.4.13"); - public static readonly DerObjectIdentifier sphincsPlus_shake_128f_simple = new DerObjectIdentifier("1.3.9999.6.7.4"); - - public static readonly DerObjectIdentifier sphincsPlus_sha2_192s_simple = new DerObjectIdentifier("1.3.9999.6.5.12"); - public static readonly DerObjectIdentifier sphincsPlus_sha2_192f_simple = new DerObjectIdentifier("1.3.9999.6.5.10"); - public static readonly DerObjectIdentifier sphincsPlus_shake_192f_simple = new DerObjectIdentifier("1.3.9999.6.8.3"); - - public static readonly DerObjectIdentifier sphincsPlus_sha2_256s_simple = new DerObjectIdentifier("1.3.9999.6.6.12"); - public static readonly DerObjectIdentifier sphincsPlus_sha2_256f_simple = new DerObjectIdentifier("1.3.9999.6.6.10"); - public static readonly DerObjectIdentifier sphincsPlus_shake_256f_simple = new DerObjectIdentifier("1.3.9999.6.9.3"); + public static readonly DerObjectIdentifier sphincsPlus_sha2_128f = new DerObjectIdentifier("1.3.9999.6.4.13"); + public static readonly DerObjectIdentifier sphincsPlus_sha2_128s = new DerObjectIdentifier("1.3.9999.6.4.16"); + public static readonly DerObjectIdentifier sphincsPlus_sha2_192f = new DerObjectIdentifier("1.3.9999.6.5.10"); + public static readonly DerObjectIdentifier sphincsPlus_sha2_192s = new DerObjectIdentifier("1.3.9999.6.5.12"); + public static readonly DerObjectIdentifier sphincsPlus_sha2_256f = new DerObjectIdentifier("1.3.9999.6.6.10"); + public static readonly DerObjectIdentifier sphincsPlus_sha2_256s = new DerObjectIdentifier("1.3.9999.6.6.12"); + + public static readonly DerObjectIdentifier sphincsPlus_shake_128f = new DerObjectIdentifier("1.3.9999.6.7.13"); + public static readonly DerObjectIdentifier sphincsPlus_shake_128s = new DerObjectIdentifier("1.3.9999.6.7.16"); + public static readonly DerObjectIdentifier sphincsPlus_shake_192f = new DerObjectIdentifier("1.3.9999.6.8.10"); + public static readonly DerObjectIdentifier sphincsPlus_shake_192s = new DerObjectIdentifier("1.3.9999.6.8.12"); + public static readonly DerObjectIdentifier sphincsPlus_shake_256f = new DerObjectIdentifier("1.3.9999.6.9.10"); + public static readonly DerObjectIdentifier sphincsPlus_shake_256s = new DerObjectIdentifier("1.3.9999.6.9.12"); [Obsolete("Will be removed - name is erroneous")] public static readonly DerObjectIdentifier sphincsPlus_shake_256 = sphincsPlus.Branch("1"); diff --git a/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs b/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs index 5aef69818..0b5cf0031 100644 --- a/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs +++ b/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs @@ -143,15 +143,18 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities Converters[BCObjectIdentifiers.sphincsPlus_haraka_256s_r3] = new SphincsPlusConverter(); Converters[BCObjectIdentifiers.sphincsPlus_haraka_256f_r3] = new SphincsPlusConverter(); - Converters[BCObjectIdentifiers.sphincsPlus_sha2_128s_simple] = new SphincsPlusConverter(); - Converters[BCObjectIdentifiers.sphincsPlus_sha2_128f_simple] = new SphincsPlusConverter(); - Converters[BCObjectIdentifiers.sphincsPlus_shake_128f_simple] = new SphincsPlusConverter(); - Converters[BCObjectIdentifiers.sphincsPlus_sha2_192s_simple] = new SphincsPlusConverter(); - Converters[BCObjectIdentifiers.sphincsPlus_sha2_192f_simple] = new SphincsPlusConverter(); - Converters[BCObjectIdentifiers.sphincsPlus_shake_192f_simple] = new SphincsPlusConverter(); - Converters[BCObjectIdentifiers.sphincsPlus_sha2_256s_simple] = new SphincsPlusConverter(); - Converters[BCObjectIdentifiers.sphincsPlus_sha2_256f_simple] = new SphincsPlusConverter(); - Converters[BCObjectIdentifiers.sphincsPlus_shake_256f_simple] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_sha2_128s] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_sha2_128f] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_shake_128s] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_shake_128f] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_sha2_192s] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_sha2_192f] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_shake_192s] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_shake_192f] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_sha2_256s] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_sha2_256f] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_shake_256s] = new SphincsPlusConverter(); + Converters[BCObjectIdentifiers.sphincsPlus_shake_256f] = new SphincsPlusConverter(); } /// <summary> Create a public key from a SubjectPublicKeyInfo encoding</summary> diff --git a/crypto/src/pqc/crypto/utils/PqcUtilities.cs b/crypto/src/pqc/crypto/utils/PqcUtilities.cs index 21254331c..b7cac6203 100644 --- a/crypto/src/pqc/crypto/utils/PqcUtilities.cs +++ b/crypto/src/pqc/crypto/utils/PqcUtilities.cs @@ -234,15 +234,18 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities sphincsPlusOids[SphincsPlusParameters.haraka_256s] = BCObjectIdentifiers.sphincsPlus_haraka_256s_r3; sphincsPlusOids[SphincsPlusParameters.haraka_256f] = BCObjectIdentifiers.sphincsPlus_haraka_256f_r3; - sphincsPlusOids[SphincsPlusParameters.sha2_128s_simple] = BCObjectIdentifiers.sphincsPlus_sha2_128s_simple; - sphincsPlusOids[SphincsPlusParameters.sha2_128f_simple] = BCObjectIdentifiers.sphincsPlus_sha2_128f_simple; - sphincsPlusOids[SphincsPlusParameters.shake_128f_simple] = BCObjectIdentifiers.sphincsPlus_shake_128f_simple; - sphincsPlusOids[SphincsPlusParameters.sha2_192s_simple] = BCObjectIdentifiers.sphincsPlus_sha2_192s_simple; - sphincsPlusOids[SphincsPlusParameters.sha2_192f_simple] = BCObjectIdentifiers.sphincsPlus_sha2_192f_simple; - sphincsPlusOids[SphincsPlusParameters.shake_192f_simple] = BCObjectIdentifiers.sphincsPlus_shake_192f_simple; - sphincsPlusOids[SphincsPlusParameters.sha2_256s_simple] = BCObjectIdentifiers.sphincsPlus_sha2_256s_simple; - sphincsPlusOids[SphincsPlusParameters.sha2_256f_simple] = BCObjectIdentifiers.sphincsPlus_sha2_256f_simple; - sphincsPlusOids[SphincsPlusParameters.shake_256f_simple] = BCObjectIdentifiers.sphincsPlus_shake_256f_simple; + sphincsPlusOids[SphincsPlusParameters.sha2_128s_simple] = BCObjectIdentifiers.sphincsPlus_sha2_128s; + sphincsPlusOids[SphincsPlusParameters.sha2_128f_simple] = BCObjectIdentifiers.sphincsPlus_sha2_128f; + sphincsPlusOids[SphincsPlusParameters.shake_128s_simple] = BCObjectIdentifiers.sphincsPlus_shake_128s; + sphincsPlusOids[SphincsPlusParameters.shake_128f_simple] = BCObjectIdentifiers.sphincsPlus_shake_128f; + sphincsPlusOids[SphincsPlusParameters.sha2_192s_simple] = BCObjectIdentifiers.sphincsPlus_sha2_192s; + sphincsPlusOids[SphincsPlusParameters.sha2_192f_simple] = BCObjectIdentifiers.sphincsPlus_sha2_192f; + sphincsPlusOids[SphincsPlusParameters.shake_192s_simple] = BCObjectIdentifiers.sphincsPlus_shake_192s; + sphincsPlusOids[SphincsPlusParameters.shake_192f_simple] = BCObjectIdentifiers.sphincsPlus_shake_192f; + sphincsPlusOids[SphincsPlusParameters.sha2_256s_simple] = BCObjectIdentifiers.sphincsPlus_sha2_256s; + sphincsPlusOids[SphincsPlusParameters.sha2_256f_simple] = BCObjectIdentifiers.sphincsPlus_sha2_256f; + sphincsPlusOids[SphincsPlusParameters.shake_256s_simple] = BCObjectIdentifiers.sphincsPlus_shake_256s; + sphincsPlusOids[SphincsPlusParameters.shake_256f_simple] = BCObjectIdentifiers.sphincsPlus_shake_256f; sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_128s_r3] = SphincsPlusParameters.sha2_128s; sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_128f_r3] = SphincsPlusParameters.sha2_128f; @@ -262,15 +265,18 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_256f_r3] = SphincsPlusParameters.shake_256f; sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_haraka_256s_r3] = SphincsPlusParameters.haraka_256s; sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_haraka_256f_r3] = SphincsPlusParameters.haraka_256f; - sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_128s_simple] = SphincsPlusParameters.sha2_128s_simple; - sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_128f_simple] = SphincsPlusParameters.sha2_128f_simple; - sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_128f_simple] = SphincsPlusParameters.shake_128f_simple; - sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_192s_simple] = SphincsPlusParameters.sha2_192s_simple; - sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_192f_simple] = SphincsPlusParameters.sha2_192f_simple; - sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_192f_simple] = SphincsPlusParameters.shake_192f_simple; - sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_256s_simple] = SphincsPlusParameters.sha2_256s_simple; - sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_256f_simple] = SphincsPlusParameters.sha2_256f_simple; - sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_256f_simple] = SphincsPlusParameters.shake_256f_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_128s] = SphincsPlusParameters.sha2_128s_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_128f] = SphincsPlusParameters.sha2_128f_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_128s] = SphincsPlusParameters.shake_128s_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_128f] = SphincsPlusParameters.shake_128f_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_192s] = SphincsPlusParameters.sha2_192s_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_192f] = SphincsPlusParameters.sha2_192f_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_192s] = SphincsPlusParameters.shake_192s_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_192f] = SphincsPlusParameters.shake_192f_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_256s] = SphincsPlusParameters.sha2_256s_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_sha2_256f] = SphincsPlusParameters.sha2_256f_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_256s] = SphincsPlusParameters.shake_256s_simple; + sphincsPlusParams[BCObjectIdentifiers.sphincsPlus_shake_256f] = SphincsPlusParameters.shake_256f_simple; } internal static DerObjectIdentifier McElieceOidLookup(CmceParameters parameters) |