Examples of UnverifiedKeyBindingType


Examples of org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType

        try {
            cert = findCertificate(keyIDs);
            if (cert == null) {
                return null;
            }
            UnverifiedKeyBindingType result = new UnverifiedKeyBindingType();
            result.setKeyInfo(X509Utils.getKeyInfo(cert));
            return result;
        } catch (CertificateEncodingException e) {
            throw new XKMSCertificateException("Cannot encode certificate: " + e.getMessage(), e);
        } catch (CertificateException e1) {
            throw new XKMSCertificateException(e1.getMessage(), e1);
View Full Code Here

Examples of org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType

        CertificateRepo certRepo = EasyMock.createMock(CertificateRepo.class);
        EasyMock.expect(certRepo.findBySubjectDn(EasyMock.eq("alice"))).andReturn(getAliceCert());
        EasyMock.replay(certRepo);
        X509Locator locator = new X509Locator(certRepo);
        LocateRequestType request = prepareLocateXKMSRequest();
        UnverifiedKeyBindingType result = locator.locate(request);
        Assert.assertNotNull(result.getKeyInfo());
    }
View Full Code Here

Examples of org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType

        LocateResultType response = XKMSResponseFactory.createResponse(request, new LocateResultType());
        try {
            validateRequest(request);
            // Search
            for (Locator locator : locators) {
                UnverifiedKeyBindingType keyBinding = locator.locate(request);
                if (keyBinding != null) {
                    response.getUnverifiedKeyBinding().add(keyBinding);
                    return response;
                }
            }
View Full Code Here

Examples of org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType

        try {
            cert = findCertificate(keyIDs);
            if (cert == null) {
                return null;
            }
            UnverifiedKeyBindingType result = new UnverifiedKeyBindingType();
            result.setKeyInfo(X509Utils.getKeyInfo(cert));
            return result;
        } catch (CertificateEncodingException e) {
            throw new XKMSCertificateException("Cannot encode certificate: " + e.getMessage(), e);
        } catch (CertificateException e1) {
            throw new XKMSCertificateException(e1.getMessage(), e1);
View Full Code Here

Examples of org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType

        }
    }

    public static UnverifiedKeyBindingType getUnverifiedKeyBinding(X509Certificate cert)
        throws CertificateEncodingException {
        UnverifiedKeyBindingType unverifiedKeyBinding = new UnverifiedKeyBindingType();
        unverifiedKeyBinding.setKeyInfo(getKeyInfo(cert));
        return unverifiedKeyBinding;
    }
View Full Code Here

Examples of org.apache.cxf.xkms.model.xkms.UnverifiedKeyBindingType

            validateRequest(request);
            // Create basic response
            LocateResultType result = XKMSResponseFactory.createResponse(request, new LocateResultType());
            // Search
            for (Locator locator : locators) {
                UnverifiedKeyBindingType keyBinding = locator.locate(request);
                if (keyBinding != null) {
                    result.getUnverifiedKeyBinding().add(keyBinding);
                    return result;
                }
            }
View Full Code Here

Examples of org.w3._2002._03.xkms_.UnverifiedKeyBindingType

            if(keyBindings.size() > 0){
              getPrintStream().println("\n  The query matched " + keyBindings.size() + " certificates :");
              Iterator iter = keyBindings.iterator();
              while(iter.hasNext()){
                UnverifiedKeyBindingType next = (UnverifiedKeyBindingType) iter.next();
                displayAndOutputCert(next, outputPath, pEMEncoding);               
                if(next instanceof KeyBindingType){
                  displayStatus((KeyBindingType) next);
                }                               
                getPrintStream().println("\n\n\n");
View Full Code Here

Examples of org.w3._2002._03.xkms_.UnverifiedKeyBindingType

    * in the request
    *
    * @param certificate to respond
    */
   protected KeyBindingAbstractType getResponseValues(KeyBindingAbstractType queryKeyBindingType, X509Certificate cert, boolean validateOrRevokeReq, boolean kRSSCall){
     UnverifiedKeyBindingType retval = xkmsFactory.createUnverifiedKeyBindingType();     
     if(validateOrRevokeReq || kRSSCall){
       retval = xkmsFactory.createKeyBindingType();
      
       ((KeyBindingType) retval).setStatus(getStatus(cert,  kRSSCall));
     }
          

     retval.setId("_" + cert.getSerialNumber().toString(16));            
     retval.setValidityInterval(getValidityInterval(cert));

     KeyInfoType keyInfoType = sigFactory.createKeyInfoType();

     if(req.getRespondWith().contains(XKMSConstants.RESPONDWITH_KEYNAME)){
       String keyName = cert.getSubjectDN().toString();
       keyInfoType.getContent().add(sigFactory.createKeyName(keyName));                         
     }

     if(req.getRespondWith().contains(XKMSConstants.RESPONDWITH_KEYVALUE)){
       if(cert.getPublicKey() instanceof RSAPublicKey){ 
         RSAPublicKey pubKey = (RSAPublicKey) cert.getPublicKey();       
         RSAKeyValueType rSAKeyValueType = sigFactory.createRSAKeyValueType();
         rSAKeyValueType.setModulus(pubKey.getModulus().toByteArray());
         rSAKeyValueType.setExponent(pubKey.getPublicExponent().toByteArray());
         KeyValueType keyValue = sigFactory.createKeyValueType();
         keyValue.getContent().add(sigFactory.createRSAKeyValue(rSAKeyValueType));
         keyInfoType.getContent().add(sigFactory.createKeyValue(keyValue));                         
       }else{
         log.error(intres.getLocalizedMessage("xkms.onlyrsakeysupported"));        
         resultMajor = XKMSConstants.RESULTMAJOR_RECIEVER;
         resultMinor = XKMSConstants.RESULTMINOR_FAILURE;
       }
     }

     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);
     retval.getKeyUsage().addAll(getCertKeyUsageSpec(cert));
    try {
      retval.getUseKeyWith().addAll(genUseKeyWithAttributes(cert, queryKeyBindingType.getUseKeyWith()));
    } catch (Exception e) {
      log.error(intres.getLocalizedMessage("xkms.errorextractingusekeyattr"),e);     
      resultMajor = XKMSConstants.RESULTMAJOR_RECIEVER;
      resultMinor = XKMSConstants.RESULTMINOR_FAILURE;
     
View Full Code Here

Examples of org.w3._2002._03.xkms_.UnverifiedKeyBindingType

        assertEquals("Wrong number of UnverifiedKeyBinding.", 1, locateResultType.getUnverifiedKeyBinding().size());
        List<UnverifiedKeyBindingType> numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        Iterator<UnverifiedKeyBindingType> iter = numberOfUnverifiedKeyBindings.iterator();
        KeyInfoType keyInfoType;
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            keyInfoType = nextKeyBinding.getKeyInfo();
            assertTrue(keyInfoType.getContent().size() > 0);
            JAXBElement<X509DataType> jAXBX509Data = (JAXBElement<X509DataType>) keyInfoType.getContent().get(0);
            Iterator iter2 = jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().iterator();
            while (iter2.hasNext()) {
                JAXBElement next = (JAXBElement) iter2.next();
                assertTrue(next.getName().getLocalPart().equals("X509Certificate"));
                byte[] encoded = (byte[]) next.getValue();
                Certificate nextCert = CertTools.getCertfromByteArray(encoded);
                assertTrue(CertTools.stringToBCDNString(CertTools.getSubjectDN(nextCert)).equals(CertTools.stringToBCDNString(dn2)));
            }

        }
        // Test with return with values, first check that certificate chain is
        // returning
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("132");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getUnverifiedKeyBinding().size() == 1);
        numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        iter = numberOfUnverifiedKeyBindings.iterator();
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            keyInfoType = nextKeyBinding.getKeyInfo();
            log.info("keyInfoType: " + keyInfoType.getContent().size());
            /*
             * <?xml version="1.0" ?> <S:Envelope xmlns:S =
             * "http://schemas.xmlsoap.org/soap/envelope/"> <S:Body>
             * <LocateResult xmlns = "http://www.w3.org/2002/03/xkms#" xmlns:ds
             * = "http://www.w3.org/2000/09/xmldsig#" xmlns:xenc =
             * "http://www.w3.org/2001/04/xmlenc#" Id = "_8571741123489298416"
             * RequestId = "132" ResultMajor =
             * "http://www.w3.org/2002/03/xkms#Success" Service =
             * "http://localhost:8080/ejbca/xkms/xkms"> <UnverifiedKeyBinding Id
             * = "_77028bb8eacaafcc"> <ds:KeyInfo> <ds:X509Data>
             * <ds:X509Certificate>
             * MIIDUzCCAjugAwIBAgIISnDjPdYPdp0wDQYJKoZIhvcNAQELBQAwNzERMA8GA1UEAwwIQWRtaW5DQTExFTATBgNVBAoMDEVKQkNBIFNhbXBsZTELMAkGA1UEBhMCU0UwHhcNMDkwMjA5MDM0NzE1WhcNMTkwMjA3MDM0NzE1WjA3MREwDwYDVQQDDAhBZG1pbkNBMTEVMBMGA1UECgwMRUpCQ0EgU2FtcGxlMQswCQYDVQQGEwJTRTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJIgd
             * +/tqTi3MD1QQsxMZG4uFBK3tp1B8LfFreomTz/
             * xewxii8IpfdQCKxIi7YxzNztLE9v6YWZwrgRJNby8ryDE
             * +mbUWJPu+i66gr6qQy6BYgWNxVMhOKE6d3hmmo5js31sXQ
             * +KY8qz+pM7ukh56xm0GpiNo8t34R7IOZz25KwH
             * +cqrBLDQbkwB/dCQIZmu4/cNxsAJ4lxEsmHkSU6xbRBM5gHLY
             * /mHHuMSptexSeGSC9B7bhMBj31TX4gUmOTz08WA
             * +g7mh4H4QJky0uuHMOJelGTvjdzuiNBImpUendw82llHgbo0zp
             * +wDB9SeHSTC9NnyWbw06O4/
             * CN2vtVZO0UCAwEAAaNjMGEwHQYDVR0OBBYEFMGhHG8TfrEn4kK3ilLiz4zac4tuMA8GA1UdEwEB
             * /
             * wQFMAMBAf8wHwYDVR0jBBgwFoAUwaEcbxN+sSfiQreKUuLPjNpzi24wDgYDVR0PAQH
             * /BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4IBAQBX+aHR4T/AeBtoFQdOCdJlvOV9yu/
             * FUTmvogCTG
             * +WDfueVhx7Iap3ZJvPX/h4Q46ax3dy2s0hJMHH6ZA9ve9OANgntIMVP00Ly0Mf
             * +EnTmYkIF34hUk6UoEvTUUUAHJP1m
             * /v8Gm03f+f0QzSpw3AB0ydYTGUHp3cAM6LCE1mgcOMcaxcZBdm
             * +XwyXRUrnuWrKiINhtHjVTm04kgQJIq8lxOrxTVJIBNsgXGjbVkAX0
             * /BXckCLo28Ma70F99kmOz4SBOaqWvl
             * +w8kKwbKgXEp4VXmKSJ4QA6Fugdp20PcUey0EnRnb8CmlGBePOYcM7Lu8Xnqqzd
             * +S3CA9ME5kAYK+j</ds:X509Certificate><ds:X509Certificate>
             * MIIDYjCCAkqgAwIBAgIIdwKLuOrKr8wwDQYJKoZIhvcNAQELBQAwNzERMA8GA1UEAwwIQWRtaW5DQTExFTATBgNVBAoMDEVKQkNBIFNhbXBsZTELMAkGA1UEBhMCU0UwHhcNMDkwMjA5MDU0OTE5WhcNMTEwMjA5MDU0OTE5WjA7MRswGQYDVQQDDBJ4a21zdGVzdHVzZXItOTk1LTIxDzANBgNVBAoMBkFuYVRvbTELMAkGA1UEBhMCU0UwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJdUlNuxmqUHuHRHXaER3DdHvjSxIBjdxoA7oiDnaKJNGLCKf3P2f42I0Musqnu0Fisl7v063b
             * +6DjH5MWeyif2/dZlCtrJS+
             * Gikf6mKyspE139XnoFsYtAq4R5aj01o52cXOGOgslbSdwoPcGKaqTmMR7TLQvMXZwQOc0hBhEtNAgMBAAGjgfEwge4wHQYDVR0OBBYEFDz8G13jKOWsCQ8ywBc7AQw1BR1VMAwGA1UdEwEB
             * /wQCMAAwHwYDVR0jBBgwFoAUwaEcbxN+sSfiQreKUuLPjNpzi24wDgYDVR0PAQH/
             * BAQDAgZAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDBvBgNVHREEaDBmgRl4a21zdGVzdHVzZXItOTk1LTJAZm9vLnNlght4a21zdGVzdHVzZXItOTk1LTIudGVzdC5jb22GJmh0dHA6Ly93d3cudGVzdC5jb20veGttc3Rlc3R1c2VyLTk5NS0yhwQKAAABMA0GCSqGSIb3DQEBCwUAA4IBAQAgDS5TOV7sza9ZD8l6UWxkffBvLF8JuHbVDyDYhukehTWKPn6JyLQOut17PedGykvwBQrP3lBeoHxzd9kVw906IiI
             * +SoIoNGR9HkNdBQksqZu9Stt0F3qbK69qBtZLlA2mwUPxIrI0iLTZ+
             * Qm46zG0Ixsj8ux8UbomH6JYdDsTwuePJFurkYxQmTdx
             * /cGwltp49q+FqoMIL4RjpM1R5WguIKuEvk9E51EA59GOMEbXI374lrlxcvmjSbvv4
             * /
             * SQvqn0CUZgMu+rvWhC1su6FAOI438vS6itGovwZLV/rlqsrbWmsdD3wuj9LGADLX+
             * EP2GFvuWiuLzYzfZ1CppakW1e</ds:X509Certificate> </ds:X509Data>
             * </ds:KeyInfo>
             * <KeyUsage>http://www.w3.org/2002/03/xkms#Signature</KeyUsage>
             * <UseKeyWith Application = "urn:ietf:rfc:2487" Identifier =
             * "xkmstestuser-995-2.test.com"></UseKeyWith> <ValidityInterval
             * NotBefore = "2009-02-09T14:49:19.000+09:00" NotOnOrAfter =
             * "2011-02-09T14:49:19.000+09:00"></ValidityInterval>
             * </UnverifiedKeyBinding> </LocateResult> </S:Body> </S:Envelope>
             */
            // modified by dai 20090209
            // return xml is above, so I think keyInfoType.getContent().size()
            // should be 1 if the xml is correct.
            // assertTrue(keyInfoType.getContent().size() > 1 );
            assertTrue(keyInfoType.getContent().size() > 0);
            JAXBElement<X509DataType> jAXBX509Data = (JAXBElement<X509DataType>) keyInfoType.getContent().get(0);
            assertTrue(jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().size() == 2);
            Iterator iter2 = jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().iterator();
            while (iter2.hasNext()) {
                JAXBElement next = (JAXBElement) iter2.next();
                assertTrue(next.getName().getLocalPart().equals("X509Certificate"));
                byte[] encoded = (byte[]) next.getValue();
                Certificate nextCert = CertTools.getCertfromByteArray(encoded);
                assertTrue(CertTools.stringToBCDNString(CertTools.getSubjectDN(nextCert)).equals(CertTools.stringToBCDNString(dn2))
                        || CertTools.stringToBCDNString(CertTools.getSubjectDN(nextCert)).equals(CertTools.stringToBCDNString(issuerdn)));
            }

        }

        // Test with returnwith values, require both cert and chain in answer
        // check that just chain is returned
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("133");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getUnverifiedKeyBinding().size() == 1);
        numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        iter = numberOfUnverifiedKeyBindings.iterator();
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            keyInfoType = nextKeyBinding.getKeyInfo();
            // modified by dai 20090209 same as above
            // assertTrue(keyInfoType.getContent().size() > 1 );
            assertTrue(keyInfoType.getContent().size() > 0);
            JAXBElement<X509DataType> jAXBX509Data = (JAXBElement<X509DataType>) keyInfoType.getContent().get(0);
            assertTrue(jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().size() == 2);
            Iterator iter2 = jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().iterator();
            while (iter2.hasNext()) {
                JAXBElement next = (JAXBElement) iter2.next();
                // log.debug("next.getName().getLocalPart(): "+next.getName().getLocalPart());
                assertTrue(next.getName().getLocalPart().equals("X509Certificate"));
                byte[] encoded = (byte[]) next.getValue();
                Certificate nextCert = CertTools.getCertfromByteArray(encoded);
                assertTrue(CertTools.stringToBCDNString(CertTools.getSubjectDN(nextCert)).equals(CertTools.stringToBCDNString(dn2))
                        || CertTools.stringToBCDNString(CertTools.getSubjectDN(nextCert)).equals(CertTools.stringToBCDNString(issuerdn)));
            }

        }

        // Test with returnwith values, require crl in answer
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("134");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CRL);

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getUnverifiedKeyBinding().size() == 1);
        numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        iter = numberOfUnverifiedKeyBindings.iterator();
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            keyInfoType = nextKeyBinding.getKeyInfo();
            // modified by dai 20090209 same as above
            // assertTrue(keyInfoType.getContent().size() > 1 );
            assertTrue(keyInfoType.getContent().size() > 0);
            JAXBElement<X509DataType> jAXBX509Data = (JAXBElement<X509DataType>) keyInfoType.getContent().get(0);
            assertTrue(jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().size() == 1);
            Iterator iter2 = jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().iterator();
            while (iter2.hasNext()) {
                JAXBElement next = (JAXBElement) iter2.next();
                assertTrue(next.getName().getLocalPart().equals("X509CRL"));
                byte[] encoded = (byte[]) next.getValue();
                X509CRL nextCRL = CertTools.getCRLfromByteArray(encoded);
                assertTrue(CertTools.stringToBCDNString(nextCRL.getIssuerDN().toString()).equals(CertTools.stringToBCDNString(issuerdn)));
            }
        }

        // Test with returnwith values, require certchain and crl in answer
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("135");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CRL);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getUnverifiedKeyBinding().size() == 1);
        numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        iter = numberOfUnverifiedKeyBindings.iterator();
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            keyInfoType = nextKeyBinding.getKeyInfo();
            // modified by dai 20090209 same as above
            // assertTrue(keyInfoType.getContent().size() > 1 );
            assertTrue(keyInfoType.getContent().size() > 0);
            JAXBElement<X509DataType> jAXBX509Data = (JAXBElement<X509DataType>) keyInfoType.getContent().get(0);
            assertTrue(jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().size() == 3);
            Iterator iter2 = jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().iterator();
            while (iter2.hasNext()) {
                JAXBElement next = (JAXBElement) iter2.next();
                if (next.getName().getLocalPart().equals("X509CRL")) {
                    byte[] encoded = (byte[]) next.getValue();
                    X509CRL nextCRL = CertTools.getCRLfromByteArray(encoded);
                    assertTrue(CertTools.stringToBCDNString(nextCRL.getIssuerDN().toString()).equals(CertTools.stringToBCDNString(issuerdn)));
                }
                if (next.getName().getLocalPart().equals("X509Certificate")) {
                    byte[] encoded = (byte[]) next.getValue();
                    Certificate nextCert = CertTools.getCertfromByteArray(encoded);
                    assertTrue(CertTools.stringToBCDNString(CertTools.getSubjectDN(nextCert)).equals(CertTools.stringToBCDNString(dn2))
                            || CertTools.stringToBCDNString(CertTools.getSubjectDN(nextCert)).equals(CertTools.stringToBCDNString(issuerdn)));
                }
            }
        }

        // Test with returnwith values, require keyname in answer
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("135");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_KEYNAME);

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getUnverifiedKeyBinding().size() == 1);
        numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        iter = numberOfUnverifiedKeyBindings.iterator();
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            keyInfoType = nextKeyBinding.getKeyInfo();
            // modified by dai 20090209 same as above
            // assertTrue(keyInfoType.getContent().size() > 1 );
            assertTrue(keyInfoType.getContent().size() > 0);
            JAXBElement<String> jAXBString = (JAXBElement<String>) keyInfoType.getContent().get(0);
            assertTrue(jAXBString.getName().getLocalPart().equals("KeyName"));
            assertTrue(CertTools.stringToBCDNString(jAXBString.getValue()) + " = " + CertTools.stringToBCDNString(dn2), CertTools.stringToBCDNString(
                    jAXBString.getValue()).equals(CertTools.stringToBCDNString(dn2)));
        }

        // Test with returnwith values, require public key in answer
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("135");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_KEYVALUE);

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getUnverifiedKeyBinding().size() == 1);
        numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        iter = numberOfUnverifiedKeyBindings.iterator();
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            keyInfoType = nextKeyBinding.getKeyInfo();
            assertTrue("" + keyInfoType.getContent().size(), keyInfoType.getContent().size() > 0);
            JAXBElement<KeyValueType> jAXBKeyValue = (JAXBElement<KeyValueType>) keyInfoType.getContent().get(0);
            assertTrue(jAXBKeyValue.getName().getLocalPart(), jAXBKeyValue.getName().getLocalPart().equals("KeyValue"));
            // modified by dai 20090209 same as above
            // assertTrue(""+jAXBKeyValue.getValue().getContent().size(),jAXBKeyValue.getValue().getContent().size()
            // > 1);
            assertTrue("" + jAXBKeyValue.getValue().getContent().size(), jAXBKeyValue.getValue().getContent().size() > 0);
            JAXBElement<RSAKeyValueType> rSAKeyValueType = (JAXBElement<RSAKeyValueType>) jAXBKeyValue.getValue().getContent().get(0);
            assertTrue(rSAKeyValueType.getName().getLocalPart(), rSAKeyValueType.getName().getLocalPart().equals("RSAKeyValue"));
            BigInteger exp = new BigInteger(rSAKeyValueType.getValue().getExponent());
            BigInteger modulus = new BigInteger(rSAKeyValueType.getValue().getModulus());
            assertTrue(((RSAPublicKey) cert2.getPublicKey()).getModulus().equals(modulus));
            assertTrue(((RSAPublicKey) cert2.getPublicKey()).getPublicExponent().equals(exp));
        }

        // Test with returnwith one invalid values
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("136");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_RETRIEVALMETHOD);

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SENDER));
        assertTrue(locateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_MESSAGENOTSUPPORTED));

        // Test with returnwith many invalid values
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("137");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_RETRIEVALMETHOD);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_PGP);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_PGPWEB);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_SPKI);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_PRIVATEKEY);

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SENDER));
        assertTrue(locateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_MESSAGENOTSUPPORTED));

        // Test with many invalid values and one certificate
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("138");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_RETRIEVALMETHOD);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_PGP);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_PGPWEB);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_SPKI);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_PRIVATEKEY);

        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getUnverifiedKeyBinding().size() == 1);
        numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        iter = numberOfUnverifiedKeyBindings.iterator();

        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            keyInfoType = nextKeyBinding.getKeyInfo();
            assertTrue(keyInfoType.getContent().size() > 0);
            JAXBElement<X509DataType> jAXBX509Data = (JAXBElement<X509DataType>) keyInfoType.getContent().get(0);
            Iterator iter2 = jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().iterator();
            while (iter2.hasNext()) {
                JAXBElement next = (JAXBElement) iter2.next();
View Full Code Here

Examples of org.w3._2002._03.xkms_.UnverifiedKeyBindingType

        LocateResultType locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertEquals("Wrong number of UnverifiedKeyBinding.", 1, locateResultType.getUnverifiedKeyBinding().size());
        List<UnverifiedKeyBindingType> numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        Iterator<UnverifiedKeyBindingType> iter = numberOfUnverifiedKeyBindings.iterator();
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            assertTrue(nextKeyBinding.getKeyUsage().size() == 1);
            assertTrue(nextKeyBinding.getKeyUsage().contains(XKMSConstants.KEYUSAGE_SIGNATURE));
        }

        // request with Signature and receive noMatch
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("140");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_PKIX);
        useKeyWithType.setIdentifier(dn1);
        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_SIGNATURE);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        /*
         * <?xml version="1.0" ?> <S:Envelope xmlns:S =
         * "http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <LocateResult
         * xmlns = "http://www.w3.org/2002/03/xkms#" xmlns:ds =
         * "http://www.w3.org/2000/09/xmldsig#" xmlns:xenc =
         * "http://www.w3.org/2001/04/xmlenc#" Id = "_1669649196518103469"
         * RequestId = "140" ResultMajor =
         * "http://www.w3.org/2002/03/xkms#Success" Service =
         * "http://localhost:8080/ejbca/xkms/xkms"> <UnverifiedKeyBinding Id =
         * "_77cca72c8e066b19"> <ds:KeyInfo> <ds:X509Data>
         * <ds:X509Certificate>MIIDFzCCAf+
         * gAwIBAgIId8ynLI4GaxkwDQYJKoZIhvcNAQELBQAwNzERMA8GA1UEAwwIQWRtaW5DQTExFTATBgNVBAoMDEVKQkNBIFNhbXBsZTELMAkGA1UEBhMCU0UwHhcNMDkwMjA5MDYyNjMyWhcNMTEwMjA5MDYyNjMyWjA7MRswGQYDVQQDDBJ4a21zdGVzdHVzZXItOTAyLTExDzANBgNVBAoMBkFuYVRvbTELMAkGA1UEBhMCU0UwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJJBZdwEN7RCY
         * +46ZnxzrjXOm+h6k/
         * WF6jbt8O5V7YbVr2wL657ivKWBQr8WEEtOheQ9DFFbXq80Adryf8YSRDz4DL5008Fn/
         * LRC5jqCspT6aEhhvSvcvmBEO8YJhR2YhVUHB84p3RD9RvPPRzDsTLXGWScbbjCu1NzdnXX7AGNTAgMBAAGjgaYwgaMwHQYDVR0OBBYEFPYgaKLUO
         * /X7ZC+6Mn3uFzRmTcVwMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUwaEcbxN+
         * sSfiQreKUuLPjNpzi24wDgYDVR0PAQH/
         * BAQDAgXgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAbgRl4a21zdGVzdHVzZXItOTAyLTFAZm9vLnNlMA0GCSqGSIb3DQEBCwUAA4IBAQAcFUxvDxDcNpkvzp2bdntR9HnaljqlUwPWVQROSr5r0h7iS0
         * /ZJ/
         * kFKLuSdBSoVU1nbuOrtlhNC1zdfE6e86IHbFDK8dk6zJRpYRdsoZcmz9k0F9dX9AmILj9aXS3kiSzyF8L0m02siZZF9dMbpXCgFZCQRGFWLxcNAf6BZTS6c92W7
         * +
         * bPS67vVcGujideTiO8Ud0fU1tyu9BtsqpFItnS9N34sm19MC8pLAzaJjoCNmSXcUl0bswe4d3TkzWKlEjfQeNrRwNP1dI8HJEE7Ddr1j8eE8sW9E
         * /
         * IXQP4QINzF7P6psdtqMlevqx7JFUR6Px73Yn2ASJueScyB9l03Ikj</ds:X509Certificate
         * > </ds:X509Data> </ds:KeyInfo>
         * <KeyUsage>http://www.w3.org/2002/03/xkms#Exchange</KeyUsage>
         * <KeyUsage>http://www.w3.org/2002/03/xkms#Signature</KeyUsage>
         * <UseKeyWith Application = "urn:ietf:rfc:2459" Identifier =
         * "C=SE, O=AnaTom, CN=xkmstestuser-902-1"></UseKeyWith>
         * <ValidityInterval NotBefore = "2009-02-09T15:26:32.000+09:00"
         * NotOnOrAfter = "2011-02-09T15:26:32.000+09:00"></ValidityInterval>
         * </UnverifiedKeyBinding> </LocateResult> </S:Body> </S:Envelope>
         */
        // modified by dai 20090209
        // according to the result xml above, there is no resultminor if the
        // resut is success.
        // so assert for resultminor should not be done if succeed case.
        assertTrue(locateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        // assertTrue(locateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOMATCH));

        // request Exchange or Signature and receive Signature expect Nomatch
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("141");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSSMTP);
        useKeyWithType.setIdentifier(username2 + ".test.com");

        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_SIGNATURE);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_EXCHANGE);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        assertTrue(locateResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOMATCH));

        // request Exchange and that response can be used for both exchange and
        // encryption.
        locateRequestType = xKMSObjectFactory.createLocateRequestType();
        locateRequestType.setId("142");
        queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_PKIX);
        useKeyWithType.setIdentifier(dn3);

        locateRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_ENCRYPTION);
        queryKeyBindingType.getKeyUsage().add(XKMSConstants.KEYUSAGE_EXCHANGE);
        locateRequestType.setQueryKeyBinding(queryKeyBindingType);

        locateResultType = xKMSInvoker.locate(locateRequestType, null, null);
        assertTrue(locateResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        assertEquals("locateResultType.getUnverifiedKeyBinding: ", 1, locateResultType.getUnverifiedKeyBinding().size());
        numberOfUnverifiedKeyBindings = locateResultType.getUnverifiedKeyBinding();
        iter = numberOfUnverifiedKeyBindings.iterator();
        while (iter.hasNext()) {
            UnverifiedKeyBindingType nextKeyBinding = iter.next();
            // modified by dai 20090224
            /*
             * <?xml version="1.0" ?> <soapenv:Envelope xmlns:soapenv =
             * "http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body>
             * <LocateRequest xmlns = "http://www.w3.org/2002/03/xkms#" xmlns:ds
             * = "http://www.w3.org/2000/09/xmldsig#" xmlns:xenc =
             * "http://www.w3.org/2001/04/xmlenc#" Id = "142">
             * <RespondWith>http:
             * //www.w3.org/2002/03/xkms#X509Cert</RespondWith>
             * <QueryKeyBinding>
             * <KeyUsage>http://www.w3.org/2002/03/xkms#Encryption</KeyUsage>
             * <KeyUsage>http://www.w3.org/2002/03/xkms#Exchange</KeyUsage>
             * <UseKeyWith Application = "urn:ietf:rfc:2459" Identifier =
             * "C=SE, O=AnaTom, CN=xkmstestuser565-3"></UseKeyWith>
             * </QueryKeyBinding> </LocateRequest> </soapenv:Body>
             * </soapenv:Envelope>
             *
             * <?xml version="1.0" ?> <S:Envelope xmlns:S =
             * "http://schemas.xmlsoap.org/soap/envelope/"> <S:Body>
             * <LocateResult xmlns = "http://www.w3.org/2002/03/xkms#" xmlns:ds
             * = "http://www.w3.org/2000/09/xmldsig#" xmlns:xenc =
             * "http://www.w3.org/2001/04/xmlenc#" Id = "_6920717384004478797"
             * RequestId = "142" ResultMajor =
             * "http://www.w3.org/2002/03/xkms#Success" Service =
             * "http://localhost:8080/ejbca/xkms/xkms"> <UnverifiedKeyBinding Id
             * = "_60f8a803e9c6aee7"> <ds:KeyInfo> <ds:X509Data>
             * <ds:X509Certificate>MIIDFTCCAf2gAwIBAgIIYPioA+
             * nGrucwDQYJKoZIhvcNAQELBQAwNzERMA8GA1UEAwwIQWRtaW5DQTExFTATBgNVBAoMDEVKQkNBIFNhbXBsZTELMAkGA1UEBhMCU0UwHhcNMDkwMjI0MDYyNDMxWhcNMTEwMjI0MDYyNDMxWjA6MRowGAYDVQQDDBF4a21zdGVzdHVzZXI1NjUtMzEPMA0GA1UECgwGQW5hVG9tMQswCQYDVQQGEwJTRTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAhD0PiOljD
             * +deEE++fshjDbe4kEZXNrVg3xeWy+EMQQ8PtkCiugVzcs4O87z7v/1r+
             * nSQqqVHdZV7beMTsULtSyrj0cCAD4aN
             * +Efurh4J7QzOUmMemNzuC54lBv/9MgEKZsCgFuvbflUIlvwjd/
             * kQP4aM7RbcWkEgiVUNmVXZWf8CAwEAAaOBpTCBojAdBgNVHQ4EFgQUDJ5r9XETomSvPgf1k6NHxTSpnFkwDAYDVR0TAQH
             * /BAIwADAfBgNVHSMEGDAWgBTBoRxvE36xJ+JCt4pS4s+
             * M2nOLbjAOBgNVHQ8BAf8EBAMCBPAwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMEMCMGA1UdEQQcMBqBGHhrbXN0ZXN0dXNlcjU2NS0zQGZvby5zZTANBgkqhkiG9w0BAQsFAAOCAQEAVPQaLAAd
             * /QyIYvbglMtf51ZPZ/2OWbi+
             * nlMqxbpjN3DbdQbTkMnTyp2CpCVDY15XkTthnV7JBBCOm2sTRrSTN
             * +/OgAfacBP830peCKf4fBa
             * +ZAJrU2QYlmORhVjXz2wsJl5Vn+pRBcZSosjTm/VVGwvVai0V25lzrXK8MZEYAJog9uqr
             * /ysW45uN8MgzLa1744rQIrHg5KiJD5exnfUNhUq81CiRKX8JbDV/
             * mDGzwdJoyToG80BTa4buafdDig8qGYlXGgnSpHVkeWtvHoSd
             * /nfJn95n3ftixD6uqVaozC7Z0SKsDrPz2eHN
             * /Mp6qVdDCLtOpD0EM+um3pl4yEm98A==</ds:X509Certificate>
             * </ds:X509Data> </ds:KeyInfo>
             * <KeyUsage>http://www.w3.org/2002/03/xkms#Encryption</KeyUsage>
             * <KeyUsage>http://www.w3.org/2002/03/xkms#Exchange</KeyUsage>
             * <KeyUsage>http://www.w3.org/2002/03/xkms#Signature</KeyUsage>
             * <UseKeyWith Application = "urn:ietf:rfc:2459" Identifier =
             * "C=SE, O=AnaTom, CN=xkmstestuser565-3"></UseKeyWith>
             * <ValidityInterval NotBefore = "2009-02-24T15:24:31.000+09:00"
             * NotOnOrAfter =
             * "2011-02-24T15:24:31.000+09:00"></ValidityInterval>
             * </UnverifiedKeyBinding> </LocateResult> </S:Body> </S:Envelope>
             */
            // The number of KeyUsase is 3. I'm not sure the result is correct
            // or not.
            // assertTrue(nextKeyBinding.getKeyUsage().size() == 2);
            assertTrue(nextKeyBinding.getKeyUsage().size() == 3);
            assertTrue(nextKeyBinding.getKeyUsage().contains(XKMSConstants.KEYUSAGE_ENCRYPTION));
            assertTrue(nextKeyBinding.getKeyUsage().contains(XKMSConstants.KEYUSAGE_EXCHANGE));
        }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.