Package org.ejbca.cvc

Examples of org.ejbca.cvc.CardVerifiableCertificate


    }

    public static String getFileNameFromCertNoEnding(Certificate cacert, String defaultname) throws NoSuchFieldException {
      String dnpart = null;
      if (StringUtils.equals(cacert.getType(), "CVC")) {
        CardVerifiableCertificate cvccert = (CardVerifiableCertificate) cacert;
        String car = "car";
        CAReferenceField carf = cvccert.getCVCertificate().getCertificateBody().getAuthorityReference();
        if (carf != null) {
          car = carf.getConcatenated();
        }
        String chr = "chr";
        HolderReferenceField chrf = cvccert.getCVCertificate().getCertificateBody().getHolderReference();
        if (chrf != null) {
          chr = chrf.getConcatenated();
        }
        dnpart = car + "_" + chr;
      } else {
View Full Code Here


          retval = localizedEndEntityText;  //ejbcawebbean.getText("EXT_PKIX_BC_ENDENTITY");
        } else {
          retval = localizedCaPathLengthText /*ejbcawebbean.getText("EXT_PKIX_BC_CAPATHLENGTH")*/ + " : " + x509cert.getBasicConstraints();                                
        }
      } else if (certificate.getType().equals("CVC")) {
        CardVerifiableCertificate cvccert = (CardVerifiableCertificate)certificate;
        try {
          retval = cvccert.getCVCertificate().getCertificateBody().getAuthorizationTemplate().getAuthorizationField().getRole().name();
        } catch (NoSuchFieldException e) {
            retval = localizedNoneText;  //ejbcawebbean.getText("EXT_NONE");
        }
      }
      return retval;
View Full Code Here

   * @throws AuthorizationDeniedException
   */
  private void checkInnerCollision(PublicKey pk, CVCertificate innerreq, String holderref) throws AuthorizationDeniedException {
    // Check to see that the inner signature does not verify using an old certificate (public key)
    // because that means the same keys were used, and that is not allowed according to the EU policy
    CardVerifiableCertificate innercert = new CardVerifiableCertificate(innerreq);
    try {
      innercert.verify(pk);                   
      String msg = intres.getLocalizedMessage("cvc.error.renewsamekeys", holderref);             
      log.info(msg);
      throw new AuthorizationDeniedException(msg);
    } catch (SignatureException e) {
      // It was good if the verification failed
View Full Code Here

      // Finally generate the certificate (assuming status is NEW and password is correct
      byte[] response = processCertReq(username, password, cvcreq, REQTYPE_CVC, null, CertificateHelper.RESPONSETYPE_CERTIFICATE, logger);
      CertificateResponse ret = new CertificateResponse(CertificateHelper.RESPONSETYPE_CERTIFICATE, response);
      byte[] b64cert = ret.getData();
      CVCertificate certObject = CertificateParser.parseCertificate(Base64.decode(b64cert));
      java.security.cert.Certificate iscert = new CardVerifiableCertificate(certObject);
      ArrayList<Certificate> retval = new ArrayList<Certificate>();
      retval.add(new Certificate((java.security.cert.Certificate)iscert));
      // Get the certificate chain
      if (user != null) {
        int caid = user.getCAId();
View Full Code Here

              log.info("Could not get DN from X509Certificate. " + ce.getMessage());
                log.debug("", ce);
                return null;
            }
    } else if (StringUtils.equals(cert.getType(), "CVC")) {
      CardVerifiableCertificate cvccert = (CardVerifiableCertificate)cert;
      try {
        ReferenceField rf = null;
                if (which == 1) {
            rf = cvccert.getCVCertificate().getCertificateBody().getHolderReference();                 
                } else {
            rf = cvccert.getCVCertificate().getCertificateBody().getAuthorityReference();                 
                }
                if (rf != null) {
            // Construct a "fake" DN which can be used in EJBCA
                    // Use only mnemonic and country, since sequence is more of a serialnumber than a DN part
            String dn = "";
View Full Code Here

      X509Certificate xcert = (X509Certificate) cert;
      ret = xcert.getSerialNumber();
    } else if (StringUtils.equals(cert.getType(), "CVC")) {
      // For CVC certificates the sequence field of the HolderReference is kind of a serial number,
      // but if can be alphanumeric which means it can not be made into a BigInteger
      CardVerifiableCertificate cvccert = (CardVerifiableCertificate)cert;
      try {
        String sequence = cvccert.getCVCertificate().getCertificateBody().getHolderReference().getSequence();
        ret = getSerialNumberFromString(sequence);
      } catch (NoSuchFieldException e) {
              log.error("getSerialNumber: NoSuchFieldException: ", e);
        ret = BigInteger.valueOf(0);
      }
View Full Code Here

      X509Certificate xcert = (X509Certificate) cert;
      ret = xcert.getSerialNumber().toString(16).toUpperCase();
    } else if (StringUtils.equals(cert.getType(), "CVC")) {
      // For CVC certificates the sequence field of the HolderReference is kind of a serial number,
      // but if can be alphanumeric which means it can not be made into a BigInteger
      CardVerifiableCertificate cvccert = (CardVerifiableCertificate)cert;
      try {
        ret = cvccert.getCVCertificate().getCertificateBody().getHolderReference().getSequence();
      } catch (NoSuchFieldException e) {
              log.error("getSerialNumber: NoSuchFieldException: ", e);
        ret = "N/A";
      }
    } else {
View Full Code Here

      } else {
        if (cert instanceof X509Certificate) {
          X509Certificate xcert = (X509Certificate) cert;
          ret = xcert.getSignature();
        } else if (StringUtils.equals(cert.getType(), "CVC")) {
          CardVerifiableCertificate cvccert = (CardVerifiableCertificate)cert;
          try {
          ret = cvccert.getCVCertificate().getSignature();
        } catch (NoSuchFieldException e) {
                log.error("NoSuchFieldException: ", e);
                return null;
        }
        }       
View Full Code Here

      }
      if (cert instanceof X509Certificate) {
      X509Certificate xcert = (X509Certificate) cert;
      ret = xcert.getNotBefore();
    } else if (StringUtils.equals(cert.getType(), "CVC")) {
      CardVerifiableCertificate cvccert = (CardVerifiableCertificate)cert;
      try {
        ret = cvccert.getCVCertificate().getCertificateBody().getValidFrom();
      } catch (NoSuchFieldException e) {
        // it is not uncommon that this field is missing in CVC certificate requests (it's not in the EAC standard so)
              log.debug("NoSuchFieldException: "+ e.getMessage());
              return null;
      }
View Full Code Here

      }
      if (cert instanceof X509Certificate) {
      X509Certificate xcert = (X509Certificate) cert;
      ret = xcert.getNotAfter();
    } else if (StringUtils.equals(cert.getType(), "CVC")) {
      CardVerifiableCertificate cvccert = (CardVerifiableCertificate)cert;
      try {
        ret = cvccert.getCVCertificate().getCertificateBody().getValidTo();
      } catch (NoSuchFieldException e) {
        // it is not uncommon that this field is missing in CVC certificate requests (it's not in the EAC standard so)
              log.debug("NoSuchFieldException: "+ e.getMessage());
              return null;
      }
View Full Code Here

TOP

Related Classes of org.ejbca.cvc.CardVerifiableCertificate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.