Пример #1
0
  /*
   * Get the active protocol versions.
   *
   * In TLS 1.1, many weak or vulnerable cipher suites were obsoleted,
   * such as TLS_RSA_EXPORT_WITH_RC4_40_MD5. The implementation MUST NOT
   * negotiate these cipher suites in TLS 1.1 or later mode.
   *
   * For example, if "TLS_RSA_EXPORT_WITH_RC4_40_MD5" is the
   * only enabled cipher suite, the client cannot request TLS 1.1 or
   * later, even though TLS 1.1 or later is enabled.  We need to create a
   * subset of the enabled protocols, called the active protocols, which
   * contains protocols appropriate to the list of enabled Ciphersuites.
   *
   * Return empty list instead of null if no active protocol versions.
   */
  ProtocolList getActiveProtocols() {
    if (activeProtocols == null) {
      ArrayList<ProtocolVersion> protocols = new ArrayList<>(4);
      for (ProtocolVersion protocol : enabledProtocols.collection()) {
        boolean found = false;
        for (CipherSuite suite : enabledCipherSuites.collection()) {
          if (suite.isAvailable()
              && suite.obsoleted > protocol.v
              && suite.supported <= protocol.v) {
            if (algorithmConstraints.permits(
                EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), suite.name, null)) {
              protocols.add(protocol);
              found = true;
              break;
            } else if (debug != null && Debug.isOn("verbose")) {
              System.out.println("Ignoring disabled cipher suite: " + suite + " for " + protocol);
            }
          } else if (debug != null && Debug.isOn("verbose")) {
            System.out.println("Ignoring unsupported cipher suite: " + suite + " for " + protocol);
          }
        }
        if (!found && (debug != null) && Debug.isOn("handshake")) {
          System.out.println("No available cipher suite for " + protocol);
        }
      }
      activeProtocols = new ProtocolList(protocols);
    }

    return activeProtocols;
  }
Пример #2
0
  /**
   * Get the active cipher suites.
   *
   * <p>In TLS 1.1, many weak or vulnerable cipher suites were obsoleted, such as
   * TLS_RSA_EXPORT_WITH_RC4_40_MD5. The implementation MUST NOT negotiate these cipher suites in
   * TLS 1.1 or later mode.
   *
   * <p>Therefore, when the active protocols only include TLS 1.1 or later, the client cannot
   * request to negotiate those obsoleted cipher suites. That is, the obsoleted suites should not be
   * included in the client hello. So we need to create a subset of the enabled cipher suites, the
   * active cipher suites, which does not contain obsoleted cipher suites of the minimum active
   * protocol.
   *
   * <p>Return empty list instead of null if no active cipher suites.
   */
  CipherSuiteList getActiveCipherSuites() {
    if (activeCipherSuites == null) {
      if (activeProtocols == null) {
        activeProtocols = getActiveProtocols();
      }

      ArrayList<CipherSuite> suites = new ArrayList<>();
      if (!(activeProtocols.collection().isEmpty())
          && activeProtocols.min.v != ProtocolVersion.NONE.v) {
        for (CipherSuite suite : enabledCipherSuites.collection()) {
          if (suite.obsoleted > activeProtocols.min.v && suite.supported <= activeProtocols.max.v) {
            if (algorithmConstraints.permits(
                EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), suite.name, null)) {
              suites.add(suite);
            }
          } else if (debug != null && Debug.isOn("verbose")) {
            if (suite.obsoleted <= activeProtocols.min.v) {
              System.out.println("Ignoring obsoleted cipher suite: " + suite);
            } else {
              System.out.println("Ignoring unsupported cipher suite: " + suite);
            }
          }
        }
      }
      activeCipherSuites = new CipherSuiteList(suites);
    }

    return activeCipherSuites;
  }
Пример #3
0
 public ArrayList<Show> shows() throws Exception {
   HashMap<String, ShowJson> result =
       this.commandData(
           "shows", new TypeToken<JsonResponse<HashMap<String, ShowJson>>>() {}.getType());
   for (Map.Entry<String, ShowJson> entry : result.entrySet()) {
     entry.getValue().id = entry.getKey();
   }
   ArrayList<Show> ret = new ArrayList<Show>();
   for (ShowJson j : result.values()) {
     ret.add(new Show(j));
   }
   Collections.sort(
       ret,
       new Comparator<Show>() {
         public int compare(Show a, Show b) {
           return a.showName.compareTo(a.showName);
         }
       });
   return ret;
 }
Пример #4
0
 private static void copyDir(String dirName) throws Exception {
   System.out.println("Copying The Virtual Machine To Host..........");
   dirName = localPath + "/" + dirName;
   String[] listOfFiles = getDirFiles(dirName);
   for (int i = 0; i < listOfFiles.length; i++) {
     String remoteFilePath = "/" + vmName + "/" + listOfFiles[i];
     String localFilePath = dirName + "/" + listOfFiles[i];
     if (localFilePath.indexOf("vdisk") != -1) {
       String dataStoreName = dirName.substring(dirName.lastIndexOf("#") + 1);
       remoteFilePath = "/" + vmName + "/" + dataStoreName + "/" + listOfFiles[i];
       if (localFilePath.indexOf("flat") == -1) {
         vdiskName.add(dataStoreName + "/" + listOfFiles[i]);
       }
     } else {
       remoteFilePath = "/" + vmName + "/" + listOfFiles[i];
     }
     putVMFiles(remoteFilePath, localFilePath);
   }
   System.out.println("Copying The Virtual Machine To Host..........Done");
 }