private AlgorithmParameters getParameters() throws NoSuchAlgorithmException {
    AlgorithmParameters ap = AlgorithmParameters.getInstance(this.getAlgName());
    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    DEROutputStream dOut = new DEROutputStream(bOut);

    try {
      dOut.writeObject(infoObj.getEncryptionAlgorithm().getParameters());
      dOut.close();

      ap.init(bOut.toByteArray());
    } catch (IOException e) {
      throw new NoSuchAlgorithmException("unable to parse parameters");
    }

    return ap;
  }
 /**
  * Returns a copy of the encrypted data.
  *
  * @returns a copy of the encrypted data.
  */
 public byte[] getEncryptedData() {
   return infoObj.getEncryptedData();
 }
 /**
  * Returns the encryption algorithm.
  *
  * @returns the algorithm name.
  */
 public String getAlgName() {
   return infoObj.getEncryptionAlgorithm().getObjectId().getId();
 }