Skip to content

Commit ec7aa59

Browse files
committed
fixed pre-hash signature from oid case
1 parent 3e0e52c commit ec7aa59

File tree

1 file changed

+39
-29
lines changed
  • prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric

1 file changed

+39
-29
lines changed

prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/SLHDSA.java

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ public void configure(ConfigurableProvider provider)
5454
addKeyFactoryAlgorithm(provider, "SLH-DSA-SHAKE-192F-WITH-SHAKE256", PREFIX + "SLHDSAKeyFactorySpi$HashShake_192f", NISTObjectIdentifiers.id_hash_slh_dsa_shake_192f_with_shake256, keyFact);
5555
addKeyFactoryAlgorithm(provider, "SLH-DSA-SHAKE-256S-WITH-SHAKE256", PREFIX + "SLHDSAKeyFactorySpi$HashShake_256s", NISTObjectIdentifiers.id_hash_slh_dsa_shake_256s_with_shake256, keyFact);
5656
addKeyFactoryAlgorithm(provider, "SLH-DSA-SHAKE-256F-WITH-SHAKE256", PREFIX + "SLHDSAKeyFactorySpi$HashShake_256f", NISTObjectIdentifiers.id_hash_slh_dsa_shake_256f_with_shake256, keyFact);
57-
57+
5858
addKeyPairGeneratorAlgorithm(provider, "SLH-DSA-SHA2-128S", PREFIX + "SLHDSAKeyPairGeneratorSpi$Sha2_128s", NISTObjectIdentifiers.id_slh_dsa_sha2_128s);
5959
addKeyPairGeneratorAlgorithm(provider, "SLH-DSA-SHA2-128F", PREFIX + "SLHDSAKeyPairGeneratorSpi$Sha2_128f", NISTObjectIdentifiers.id_slh_dsa_sha2_128f);
6060
addKeyPairGeneratorAlgorithm(provider, "SLH-DSA-SHA2-192S", PREFIX + "SLHDSAKeyPairGeneratorSpi$Sha2_192s", NISTObjectIdentifiers.id_slh_dsa_sha2_192s);
6161
addKeyPairGeneratorAlgorithm(provider, "SLH-DSA-SHA2-192F", PREFIX + "SLHDSAKeyPairGeneratorSpi$Sha2_192f", NISTObjectIdentifiers.id_slh_dsa_sha2_192f);
6262
addKeyPairGeneratorAlgorithm(provider, "SLH-DSA-SHA2-256S", PREFIX + "SLHDSAKeyPairGeneratorSpi$Sha2_256s", NISTObjectIdentifiers.id_slh_dsa_sha2_256s);
6363
addKeyPairGeneratorAlgorithm(provider, "SLH-DSA-SHA2-256F", PREFIX + "SLHDSAKeyPairGeneratorSpi$Sha2_256f", NISTObjectIdentifiers.id_slh_dsa_sha2_256f);
64-
64+
6565
addKeyPairGeneratorAlgorithm(provider, "SLH-DSA-SHAKE-128S", PREFIX + "SLHDSAKeyPairGeneratorSpi$Shake_128s", NISTObjectIdentifiers.id_slh_dsa_shake_128s);
6666
addKeyPairGeneratorAlgorithm(provider, "SLH-DSA-SHAKE-128F", PREFIX + "SLHDSAKeyPairGeneratorSpi$Shake_128f", NISTObjectIdentifiers.id_slh_dsa_shake_128f);
6767
addKeyPairGeneratorAlgorithm(provider, "SLH-DSA-SHAKE-192S", PREFIX + "SLHDSAKeyPairGeneratorSpi$Shake_192s", NISTObjectIdentifiers.id_slh_dsa_shake_192s);
@@ -89,38 +89,48 @@ public void configure(ConfigurableProvider provider)
8989
provider.addAlgorithm("Alg.Alias.Signature.HASHWITHSLHDSA", "HASH-SLH-DSA");
9090

9191
ASN1ObjectIdentifier[] nistOids = new ASN1ObjectIdentifier[]
92-
{
93-
NISTObjectIdentifiers.id_slh_dsa_sha2_128s,
94-
NISTObjectIdentifiers.id_slh_dsa_sha2_128f,
95-
NISTObjectIdentifiers.id_slh_dsa_shake_128s,
96-
NISTObjectIdentifiers.id_slh_dsa_shake_128f,
97-
NISTObjectIdentifiers.id_slh_dsa_sha2_192s,
98-
NISTObjectIdentifiers.id_slh_dsa_sha2_192f,
99-
NISTObjectIdentifiers.id_slh_dsa_shake_192s,
100-
NISTObjectIdentifiers.id_slh_dsa_shake_192f,
101-
NISTObjectIdentifiers.id_slh_dsa_sha2_256s,
102-
NISTObjectIdentifiers.id_slh_dsa_sha2_256f,
103-
NISTObjectIdentifiers.id_slh_dsa_shake_256s,
104-
NISTObjectIdentifiers.id_slh_dsa_shake_256f,
105-
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_128s_with_sha256,
106-
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_128f_with_sha256,
107-
NISTObjectIdentifiers.id_hash_slh_dsa_shake_128s_with_shake128,
108-
NISTObjectIdentifiers.id_hash_slh_dsa_shake_128f_with_shake128,
109-
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_192s_with_sha512,
110-
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_192f_with_sha512,
111-
NISTObjectIdentifiers.id_hash_slh_dsa_shake_192s_with_shake256,
112-
NISTObjectIdentifiers.id_hash_slh_dsa_shake_192f_with_shake256,
113-
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_256s_with_sha512,
114-
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_256f_with_sha512,
115-
NISTObjectIdentifiers.id_hash_slh_dsa_shake_256s_with_shake256,
116-
NISTObjectIdentifiers.id_hash_slh_dsa_shake_256f_with_shake256
117-
};
118-
92+
{
93+
NISTObjectIdentifiers.id_slh_dsa_sha2_128s,
94+
NISTObjectIdentifiers.id_slh_dsa_sha2_128f,
95+
NISTObjectIdentifiers.id_slh_dsa_shake_128s,
96+
NISTObjectIdentifiers.id_slh_dsa_shake_128f,
97+
NISTObjectIdentifiers.id_slh_dsa_sha2_192s,
98+
NISTObjectIdentifiers.id_slh_dsa_sha2_192f,
99+
NISTObjectIdentifiers.id_slh_dsa_shake_192s,
100+
NISTObjectIdentifiers.id_slh_dsa_shake_192f,
101+
NISTObjectIdentifiers.id_slh_dsa_sha2_256s,
102+
NISTObjectIdentifiers.id_slh_dsa_sha2_256f,
103+
NISTObjectIdentifiers.id_slh_dsa_shake_256s,
104+
NISTObjectIdentifiers.id_slh_dsa_shake_256f
105+
};
106+
119107
for (int i = 0; i != nistOids.length; i++)
120108
{
121109
provider.addAlgorithm("Alg.Alias.Signature." + nistOids[i], "SLH-DSA");
122110
provider.addAlgorithm("Alg.Alias.Signature.OID." + nistOids[i], "SLH-DSA");
123111
}
112+
113+
nistOids = new ASN1ObjectIdentifier[]
114+
{
115+
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_128s_with_sha256,
116+
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_128f_with_sha256,
117+
NISTObjectIdentifiers.id_hash_slh_dsa_shake_128s_with_shake128,
118+
NISTObjectIdentifiers.id_hash_slh_dsa_shake_128f_with_shake128,
119+
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_192s_with_sha512,
120+
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_192f_with_sha512,
121+
NISTObjectIdentifiers.id_hash_slh_dsa_shake_192s_with_shake256,
122+
NISTObjectIdentifiers.id_hash_slh_dsa_shake_192f_with_shake256,
123+
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_256s_with_sha512,
124+
NISTObjectIdentifiers.id_hash_slh_dsa_sha2_256f_with_sha512,
125+
NISTObjectIdentifiers.id_hash_slh_dsa_shake_256s_with_shake256,
126+
NISTObjectIdentifiers.id_hash_slh_dsa_shake_256f_with_shake256
127+
};
128+
129+
for (int i = 0; i != nistOids.length; i++)
130+
{
131+
provider.addAlgorithm("Alg.Alias.Signature." + nistOids[i], "HASH-SLH-DSA");
132+
provider.addAlgorithm("Alg.Alias.Signature.OID." + nistOids[i], "HASH-SLH-DSA");
133+
}
124134
}
125135
}
126136
}

0 commit comments

Comments
 (0)