Package org.w3._2000._09.xmldsig_

Examples of org.w3._2000._09.xmldsig_.DSAKeyValueType


            RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
            revokeRequestType.setId(reqId);
            revokeRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);           
            revokeRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_PRIVATEKEY);
           
            X509DataType x509DataType = sigFactory.createX509DataType();
            x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(orgCert.getEncoded()));
            KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
            keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
           
            String keyBindingId = "_" + CertTools.getSerialNumber(orgCert).toString();
            KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();               
View Full Code Here


     }

     if(req.getRespondWith().contains(XKMSConstants.RESPONDWITH_X509CERT) ||
         req.getRespondWith().contains(XKMSConstants.RESPONDWITH_X509CHAIN) ||
         req.getRespondWith().contains(XKMSConstants.RESPONDWITH_X509CRL)){
           X509DataType x509DataType = sigFactory.createX509DataType();
       if(req.getRespondWith().contains(XKMSConstants.RESPONDWITH_X509CERT) && !req.getRespondWith().contains(XKMSConstants.RESPONDWITH_X509CHAIN)){
         try {             
           x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert.getEncoded()));
         } catch (CertificateEncodingException e) {
           log.error(intres.getLocalizedMessage("xkms.errordecodingcert"),e);          
           resultMajor = XKMSConstants.RESULTMAJOR_RECIEVER;
           resultMinor = XKMSConstants.RESULTMINOR_FAILURE;
         }
       }
       if(req.getRespondWith().contains(XKMSConstants.RESPONDWITH_X509CHAIN)){
         int caid = CertTools.getIssuerDN(cert).hashCode();
         try {
           Iterator<Certificate> iter = caAdminSession.getCAInfo(pubAdmin, caid).getCertificateChain().iterator();
           while(iter.hasNext()){
             X509Certificate next = (X509Certificate) iter.next();
             x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(next.getEncoded()));
           }
           x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert.getEncoded()));
         } catch (Exception e) {
           log.error(intres.getLocalizedMessage("xkms.errorfetchinglastcrl"),e);          
           resultMajor = XKMSConstants.RESULTMAJOR_RECIEVER;
           resultMinor = XKMSConstants.RESULTMINOR_FAILURE;
         }
       }
       if(req.getRespondWith().contains(XKMSConstants.RESPONDWITH_X509CRL)){
         byte[] crl = null;
         try {
           crl = createCrlSession.getLastCRL(pubAdmin, CertTools.getIssuerDN(cert), false);
         } catch (Exception e) {
           log.error(intres.getLocalizedMessage("xkms.errorfetchinglastcrl"),e);
           resultMajor = XKMSConstants.RESULTMAJOR_RECIEVER;
           resultMinor = XKMSConstants.RESULTMINOR_FAILURE;
         }
         x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509CRL(crl));
       }       
       keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
      
     }
     retval.setKeyInfo(keyInfoType);
View Full Code Here

        // Test with certificate
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("130");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert1.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
        queryKeyBindingType.setKeyInfo(keyInfoType);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);
View Full Code Here

        useKeyWithType.setIdentifier(username1);

        validateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);

        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert1.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
        queryKeyBindingType.setKeyInfo(keyInfoType);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        validateRequestType.setQueryKeyBinding(queryKeyBindingType);

        validateResultType = xKMSInvoker.validate(validateRequestType, null, null);

        assertTrue(validateResultType.getKeyBinding().size() > 0);
        assertTrue(validateResultType.getKeyBinding().get(0).getStatus().getValidReason().contains(XKMSConstants.STATUSREASON_VALIDITYINTERVAL));
        assertTrue(validateResultType.getKeyBinding().get(0).getStatus().getValidReason().contains(XKMSConstants.STATUSREASON_ISSUERTRUST));
        assertTrue(validateResultType.getKeyBinding().get(0).getStatus().getValidReason().contains(XKMSConstants.STATUSREASON_SIGNATURE));
        assertTrue(validateResultType.getKeyBinding().get(0).getStatus().getValidReason().contains(XKMSConstants.STATUSREASON_REVOCATIONSTATUS));

        // Test with unknown certificate.
        validateRequestType = xKMSObjectFactory.createValidateRequestType();
        validateRequestType.setId("202");

        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSHTTP);
        useKeyWithType.setIdentifier(username1);

        validateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);

        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(certbytes));
        keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
        queryKeyBindingType.setKeyInfo(keyInfoType);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        validateRequestType.setQueryKeyBinding(queryKeyBindingType);

        validateResultType = xKMSInvoker.validate(validateRequestType, null, null);

        assertTrue(validateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        assertTrue(validateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOMATCH));

        // Revoke certificate
        Admin administrator = new Admin(Admin.TYPE_RA_USER);
        certificateStoreSession.revokeCertificate(administrator, cert1, new ArrayList(), RevokedCertInfo.REVOCATION_REASON_UNSPECIFIED, null);
        // Validate with revoked certificate
        validateRequestType = xKMSObjectFactory.createValidateRequestType();
        validateRequestType.setId("203");

        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSHTTP);
        useKeyWithType.setIdentifier(username1);

        validateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);

        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert1.getEncoded()));
        keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
        queryKeyBindingType.setKeyInfo(keyInfoType);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        validateRequestType.setQueryKeyBinding(queryKeyBindingType);
View Full Code Here

        recoverRequestType.setId("704");

        recoverRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);
        recoverRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_PRIVATEKEY);

        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert2.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));

        KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
        keyBindingType.setKeyInfo(keyInfoType);
View Full Code Here

    public void test17SimpleRevoke() throws Exception {
        RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
        revokeRequestType.setId("800");

        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert1.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));

        KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
        keyBindingType.setKeyInfo(keyInfoType);
View Full Code Here

    public void test18RevokeWrongPassword() throws Exception {
        RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
        revokeRequestType.setId("801");

        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert2.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));

        KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
        keyBindingType.setKeyInfo(keyInfoType);
View Full Code Here

    public void test19RevokeWithResult() throws Exception {
        RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
        revokeRequestType.setId("802");

        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert2.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));

        KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
        keyBindingType.setKeyInfo(keyInfoType);
View Full Code Here

    public void test20RevokeAlreadyRevoked() throws Exception {
        RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
        revokeRequestType.setId("804");

        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert2.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));

        KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
        keyBindingType.setKeyInfo(keyInfoType);
View Full Code Here

                assertTrue(userCerts.size() == 1);
                Certificate cert = userCerts.iterator().next();
                // Revoke via XKMS and verify response
                RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
                revokeRequestType.setId("808");
                X509DataType x509DataType = sigFactory.createX509DataType();
                x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert.getEncoded()));
                KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
                keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
                KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
                keyBindingType.setKeyInfo(keyInfoType);
                keyBindingType.setId("424242");
                revokeRequestType.setRevokeKeyBinding(keyBindingType);
                first = XKMSUtil.getSecretKeyFromPassphrase("foo123", true, 20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
                revokeRequestType.setRevocationCode(first);
                RevokeResultType revokeResultType = xKMSInvoker.revoke(revokeRequestType, null, null, null, keyBindingType.getId());
                assertTrue(ERRORNOTSENTFORAPPROVAL, revokeResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
                assertTrue(ERRORNOTSENTFORAPPROVAL, revokeResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_INCOMPLETE));
                // Try to revoke via XKMS and verify failure
                revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
                revokeRequestType.setId("810");
                x509DataType = sigFactory.createX509DataType();
                x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert.getEncoded()));
                keyInfoType = sigFactory.createKeyInfoType();
                keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
                keyBindingType = xKMSObjectFactory.createKeyBindingType();
                keyBindingType.setKeyInfo(keyInfoType);
                keyBindingType.setId("424242");
View Full Code Here

TOP

Related Classes of org.w3._2000._09.xmldsig_.DSAKeyValueType

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.