AlgorithmParameters createAlgorithmParameters(ASN1ObjectIdentifier algorithm)
      throws NoSuchAlgorithmException, NoSuchProviderException {
    String algorithmName = (String) BASE_CIPHER_NAMES.get(algorithm);

    if (algorithmName != null) {
      try {
        // this is reversed as the Sun policy files now allow unlimited strength RSA
        return helper.createAlgorithmParameters(algorithmName);
      } catch (NoSuchAlgorithmException e) {
        // Ignore
      }
    }
    return helper.createAlgorithmParameters(algorithm.getId());
  }
  public KeyFactory createKeyFactory(ASN1ObjectIdentifier algorithm) throws CMSException {
    try {
      String cipherName = (String) BASE_CIPHER_NAMES.get(algorithm);

      if (cipherName != null) {
        try {
          // this is reversed as the Sun policy files now allow unlimited strength RSA
          return helper.createKeyFactory(cipherName);
        } catch (NoSuchAlgorithmException e) {
          // Ignore
        }
      }
      return helper.createKeyFactory(algorithm.getId());
    } catch (GeneralSecurityException e) {
      throw new CMSException("cannot create key factory: " + e.getMessage(), e);
    }
  }
  Mac createMac(ASN1ObjectIdentifier algorithm) throws CMSException {
    try {
      String macName = (String) MAC_ALG_NAMES.get(algorithm);

      if (macName != null) {
        try {
          // this is reversed as the Sun policy files now allow unlimited strength RSA
          return helper.createMac(macName);
        } catch (NoSuchAlgorithmException e) {
          // Ignore
        }
      }
      return helper.createMac(algorithm.getId());
    } catch (GeneralSecurityException e) {
      throw new CMSException("cannot create mac: " + e.getMessage(), e);
    }
  }
  Cipher createRFC3211Wrapper(ASN1ObjectIdentifier algorithm) throws CMSException {
    String cipherName = (String) BASE_CIPHER_NAMES.get(algorithm);

    if (cipherName == null) {
      throw new CMSException("no name for " + algorithm);
    }

    cipherName += "RFC3211Wrap";

    try {
      return helper.createCipher(cipherName);
    } catch (GeneralSecurityException e) {
      throw new CMSException("cannot create cipher: " + e.getMessage(), e);
    }
  }
 public SymmetricKeyUnwrapper createSymmetricUnwrapper(
     AlgorithmIdentifier keyEncryptionAlgorithm, SecretKey keyEncryptionKey) {
   return helper.createSymmetricUnwrapper(keyEncryptionAlgorithm, keyEncryptionKey);
 }
 public JceAsymmetricKeyUnwrapper createAsymmetricUnwrapper(
     AlgorithmIdentifier keyEncryptionAlgorithm, PrivateKey keyEncryptionKey) {
   return helper.createAsymmetricUnwrapper(keyEncryptionAlgorithm, keyEncryptionKey);
 }