PageRenderTime 35ms CodeModel.GetById 17ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 1ms

/extern/spongycastle/prov/src/main/java/org/spongycastle/jcajce/provider/asymmetric/DSA.java

https://gitlab.com/vizilo/fdroidclient
Java | 70 lines | 55 code | 15 blank | 0 comment | 2 complexity | 80d6fc9a58bf58026cb8f949ad5044f3 MD5 | raw file
 1package org.spongycastle.jcajce.provider.asymmetric;
 2
 3import org.spongycastle.asn1.nist.NISTObjectIdentifiers;
 4import org.spongycastle.jcajce.provider.asymmetric.dsa.DSAUtil;
 5import org.spongycastle.jcajce.provider.asymmetric.dsa.KeyFactorySpi;
 6import org.spongycastle.jcajce.provider.config.ConfigurableProvider;
 7import org.spongycastle.jcajce.provider.util.AsymmetricAlgorithmProvider;
 8import org.spongycastle.jcajce.provider.util.AsymmetricKeyInfoConverter;
 9
10public class DSA
11{
12    private static final String PREFIX = "org.spongycastle.jcajce.provider.asymmetric" + ".dsa.";
13
14    public static class Mappings
15        extends AsymmetricAlgorithmProvider
16    {
17        public Mappings()
18        {
19        }
20        
21        public void configure(ConfigurableProvider provider)
22        {
23            provider.addAlgorithm("AlgorithmParameters.DSA", PREFIX + "AlgorithmParametersSpi");
24
25            provider.addAlgorithm("AlgorithmParameterGenerator.DSA", PREFIX + "AlgorithmParameterGeneratorSpi");
26
27            provider.addAlgorithm("KeyPairGenerator.DSA", PREFIX + "KeyPairGeneratorSpi");
28            provider.addAlgorithm("KeyFactory.DSA", PREFIX + "KeyFactorySpi");
29
30            provider.addAlgorithm("Signature.DSA", PREFIX + "DSASigner$stdDSA");
31            provider.addAlgorithm("Signature.NONEWITHDSA", PREFIX + "DSASigner$noneDSA");
32
33            provider.addAlgorithm("Alg.Alias.Signature.RAWDSA", "NONEWITHDSA");
34
35            provider.addAlgorithm("Signature.DETDSA", PREFIX + "DSASigner$detDSA");
36            provider.addAlgorithm("Signature.SHA1WITHDETDSA", PREFIX + "DSASigner$detDSA");
37            provider.addAlgorithm("Signature.SHA224WITHDETDSA", PREFIX + "DSASigner$detDSA224");
38            provider.addAlgorithm("Signature.SHA256WITHDETDSA", PREFIX + "DSASigner$detDSA256");
39            provider.addAlgorithm("Signature.SHA384WITHDETDSA", PREFIX + "DSASigner$detDSA384");
40            provider.addAlgorithm("Signature.SHA512WITHDETDSA", PREFIX + "DSASigner$detDSA512");
41
42            addSignatureAlgorithm(provider, "SHA224", "DSA", PREFIX + "DSASigner$dsa224", NISTObjectIdentifiers.dsa_with_sha224);
43            addSignatureAlgorithm(provider, "SHA256", "DSA", PREFIX + "DSASigner$dsa256", NISTObjectIdentifiers.dsa_with_sha256);
44            addSignatureAlgorithm(provider, "SHA384", "DSA", PREFIX + "DSASigner$dsa384", NISTObjectIdentifiers.dsa_with_sha384);
45            addSignatureAlgorithm(provider, "SHA512", "DSA", PREFIX + "DSASigner$dsa512", NISTObjectIdentifiers.dsa_with_sha512);
46
47            provider.addAlgorithm("Alg.Alias.Signature.SHA/DSA", "DSA");
48            provider.addAlgorithm("Alg.Alias.Signature.SHA1withDSA", "DSA");
49            provider.addAlgorithm("Alg.Alias.Signature.SHA1WITHDSA", "DSA");
50            provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "DSA");
51            provider.addAlgorithm("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "DSA");
52            provider.addAlgorithm("Alg.Alias.Signature.DSAwithSHA1", "DSA");
53            provider.addAlgorithm("Alg.Alias.Signature.DSAWITHSHA1", "DSA");
54            provider.addAlgorithm("Alg.Alias.Signature.SHA1WithDSA", "DSA");
55            provider.addAlgorithm("Alg.Alias.Signature.DSAWithSHA1", "DSA");
56
57            provider.addAlgorithm("Alg.Alias.Signature.1.2.840.10040.4.3", "DSA");
58
59            AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi();
60
61            for (int i = 0; i != DSAUtil.dsaOids.length; i++)
62            {
63                provider.addAlgorithm("Alg.Alias.Signature." + DSAUtil.dsaOids[i], "DSA");
64
65                registerOid(provider, DSAUtil.dsaOids[i], "DSA", keyFact);
66                registerOidAlgorithmParameters(provider, DSAUtil.dsaOids[i], "DSA");
67            }
68        }
69    }
70}