Package gov.niarl.his.webservices.hisPrivacyCAWebService2

Examples of gov.niarl.his.webservices.hisPrivacyCAWebService2.IHisPrivacyCAWebService2


        System.exit(99);
        return;
      }
      TpmIdentity newId = TpmModule.collateIdentityRequest(TpmOwnerAuth, HisIdentityAuth, HisIdentityLabel, new TpmPubKey((RSAPublicKey)pcaCert.getPublicKey(), 3, 1).toByteArray(), HisIdentityIndex, (X509Certificate)null, !shortcut);
     
      IHisPrivacyCAWebService2 hisPrivacyCAWebService2 = HisPrivacyCAWebServices2ClientInvoker.getHisPrivacyCAWebService2(PrivacyCaUrl);
      byte[] encrypted1 = hisPrivacyCAWebService2.identityRequestGetChallenge(newId.getIdentityRequest(), encryptedEkCert.toByteArray());
      if(encrypted1.length == 1){
        System.out.println("Identity request was rejected by Privacy CA in phase 1 of process");
        System.exit(1);
        return;
      }
      TpmKey aik = new TpmKey(newId.getAikBlob());
     
      int os = IdentityOS.osType();//return os type. win:0; linux:1; other:-1
     
      byte[] asym1 = new byte[256];
      System.arraycopy(encrypted1, 0, asym1, 0, asym1.length);
      byte[] sym1 = new byte[encrypted1.length - 256];
      System.arraycopy(encrypted1, 256, sym1, 0, sym1.length);
      byte[] decrypted1;
      if (os==1)//linux
        decrypted1 = TpmModule.activateIdentity(ownerAuthRaw, keyAuthRaw, asym1, sym1, HisIdentityIndex);
      else
        //decrypted1 = TpmModuleJava.ActivateIdentity(asym1, sym1, aik, keyAuthRaw, srkAuthRaw, ownerAuthRaw); //Comments  temporarily due to TSSCoreService.jar compiling issue
        decrypted1 = TpmModule.activateIdentity(ownerAuthRaw, keyAuthRaw, asym1, sym1, HisIdentityIndex);
      TpmIdentityRequest encryptedChallenge = new TpmIdentityRequest(decrypted1, (RSAPublicKey)pcaCert.getPublicKey(), false);
      byte[] encrypted2 = hisPrivacyCAWebService2.identityRequestSubmitResponse(encryptedChallenge.toByteArray());
      if(encrypted2.length == 1){
        System.out.println("Identity request was rejected by Privacy CA in phase 2 of process");
        System.exit(2);
        return;
      }
View Full Code Here


   * Entry point into the program.
   */
  public static void main(String[] args){
    //System.setProperty("javax.net.ssl.trustStore", "\\\\Toc\\Shared\\TrustStore.jks");
    try {
      IHisPrivacyCAWebService2 hisPrivacyCAWebService2 = HisPrivacyCAWebServices2ClientInvoker.getHisPrivacyCAWebService2("http://localhost:8080/HisPrivacyCAWebServices2");
      byte[] received = hisPrivacyCAWebService2.identityRequestGetChallenge("identityRequest".getBytes(), "endorsementCertificate".getBytes());
      //System.out.println(new String(hisPrivacyCAWebService2.identityRequestGetChallenge("identityRequest".getBytes(), "endorsementCertificate".getBytes())));
      System.out.println(TpmUtils.byteArrayToHexString(received));

      byte[] received2 = hisPrivacyCAWebService2.identityRequestSubmitResponse(received);
      //System.out.println(new String(hisPrivacyCAWebService2.identityRequestSubmitResponse("identityRequestResponseToChallenge".getBytes())));
      System.out.println(TpmUtils.byteArrayToHexString(received2));
     
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

    } catch (Exception e){
      System.out.println("print out error message: " + e.toString());
      e.printStackTrace();
     }
    try {         
      IHisPrivacyCAWebService2 hisPrivacyCAWebService2 = HisPrivacyCAWebServices2ClientInvoker.getHisPrivacyCAWebService2(PrivacyCaUrl)
      encryptCert = hisPrivacyCAWebService2.requestGetEC(encryptDES(pubEkMod, deskey), encryptRSA(deskey.getEncoded(), publicKey), EcValidityDays)
    } catch (Exception e){
      System.out.println("FAILED");
      e.printStackTrace();
      System.exit(1);
    }
View Full Code Here

      TpmIdentity newId = TpmModule.collateIdentityRequest(TpmOwnerAuth, HisIdentityAuth, HisIdentityLabel, new TpmPubKey((RSAPublicKey)pcaCert.getPublicKey(), 3, 1).toByteArray(), HisIdentityIndex, (X509Certificate)null, !shortcut);
     
                       
//                        HttpsURLConnection.setDefaultHostnameVerifier(new NopX509HostnameVerifier()); // XXX TODO Bug #497 need to allow caller to specify a TlsPolicy // disabled for testing issue #541
                       
      IHisPrivacyCAWebService2 hisPrivacyCAWebService2 = HisPrivacyCAWebServices2ClientInvoker.getHisPrivacyCAWebService2(PrivacyCaUrl);
      byte[] encrypted1 = hisPrivacyCAWebService2.identityRequestGetChallenge(newId.getIdentityRequest(), encryptedEkCert.toByteArray());
      if(encrypted1.length == 1){
        throw new PrivacyCAException("Identity request was rejected by Privacy CA in phase 1 of process");
      }
      //TpmKey aik = new TpmKey(newId.getAikBlob());
     
      int os = IdentityOS.osType();//return os type. win:0; linux:1; other:-1
     
      byte[] asym1 = new byte[256];
      System.arraycopy(encrypted1, 0, asym1, 0, asym1.length);
      byte[] sym1 = new byte[encrypted1.length - 256];
      System.arraycopy(encrypted1, 256, sym1, 0, sym1.length);
      byte[] decrypted1;
      if (os==1){//linux
        decrypted1 = TpmModule.activateIdentity(ownerAuthRaw, keyAuthRaw, asym1, sym1, HisIdentityIndex);

      }else
        //decrypted1 = TpmModuleJava.ActivateIdentity(asym1, sym1, aik, keyAuthRaw, srkAuthRaw, ownerAuthRaw); //Comments  temporarily due to TSSCoreService.jar compiling issue
        decrypted1 = TpmModule.activateIdentity(ownerAuthRaw, keyAuthRaw, asym1, sym1, HisIdentityIndex);
     
      TpmIdentityRequest encryptedChallenge = new TpmIdentityRequest(decrypted1, (RSAPublicKey)pcaCert.getPublicKey(), false);
      byte[] encrypted2 = hisPrivacyCAWebService2.identityRequestSubmitResponse(encryptedChallenge.toByteArray());
      if(encrypted2.length == 1){
        log.warning("Identity request was rejected by Privacy CA in phase 2 of process");
        throw new Exception("Identity request was rejected by Privacy CA in phase 2 of process");
      }
      byte[] asym2 = new byte[256];
View Full Code Here

TOP

Related Classes of gov.niarl.his.webservices.hisPrivacyCAWebService2.IHisPrivacyCAWebService2

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.