Ejemplo n.º 1
0
  private static boolean checkSingleExts(OCSPResponse.SingleResponse sr, int singleExtCount) {
    Map<String, Extension> singleExts;
    try {
      singleExts = sr.getSingleExtensions();
    } catch (NullPointerException npe) {
      System.out.println("Warning: Sent null singleResponse into checkSingleExts");
      return false;
    }

    for (String key : singleExts.keySet()) {
      System.out.println("singleExtension: " + singleExts.get(key));
    }

    if (singleExts.size() != singleExtCount) {
      System.out.println(
          "Single Extension count mismatch, "
              + "expected "
              + singleExtCount
              + ", got "
              + singleExts.size());
      return false;
    } else {
      return true;
    }
  }
Ejemplo n.º 2
0
 private static Bundle createMockBundle(String[] signers) {
   Map /* <X509Certificate, List<X509Certificate>> */ signersMap = new HashMap();
   for (int i = 0; i < signers.length; i++) {
     List chain = parseDNchain(signers[i]);
     List /* <X509Certificate> */ signersList = new ArrayList();
     Principal subject = null, issuer = null;
     X509Certificate first = null;
     for (Iterator iChain = chain.iterator(); iChain.hasNext(); ) {
       subject = issuer == null ? new MockPrincipal((String) iChain.next()) : issuer;
       issuer = iChain.hasNext() ? new MockPrincipal((String) iChain.next()) : subject;
       X509Certificate cert = new MockX509Certificate(subject, issuer);
       if (first == null) first = cert;
       signersList.add(cert);
     }
     if (subject != issuer) signersList.add(new MockX509Certificate(issuer, issuer));
     signersMap.put(first, signersList);
   }
   return new MockBundle(signersMap);
 }
  /** {@inheritDoc} */
  @Override
  public VerifyCertificateDialog createDialog(Certificate[] certs, String title, String message) {
    if (title == null)
      title = JitsiApplication.getResString(R.string.service_gui_CERT_DIALOG_TITLE);

    Long requestId = System.currentTimeMillis();

    VerifyCertDialog verifyCertDialog = new VerifyCertDialog(requestId, certs[0], title, message);

    requestMap.put(requestId, verifyCertDialog);

    logger.debug(hashCode() + " creating dialog: " + requestId);

    return verifyCertDialog;
  }
  /**
   * Retrieves the dialog for given <tt>requestId</tt>.
   *
   * @param requestId dialog's request identifier assigned during dialog creation.
   * @return the dialog for given <tt>requestId</tt>.
   */
  public VerifyCertDialog retrieveDialog(Long requestId) {
    logger.debug(hashCode() + " getting dialog: " + requestId);

    return requestMap.get(requestId);
  }