AlgorithmIdentifier getAlgorithmIdentifier(
      ASN1ObjectIdentifier encryptionOID, AlgorithmParameters params) throws CMSException {
    ASN1Encodable asn1Params;
    if (params != null) {
      asn1Params = CMSUtils.extractParameters(params);
    } else {
      asn1Params = DERNull.INSTANCE;
    }

    return new AlgorithmIdentifier(encryptionOID, asn1Params);
  }