Home | History | Annotate | Download | only in jcajce
      1 package org.bouncycastle.jcajce;
      2 
      3 import java.security.AlgorithmParameterGenerator;
      4 import java.security.AlgorithmParameters;
      5 import java.security.KeyFactory;
      6 import java.security.KeyPairGenerator;
      7 import java.security.MessageDigest;
      8 import java.security.NoSuchAlgorithmException;
      9 import java.security.Signature;
     10 import java.security.cert.CertificateException;
     11 import java.security.cert.CertificateFactory;
     12 
     13 import javax.crypto.Cipher;
     14 import javax.crypto.KeyAgreement;
     15 import javax.crypto.KeyGenerator;
     16 import javax.crypto.Mac;
     17 import javax.crypto.NoSuchPaddingException;
     18 import javax.crypto.SecretKeyFactory;
     19 
     20 public class DefaultJcaJceHelper
     21     implements JcaJceHelper
     22 {
     23     public Cipher createCipher(
     24         String algorithm)
     25         throws NoSuchAlgorithmException, NoSuchPaddingException
     26     {
     27         return Cipher.getInstance(algorithm);
     28     }
     29 
     30     public Mac createMac(String algorithm)
     31         throws NoSuchAlgorithmException
     32     {
     33         return Mac.getInstance(algorithm);
     34     }
     35 
     36     public KeyAgreement createKeyAgreement(String algorithm)
     37         throws NoSuchAlgorithmException
     38     {
     39         return KeyAgreement.getInstance(algorithm);
     40     }
     41 
     42     public AlgorithmParameterGenerator createAlgorithmParameterGenerator(String algorithm)
     43         throws NoSuchAlgorithmException
     44     {
     45         return AlgorithmParameterGenerator.getInstance(algorithm);
     46     }
     47 
     48     public AlgorithmParameters createAlgorithmParameters(String algorithm)
     49         throws NoSuchAlgorithmException
     50     {
     51         return AlgorithmParameters.getInstance(algorithm);
     52     }
     53 
     54     public KeyGenerator createKeyGenerator(String algorithm)
     55         throws NoSuchAlgorithmException
     56     {
     57         return KeyGenerator.getInstance(algorithm);
     58     }
     59 
     60     public KeyFactory createKeyFactory(String algorithm)
     61         throws NoSuchAlgorithmException
     62     {
     63         return KeyFactory.getInstance(algorithm);
     64     }
     65 
     66     public SecretKeyFactory createSecretKeyFactory(String algorithm)
     67         throws NoSuchAlgorithmException
     68     {
     69         return SecretKeyFactory.getInstance(algorithm);
     70     }
     71 
     72     public KeyPairGenerator createKeyPairGenerator(String algorithm)
     73         throws NoSuchAlgorithmException
     74     {
     75         return KeyPairGenerator.getInstance(algorithm);
     76     }
     77 
     78     public MessageDigest createDigest(String algorithm)
     79         throws NoSuchAlgorithmException
     80     {
     81         return MessageDigest.getInstance(algorithm);
     82     }
     83 
     84     public Signature createSignature(String algorithm)
     85         throws NoSuchAlgorithmException
     86     {
     87         return Signature.getInstance(algorithm);
     88     }
     89 
     90     public CertificateFactory createCertificateFactory(String algorithm)
     91         throws NoSuchAlgorithmException, CertificateException
     92     {
     93         return CertificateFactory.getInstance(algorithm);
     94     }
     95 }
     96