|
38 | 38 | import org.bouncycastle.pqc.jcajce.provider.hqc.HQCKeyFactorySpi; |
39 | 39 | import org.bouncycastle.pqc.jcajce.provider.kyber.KyberKeyFactorySpi; |
40 | 40 | import org.bouncycastle.pqc.jcajce.provider.lms.LMSKeyFactorySpi; |
| 41 | +import org.bouncycastle.pqc.jcajce.provider.mayo.MayoKeyFactorySpi; |
41 | 42 | import org.bouncycastle.pqc.jcajce.provider.newhope.NHKeyFactorySpi; |
42 | 43 | import org.bouncycastle.pqc.jcajce.provider.ntru.NTRUKeyFactorySpi; |
43 | 44 | import org.bouncycastle.pqc.jcajce.provider.picnic.PicnicKeyFactorySpi; |
@@ -92,73 +93,73 @@ public final class BouncyCastleProvider extends Provider |
92 | 93 | private static final String SYMMETRIC_PACKAGE = "org.bouncycastle.jcajce.provider.symmetric."; |
93 | 94 |
|
94 | 95 | private static final String[] SYMMETRIC_GENERIC = |
95 | | - { |
96 | | - "PBEPBKDF1", "PBEPBKDF2", "PBEPKCS12", "TLSKDF", "SCRYPT" |
97 | | - }; |
| 96 | + { |
| 97 | + "PBEPBKDF1", "PBEPBKDF2", "PBEPKCS12", "TLSKDF", "SCRYPT" |
| 98 | + }; |
98 | 99 |
|
99 | 100 | private static final String[] SYMMETRIC_MACS = |
100 | | - { |
101 | | - "SipHash", "SipHash128", "Poly1305" |
102 | | - }; |
| 101 | + { |
| 102 | + "SipHash", "SipHash128", "Poly1305" |
| 103 | + }; |
103 | 104 |
|
104 | 105 | private static final CryptoServiceProperties[] SYMMETRIC_CIPHERS = |
105 | | - { |
106 | | - // TODO: these numbers need a bit more work, we cap at 256 bits. |
107 | | - service("AES", 256), service("ARC4", 20), service("ARIA", 256), service("Blowfish", 128), service("Camellia", 256), |
108 | | - service("CAST5", 128), service("CAST6", 256), service("ChaCha", 128), service("DES", 56), service("DESede", 112), |
109 | | - service("GOST28147", 128), service("Grainv1", 128), service("Grain128", 128), service("HC128", 128), service("HC256", 256), |
110 | | - service("IDEA", 128), service("Noekeon", 128), service("RC2", 128), service("RC5", 128), service("RC6", 256), |
111 | | - service("Rijndael", 256), service("Salsa20", 128), service("SEED", 128), service("Serpent", 256), service("Shacal2", 128), |
112 | | - service("Skipjack", 80), service("SM4", 128), service("TEA", 128), service("Twofish", 256), service("Threefish", 128), |
113 | | - service("VMPC", 128), service("VMPCKSA3", 128), service("XTEA", 128), service("XSalsa20", 128), service("OpenSSLPBKDF", 128), |
114 | | - service("DSTU7624", 256), service("GOST3412_2015", 256), service("Zuc", 128) |
115 | | - }; |
116 | | - |
117 | | - /* |
| 106 | + { |
| 107 | + // TODO: these numbers need a bit more work, we cap at 256 bits. |
| 108 | + service("AES", 256), service("ARC4", 20), service("ARIA", 256), service("Blowfish", 128), service("Camellia", 256), |
| 109 | + service("CAST5", 128), service("CAST6", 256), service("ChaCha", 128), service("DES", 56), service("DESede", 112), |
| 110 | + service("GOST28147", 128), service("Grainv1", 128), service("Grain128", 128), service("HC128", 128), service("HC256", 256), |
| 111 | + service("IDEA", 128), service("Noekeon", 128), service("RC2", 128), service("RC5", 128), service("RC6", 256), |
| 112 | + service("Rijndael", 256), service("Salsa20", 128), service("SEED", 128), service("Serpent", 256), service("Shacal2", 128), |
| 113 | + service("Skipjack", 80), service("SM4", 128), service("TEA", 128), service("Twofish", 256), service("Threefish", 128), |
| 114 | + service("VMPC", 128), service("VMPCKSA3", 128), service("XTEA", 128), service("XSalsa20", 128), service("OpenSSLPBKDF", 128), |
| 115 | + service("DSTU7624", 256), service("GOST3412_2015", 256), service("Zuc", 128) |
| 116 | + }; |
| 117 | + |
| 118 | + /* |
118 | 119 | * Configurable asymmetric ciphers |
119 | 120 | */ |
120 | 121 | private static final String ASYMMETRIC_PACKAGE = "org.bouncycastle.jcajce.provider.asymmetric."; |
121 | 122 |
|
122 | 123 | // this one is required for GNU class path - it needs to be loaded first as the |
123 | 124 | // later ones configure it. |
124 | 125 | private static final String[] ASYMMETRIC_GENERIC = |
125 | | - { |
126 | | - "X509", "IES", "COMPOSITE", "EXTERNAL", "CompositeSignatures", "NoSig" |
127 | | - }; |
| 126 | + { |
| 127 | + "X509", "IES", "COMPOSITE", "EXTERNAL", "CompositeSignatures", "NoSig" |
| 128 | + }; |
128 | 129 |
|
129 | 130 | private static final String[] ASYMMETRIC_CIPHERS = |
130 | | - { |
131 | | - "DSA", "DH", "EC", "RSA", "GOST", "ECGOST", "ElGamal", "DSTU4145", "GM", "EdEC", "LMS", "SPHINCSPlus", "Dilithium", "Falcon", "NTRU", "CONTEXT", "SLHDSA", "MLDSA", "MLKEM" |
132 | | - }; |
| 131 | + { |
| 132 | + "DSA", "DH", "EC", "RSA", "GOST", "ECGOST", "ElGamal", "DSTU4145", "GM", "EdEC", "LMS", "SPHINCSPlus", "Dilithium", "Falcon", "NTRU", "CONTEXT", "SLHDSA", "MLDSA", "MLKEM" |
| 133 | + }; |
133 | 134 |
|
134 | 135 | /* |
135 | 136 | * Configurable digests |
136 | 137 | */ |
137 | 138 | private static final String DIGEST_PACKAGE = "org.bouncycastle.jcajce.provider.digest."; |
138 | 139 | private static final String[] DIGESTS = |
139 | | - { |
140 | | - "GOST3411", "Keccak", "MD2", "MD4", "MD5", "SHA1", "RIPEMD128", "RIPEMD160", "RIPEMD256", "RIPEMD320", "SHA224", |
141 | | - "SHA256", "SHA384", "SHA512", "SHA3", "Skein", "SM3", "Tiger", "Whirlpool", "Blake2b", "Blake2s", "DSTU7564", |
142 | | - "Haraka", "Blake3" |
143 | | - }; |
| 140 | + { |
| 141 | + "GOST3411", "Keccak", "MD2", "MD4", "MD5", "SHA1", "RIPEMD128", "RIPEMD160", "RIPEMD256", "RIPEMD320", "SHA224", |
| 142 | + "SHA256", "SHA384", "SHA512", "SHA3", "Skein", "SM3", "Tiger", "Whirlpool", "Blake2b", "Blake2s", "DSTU7564", |
| 143 | + "Haraka", "Blake3" |
| 144 | + }; |
144 | 145 |
|
145 | 146 | /* |
146 | 147 | * Configurable keystores |
147 | 148 | */ |
148 | 149 | private static final String KEYSTORE_PACKAGE = "org.bouncycastle.jcajce.provider.keystore."; |
149 | 150 | private static final String[] KEYSTORES = |
150 | | - { |
151 | | - "BC", "BCFKS", "PKCS12" |
152 | | - }; |
| 151 | + { |
| 152 | + "BC", "BCFKS", "PKCS12" |
| 153 | + }; |
153 | 154 |
|
154 | 155 | /* |
155 | 156 | * Configurable secure random |
156 | 157 | */ |
157 | 158 | private static final String SECURE_RANDOM_PACKAGE = "org.bouncycastle.jcajce.provider.drbg."; |
158 | 159 | private static final String[] SECURE_RANDOMS = |
159 | | - { |
160 | | - "DRBG" |
161 | | - }; |
| 160 | + { |
| 161 | + "DRBG" |
| 162 | + }; |
162 | 163 |
|
163 | 164 | private Map<String, Service> serviceMap = new ConcurrentHashMap<String, Service>(); |
164 | 165 |
|
@@ -437,6 +438,11 @@ private void loadPQCKeys() |
437 | 438 | addKeyInfoConverter(BCObjectIdentifiers.ntruhps2048677, new NTRUKeyFactorySpi()); |
438 | 439 | addKeyInfoConverter(BCObjectIdentifiers.ntruhps4096821, new NTRUKeyFactorySpi()); |
439 | 440 | addKeyInfoConverter(BCObjectIdentifiers.ntruhrss701, new NTRUKeyFactorySpi()); |
| 441 | + |
| 442 | + addKeyInfoConverter(BCObjectIdentifiers.mayo1, new MayoKeyFactorySpi()); |
| 443 | + addKeyInfoConverter(BCObjectIdentifiers.mayo2, new MayoKeyFactorySpi()); |
| 444 | + addKeyInfoConverter(BCObjectIdentifiers.mayo3, new MayoKeyFactorySpi()); |
| 445 | + addKeyInfoConverter(BCObjectIdentifiers.mayo5, new MayoKeyFactorySpi()); |
440 | 446 | } |
441 | 447 |
|
442 | 448 | public void setParameter(String parameterName, Object parameter) |
@@ -480,7 +486,7 @@ public void addAlgorithm(String type, ASN1ObjectIdentifier oid, String className |
480 | 486 | addAttributes(type + "." + oid, attributes); |
481 | 487 | addAttributes(type + ".OID." + oid, attributes); |
482 | 488 | } |
483 | | - |
| 489 | + |
484 | 490 | public void addKeyInfoConverter(ASN1ObjectIdentifier oid, AsymmetricKeyInfoConverter keyInfoConverter) |
485 | 491 | { |
486 | 492 | synchronized (keyInfoConverters) |
|
0 commit comments