• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.bouncycastle.jcajce.provider.digest;
2 
3 import org.bouncycastle.asn1.ASN1ObjectIdentifier;
4 import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
5 import org.bouncycastle.jcajce.provider.util.AlgorithmProvider;
6 
7 abstract class DigestAlgorithmProvider
8     extends AlgorithmProvider
9 {
addHMACAlgorithm( ConfigurableProvider provider, String algorithm, String algorithmClassName, String keyGeneratorClassName)10     protected void addHMACAlgorithm(
11         ConfigurableProvider provider,
12         String algorithm,
13         String algorithmClassName,
14         String keyGeneratorClassName)
15     {
16         String mainName = "HMAC" + algorithm;
17 
18         provider.addAlgorithm("Mac." + mainName, algorithmClassName);
19         provider.addAlgorithm("Alg.Alias.Mac.HMAC-" + algorithm, mainName);
20         provider.addAlgorithm("Alg.Alias.Mac.HMAC/" + algorithm, mainName);
21         provider.addAlgorithm("KeyGenerator." + mainName, keyGeneratorClassName);
22         provider.addAlgorithm("Alg.Alias.KeyGenerator.HMAC-" + algorithm, mainName);
23         provider.addAlgorithm("Alg.Alias.KeyGenerator.HMAC/" + algorithm, mainName);
24     }
25 
addHMACAlias( ConfigurableProvider provider, String algorithm, ASN1ObjectIdentifier oid)26     protected void addHMACAlias(
27         ConfigurableProvider provider,
28         String algorithm,
29         ASN1ObjectIdentifier oid)
30     {
31         String mainName = "HMAC" + algorithm;
32 
33         provider.addAlgorithm("Alg.Alias.Mac." + oid, mainName);
34         provider.addAlgorithm("Alg.Alias.KeyGenerator." + oid, mainName);
35     }
36 }
37