public String toString() {
    StringBuffer buf = new StringBuffer();
    String nl = System.getProperty("line.separator");

    buf.append("      userCertificate: ").append(this.getSerialNumber()).append(nl);
    buf.append("       revocationDate: ").append(this.getRevocationDate()).append(nl);
    buf.append("       certificateIssuer: ").append(this.getCertificateIssuer()).append(nl);

    Extensions extensions = c.getExtensions();

    if (extensions != null) {
      Enumeration e = extensions.oids();
      if (e.hasMoreElements()) {
        buf.append("   crlEntryExtensions:").append(nl);

        while (e.hasMoreElements()) {
          ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) e.nextElement();
          Extension ext = extensions.getExtension(oid);
          if (ext.getExtnValue() != null) {
            byte[] octs = ext.getExtnValue().getOctets();
            ASN1InputStream dIn = new ASN1InputStream(octs);
            buf.append("                       critical(").append(ext.isCritical()).append(") ");
            try {
              if (oid.equals(X509Extension.reasonCode)) {
                buf.append(CRLReason.getInstance(ASN1Enumerated.getInstance(dIn.readObject())))
                    .append(nl);
              } else if (oid.equals(X509Extension.certificateIssuer)) {
                buf.append("Certificate issuer: ")
                    .append(GeneralNames.getInstance(dIn.readObject()))
                    .append(nl);
              } else {
                buf.append(oid.getId());
                buf.append(" value = ").append(ASN1Dump.dumpAsString(dIn.readObject())).append(nl);
              }
            } catch (Exception ex) {
              buf.append(oid.getId());
              buf.append(" value = ").append("*****").append(nl);
            }
          } else {
            buf.append(nl);
          }
        }
      }
    }

    return buf.toString();
  }
  private void init(ASN1ObjectIdentifier keyAgreementOID) throws CMSException {
    if (random == null) {
      random = new SecureRandom();
    }

    if (keyAgreementOID.equals(CMSAlgorithm.ECMQV_SHA1KDF)) {
      if (ephemeralKP == null) {
        try {
          ECParameterSpec ecParamSpec = ((ECPublicKey) senderPublicKey).getParams();

          KeyPairGenerator ephemKPG = helper.createKeyPairGenerator(keyAgreementOID);

          ephemKPG.initialize(ecParamSpec, random);

          ephemeralKP = ephemKPG.generateKeyPair();
        } catch (InvalidAlgorithmParameterException e) {
          throw new CMSException(
              "cannot determine MQV ephemeral key pair parameters from public key: " + e);
        }
      }
    }
  }