Package org.ejbca.cvc

Examples of org.ejbca.cvc.CVCObject


        olduserStatus = user.getStatus();
        // If user is revoked, we can not proceed
        if ( (olduserStatus == UserDataConstants.STATUS_REVOKED) || (olduserStatus == UserDataConstants.STATUS_HISTORICAL) ) {
          throw new AuthorizationDeniedException("User '"+username+"' is revoked.");
        }
        CVCObject parsedObject = CertificateParser.parseCVCObject(Base64.decode(cvcreq.getBytes()));
        if (parsedObject instanceof CVCAuthenticatedRequest) {
          log.debug("Received an authenticated request, could be an initial DV request signed by CVCA or a renewal for DV or IS.");
          CVCAuthenticatedRequest authreq = (CVCAuthenticatedRequest)parsedObject;
          CVCPublicKey cvcKey = authreq.getRequest().getCertificateBody().getPublicKey();
          String algorithm = AlgorithmUtil.getAlgorithmName(cvcKey.getObjectIdentifier());
View Full Code Here


        // a simple crmf is not a complete PKI message, as desired by the CrmfRequestMessage class
        //PKIMessage msg = PKIMessage.getInstance(new ASN1InputStream(new ByteArrayInputStream(request)).readObject());
        //CrmfRequestMessage reqmsg = new CrmfRequestMessage(msg, null, true, null);
        //imsg = reqmsg;
      } else if (reqType == REQTYPE_CVC) {
        CVCObject parsedObject = CertificateParser.parseCVCObject(Base64.decode(req.getBytes()));
        // We will handle both the case if the request is an authenticated request, i.e. with an outer signature
        // and when the request is missing the (optional) outer signature.
        CVCertificate cvccert = null;
        if (parsedObject instanceof CVCAuthenticatedRequest) {
          CVCAuthenticatedRequest cvcreq = (CVCAuthenticatedRequest)parsedObject;
View Full Code Here

        } catch (CertificateException e) {
          ret = e.getMessage();
      }
    } else if (StringUtils.equals(cert.getType(), "CVC")) {
      final CardVerifiableCertificate cvccert = (CardVerifiableCertificate)cert;
      final CVCObject obj = cvccert.getCVCertificate();
      ret = obj.getAsText("");
    } else {
      throw new IllegalArgumentException("dumpCertificateAsString: Certificate of type "+cert.getType()+" is not implemented");     
    }
        return ret;
    }
View Full Code Here

  public String getCvcDump(final boolean returnMessageOnError) {
    String ret = null;
    final byte[] requestBytes = RequestMessageUtils.getDecodedBytes(bytes);
    try {
      final CVCObject obj = getCVCObject(requestBytes);
      ret = obj.getAsText("");
    } catch (Exception e) {
      // Not a CVC request, perhaps a PKCS10 request
      if (returnMessageOnError) {
        ret = e.getMessage();       
      }
View Full Code Here

    }
    return ret;
  }

  private static CVCObject getCVCObject(final byte[] cvcdata) throws IOException, CvcException, CertificateException {
    CVCObject ret = null;
    try {
      ret = CertificateParser.parseCVCObject(cvcdata);
    } catch (Exception e) {
      try {
        // this was not parseable, try to see it it was a PEM certificate
View Full Code Here

        assertNotNull(certenv);

        Certificate wscert = certenv.get(0);
        byte[] b64cert = wscert.getCertificateData();
        CVCObject parsedObject = CertificateParser.parseCertificate(Base64.decode(b64cert));
        CVCertificate cert = (CVCertificate) parsedObject;
        CardVerifiableCertificate cvcert = new CardVerifiableCertificate(cert);

        assertNotNull(cert);
        assertEquals("CN=" + username + ",C=SE", CertTools.getSubjectDN(cvcert));
View Full Code Here

        // make the mandatory junit checks...
        assertNotNull(request);
        CVCRequestMessage cvcreq = RequestMessageUtils.genCVCRequestMessage(request);
        assertNotNull(cvcreq);
        assertEquals(dvinfo.getSubjectDN(), cvcreq.getRequestDN());
        CVCObject obj = CertificateParser.parseCVCObject(request);
        // System.out.println(obj.getAsText());
        CVCertificate cert = (CVCertificate) obj;
        assertEquals(cvcacert.getCVCertificate().getCertificateBody().getAuthorityReference().getConcatenated(), cert.getCertificateBody()
                .getAuthorityReference().getConcatenated());
View Full Code Here

        assertNotNull(request);
        CVCRequestMessage cvcreq = RequestMessageUtils.genCVCRequestMessage(request);
        assertNotNull(cvcreq);
        CAInfo dvinfo = caAdminSessionRemote.getCAInfo(intAdmin, caname);
        assertEquals(dvinfo.getSubjectDN(), cvcreq.getRequestDN());
        CVCObject obj = CertificateParser.parseCVCObject(request);
        //System.out.println(obj.getAsText());
        // We should have created an authenticated request signed by the old certificate
    CVCAuthenticatedRequest authreq = (CVCAuthenticatedRequest)obj;
    CVCertificate cert = authreq.getRequest();
    // The request should be targeted for the CVCA, i.e. ca_ref in request should be the same as the CVCAs ref
View Full Code Here

              byte[] request = cabean.getRequestData();
                String filename = null;
                CVCertificate cvccert = null;
                boolean isx509cert = false;
                try {
                    CVCObject parsedObject = CertificateParser.parseCVCObject(request);
                    // We will handle both the case if the request is an
                    // authenticated request, i.e. with an outer signature
                    // and when the request is missing the (optional) outer
                    // signature.
                    if (parsedObject instanceof CVCAuthenticatedRequest) {
View Full Code Here

    Object o = ois.readObject();
    Certificate ocert = (Certificate)o;
    assertEquals("CVC", ocert.getType());

    // Test CVC certificate request encoding
    CVCObject parsedObject = CertificateParser.parseCVCObject(cvcreq);
    CVCertificate req = (CVCertificate)parsedObject;
    PublicKey pubKey = req.getCertificateBody().getPublicKey();
    assertNotNull(pubKey);
    assertEquals("CVC", pubKey.getFormat());
    BigInteger modulus = ((RSAPublicKey)pk).getModulus();
View Full Code Here

TOP

Related Classes of org.ejbca.cvc.CVCObject

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.