Examples of UseKeyWithType


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

        File storageDir = new File("target/teststore_trusted_authority_validator");
        FileUtils.removeDir(storageDir);
        storageDir.mkdirs();
        certificateRepo = new FileCertificateRepo("target/teststore_trusted_authority_validator");

        UseKeyWithType rootKey = new UseKeyWithType();
        rootKey.setApplication(Applications.PKIX.getUri());
        String subjectDN = certificateRoot.getSubjectX500Principal().getName();
        rootKey.setIdentifier(subjectDN);
        certificateRepo.saveTrustedCACertificate(certificateRoot, rootKey);

        UseKeyWithType aliceKey = new UseKeyWithType();
        aliceKey.setApplication(Applications.PKIX.getUri());
        subjectDN = certificateWss40Rev.getSubjectX500Principal().getName();
        aliceKey.setIdentifier(subjectDN);
        certificateRepo.saveCACertificate(certificateWss40Rev, aliceKey);
       
        UseKeyWithType bobKey = new UseKeyWithType();
        bobKey.setApplication(Applications.PKIX.getUri());
        subjectDN = certificateWss40.getSubjectX500Principal().getName();
        bobKey.setIdentifier(subjectDN);
        certificateRepo.saveCACertificate(certificateWss40, bobKey);
       
        UseKeyWithType crlKey = new UseKeyWithType();
        crlKey.setApplication(Applications.PKIX.getUri());
        crlKey.setIdentifier(crl.getIssuerX500Principal().getName());
        certificateRepo.saveCRL(crl, crlKey);
    }
View Full Code Here

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

    public void testLocatePKIX() throws URISyntaxException, Exception {
        LocateRequestType request = XKMS_OF.createLocateRequestType();
        setGenericRequestParams(request);
        QueryKeyBindingType queryKeyBindingType = XKMS_OF.createQueryKeyBindingType();

        UseKeyWithType useKeyWithType = XKMS_OF.createUseKeyWithType();
        useKeyWithType.setIdentifier("CN=Dave, OU=Apache, O=CXF, L=CGN, ST=NRW, C=DE");
        useKeyWithType.setApplication(Applications.PKIX.getUri());

        locateCertificate(request, queryKeyBindingType, useKeyWithType);
    }
View Full Code Here

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

    public void testLocateByEndpoint() throws URISyntaxException, Exception {
        LocateRequestType request = XKMS_OF.createLocateRequestType();
        setGenericRequestParams(request);
        QueryKeyBindingType queryKeyBindingType = XKMS_OF.createQueryKeyBindingType();

        UseKeyWithType useKeyWithType = XKMS_OF.createUseKeyWithType();
        useKeyWithType.setIdentifier("http://localhost:8080/services/TestService");
        useKeyWithType.setApplication(Applications.SERVICE_ENDPOINT.getUri());

        locateCertificate(request, queryKeyBindingType, useKeyWithType);
    }
View Full Code Here

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

                x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(queryCert));
                KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
                keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
                queryKeyBindingType.setKeyInfo(keyInfoType);
            }else{
              UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
              useKeyWithType.setApplication(queryType);
              useKeyWithType.setIdentifier(queryVal);
              queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
            }
            if(keyUsage != null){
              queryKeyBindingType.getKeyUsage().add(keyUsage);
            }
View Full Code Here

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

            }
           
            String keyBindingId = genId();           
            PrototypeKeyBindingType prototypeKeyBinding = xKMSObjectFactory.createPrototypeKeyBindingType();
            prototypeKeyBinding.setId(keyBindingId);
            UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
            useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_PKIX);
            useKeyWithType.setIdentifier(subjectDN);           
            prototypeKeyBinding.getUseKeyWith().add(useKeyWithType);
           
            if(revocationCodeId != null && !revocationCodeId.equalsIgnoreCase("NULL")){
                byte[] first = XKMSUtil.getSecretKeyFromPassphrase(revocationCodeId, true,20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
                byte[] second = XKMSUtil.getSecretKeyFromPassphrase(new String(first,"ISO8859-1"), false,20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS2).getEncoded();
View Full Code Here

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

  protected void displayUseKeyWith(UnverifiedKeyBindingType next) {
    Iterator<UseKeyWithType> iter = next.getUseKeyWith().iterator();
    if(next.getKeyUsage().size() != 0){
      getPrintStream().println("  Certificate can be used with applications:");
      while(iter.hasNext()){
        UseKeyWithType useKeyWith = iter.next();
        if(useKeyWith.getApplication().equals(XKMSConstants.USEKEYWITH_IPSEC)){
          getPrintStream().println("    " + QUERYTYPE_IPSEC + " = " + useKeyWith.getIdentifier());       
        }
        if(useKeyWith.getApplication().equals(XKMSConstants.USEKEYWITH_PKIX)){
          getPrintStream().println("    " + QUERYTYPE_PKIX + " = " + useKeyWith.getIdentifier());       
        }
        if(useKeyWith.getApplication().equals(XKMSConstants.USEKEYWITH_SMIME)){
          getPrintStream().println("    " + QUERYTYPE_SMIME + " = " + useKeyWith.getIdentifier());       
        }
        if(useKeyWith.getApplication().equals(XKMSConstants.USEKEYWITH_TLS)){
          getPrintStream().println("    " + QUERYTYPE_TLS + " = " + useKeyWith.getIdentifier());       
        }
        if(useKeyWith.getApplication().equals(XKMSConstants.USEKEYWITH_TLSHTTP)){
          getPrintStream().println("    " + QUERYTYPE_TLSHTTP + " = " + useKeyWith.getIdentifier());       
        }
        if(useKeyWith.getApplication().equals(XKMSConstants.USEKEYWITH_TLSSMTP)){
          getPrintStream().println("    " + QUERYTYPE_TLSSMTP + " = " + useKeyWith.getIdentifier());       
        }
      }
    }
  }
View Full Code Here

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

        KeyPair keys = KeyTools.genKeys("1024", "RSA");   
       
      RegisterRequestType registerRequestType = xKMSObjectFactory.createRegisterRequestType();
      registerRequestType.setId("523");        
         
        UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_PKIX);
        useKeyWithType.setIdentifier("CN=Test Testarsson");
       
        registerRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);
     
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        RSAKeyValueType rsaKeyValueType = sigFactory.createRSAKeyValueType();
View Full Code Here

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

   protected List<UseKeyWithType> genUseKeyWithAttributes(X509Certificate cert, List<UseKeyWithType> reqUsages) throws Exception{
     ArrayList<UseKeyWithType> retval = new ArrayList<UseKeyWithType>();
    
     Iterator<UseKeyWithType> iter = reqUsages.iterator();
     while(iter.hasNext()){
       UseKeyWithType useKeyWithType =  iter.next();
       DNFieldExtractor altNameExtractor = new DNFieldExtractor(CertTools.getSubjectAlternativeName(cert),DNFieldExtractor.TYPE_SUBJECTALTNAME);
       String cn = CertTools.getPartFromDN(cert.getSubjectDN().toString(), "CN");
      
      
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_XKMS)||
            useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_XKMSPROFILE) ||
            useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_TLS)){
          if(altNameExtractor.getField(DNFieldExtractor.URI, 0).startsWith(useKeyWithType.getIdentifier())){
            retval.add(useKeyWithType);
          }
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_SMIME)||
          useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_PGP)){
          if(altNameExtractor.getField(DNFieldExtractor.RFC822NAME, 0).startsWith(useKeyWithType.getIdentifier())){
              retval.add(useKeyWithType);
        }        
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_TLSHTTP)){        
          if(cn.startsWith(useKeyWithType.getIdentifier())){
              retval.add(useKeyWithType);
        }                                   
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_TLSSMTP)){
          if(altNameExtractor.getField(DNFieldExtractor.DNSNAME, 0).startsWith(useKeyWithType.getIdentifier())){
              retval.add(useKeyWithType);
        }        
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_IPSEC)){
          if(altNameExtractor.getField(DNFieldExtractor.IPADDRESS, 0).startsWith(useKeyWithType.getIdentifier())){
              retval.add(useKeyWithType);
        }        
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_PKIX)){
          if(CertTools.getSubjectDN(cert).equalsIgnoreCase(CertTools.stringToBCDNString(useKeyWithType.getIdentifier()))){
              retval.add(useKeyWithType);
        }        
       }
     }
    
View Full Code Here

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

       if(!retvalEmpty){
        retval.add(Query.CONNECTOR_OR);  
       }
      
       UseKeyWithType useKeyWithType =  iter.next();
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_XKMS)||
            useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_XKMSPROFILE) ||
            useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_TLS)){
          retval.add(UserMatch.MATCH_WITH_URI,UserMatch.MATCH_TYPE_BEGINSWITH,useKeyWithType.getIdentifier());
          retvalEmpty=false;
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_SMIME)||
          useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_PGP)){
         retval.add(UserMatch.MATCH_WITH_RFC822NAME,UserMatch.MATCH_TYPE_BEGINSWITH,useKeyWithType.getIdentifier());
         retvalEmpty=false;
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_TLSHTTP)){
         retval.add(UserMatch.MATCH_WITH_COMMONNAME,UserMatch.MATCH_TYPE_BEGINSWITH,useKeyWithType.getIdentifier());
         retvalEmpty=false;        
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_TLSSMTP)){
         retval.add(UserMatch.MATCH_WITH_DNSNAME,UserMatch.MATCH_TYPE_BEGINSWITH,useKeyWithType.getIdentifier());
         retvalEmpty=false;        
       }      
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_IPSEC)){
         retval.add(UserMatch.MATCH_WITH_IPADDRESS,UserMatch.MATCH_TYPE_BEGINSWITH,useKeyWithType.getIdentifier());
         retvalEmpty=false;
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_PKIX)){
         retval.add(UserMatch.MATCH_WITH_DN,UserMatch.MATCH_TYPE_EQUALS,CertTools.stringToBCDNString(useKeyWithType.getIdentifier()));
         retvalEmpty=false;
       }
      

     }
View Full Code Here

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

        // Test simple validate
        ValidateRequestType validateRequestType = xKMSObjectFactory.createValidateRequestType();
        validateRequestType.setId("200");

        UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
        useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_TLSHTTP);
        useKeyWithType.setIdentifier("Test");

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

        QueryKeyBindingType queryKeyBindingType = xKMSObjectFactory.createQueryKeyBindingType();
        queryKeyBindingType.getUseKeyWith().add(useKeyWithType);
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.