Tabnine Logo
SVNSSLUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
SVNSSLUtil
in
org.tmatesoft.svn.core.internal.util

Best Java code snippets using org.tmatesoft.svn.core.internal.util.SVNSSLUtil (Showing top 18 results out of 315)

origin: org.tmatesoft.svnkit/svnkit

private static String getFingerprint(X509Certificate cert) {
  try  {
    return getFingerprint(cert.getEncoded(), "SHA1");
  } catch (Exception e)  {
  } 
  return null;
}
origin: org.tmatesoft.svnkit/svnkit

public static StringBuffer getServerCertificatePrompt(X509Certificate cert, String realm, String hostName) {
  return getServerCertificatePrompt(cert, realm, hostName, EnumSet.noneOf(SVNCertificateFailureKind.class));
}
origin: org.codehaus.jtstand/jtstand-svnkit

public static StringBuffer getServerCertificatePrompt(X509Certificate cert, String realm, String hostName) {
  int failures = getServerCertificateFailures(cert, hostName);
  StringBuffer prompt = new StringBuffer();
  prompt.append("Error validating server certificate for '");
  prompt.append(realm);
  prompt.append("':\n");
  if ((failures & 8) != 0) {
    prompt.append(" - The certificate is not issued by a trusted authority. Use the\n" +
           "   fingerprint to validate the certificate manually!\n");
  }
  if ((failures & 4) != 0) {
    prompt.append(" - The certificate hostname does not match.\n");
  }
  if ((failures & 2) != 0) {
    prompt.append(" - The certificate has expired.\n");
  }
  if ((failures & 1) != 0) {
    prompt.append(" - The certificate is not yet valid.\n");
  }
  getServerCertificateInfo(cert, prompt);
  return prompt;
}

origin: org.tmatesoft.svnkit/svnkit-javahl16

public int acceptServerAuthentication(SVNURL url, String realm, Object serverAuth,  boolean resultMayBeStored) {
  if (myPrompt instanceof PromptUserPassword2 && serverAuth instanceof X509Certificate) {
    PromptUserPassword2 sslPrompt = (PromptUserPassword2) myPrompt;
    serverAuth = serverAuth instanceof X509Certificate ?
        SVNSSLUtil.getServerCertificatePrompt((X509Certificate) serverAuth, realm, url.getHost()) : serverAuth;
    if (serverAuth == null) {
      serverAuth = "Unsupported certificate type '" + (serverAuth != null ? serverAuth.getClass().getName() : "null") + "'";
    }
    return sslPrompt.askTrustSSLServer(serverAuth.toString(), resultMayBeStored);
  } else if (myPrompt != null && serverAuth instanceof byte[]) {
    String prompt = "The ''{0}'' server''s key fingerprint is:\n{1}\n" +
        "If you trust this host, select ''Yes'' to add the key to the SVN cache and carry on connecting.\n" +
        "If you do not trust this host, select ''No'' to abandon the connection.";            
    prompt = MessageFormat.format(prompt, new Object[] {url.getHost(), SVNSSLUtil.getFingerprint((byte[]) serverAuth, "MD5")});
    if (!myPrompt.askYesNo(realm, prompt, false)) {
      return REJECTED;
    }                
  }
  return ACCEPTED;
}
origin: org.codehaus.jtstand/jtstand-svnkit

int failures = SVNSSLUtil.getServerCertificateFailures(certs[0], myURL.getHost());
origin: org.tmatesoft.svnkit/svnkit-javahl16

public int acceptServerAuthentication(SVNURL url, String realm, Object serverAuth,  boolean resultMayBeStored) {
  if (serverAuth instanceof X509Certificate) {
    serverAuth = serverAuth instanceof X509Certificate ?
        SVNSSLUtil.getServerCertificatePrompt((X509Certificate) serverAuth, realm, url.getHost()) : serverAuth;
    if (serverAuth == null) {
      serverAuth = "Unsupported certificate type '" + (serverAuth != null ? serverAuth.getClass().getName() : "null") + "'";
    }
    return prompt.askTrustSSLServer(serverAuth.toString(), resultMayBeStored);
  } else if (prompt != null && serverAuth instanceof byte[]) {
    String prompt = "The ''{0}'' server''s key fingerprint is:\n{1}\n" +
        "If you trust this host, select ''Yes'' to add the key to the SVN cache and carry on connecting.\n" +
        "If you do not trust this host, select ''No'' to abandon the connection.";
    prompt = MessageFormat.format(prompt, new Object[]{url.getHost(), SVNSSLUtil.getFingerprint((byte[]) serverAuth, "MD5")});
    if (!this.prompt.askYesNo(realm, prompt, false)) {
      return REJECTED;
    }
  }
  return ACCEPTED;
}
origin: org.jvnet.hudson.svnkit/svnkit

int failures = SVNSSLUtil.getServerCertificateFailures(certs[0], myURL.getHost());
origin: org.tmatesoft.svnkit/svnkit-cli

    prompt.append("\n(R)eject or accept (t)emporarily? "); 
  System.err.print(MessageFormat.format(prompt.toString(), new Object[] {url.getHost(), SVNSSLUtil.getFingerprint((byte[]) certificate, "MD5")}));
  System.err.flush();
  while(true) {
StringBuffer prompt = SVNSSLUtil.getServerCertificatePrompt(cert, realm, hostName, trustServerCertificateFailureKinds);
if (resultMayBeStored) {
  prompt.append("\n(R)eject, accept (t)emporarily or accept (p)ermanently? "); 
origin: org.jvnet.hudson.svnkit/svnkit

private static String getFingerprint(X509Certificate cert) {
  try  {
    return getFingerprint(cert.getEncoded());
  } catch (Exception e)  {
  } 
  return null;
}
origin: org.codehaus.jtstand/jtstand-svnkit

public int acceptServerAuthentication(SVNURL url, String realm, Object serverAuth,  boolean resultMayBeStored) {
  if (serverAuth != null && myPrompt instanceof PromptUserPassword2) {
    PromptUserPassword2 sslPrompt = (PromptUserPassword2) myPrompt;
    serverAuth = serverAuth instanceof X509Certificate ? 
        SVNSSLUtil.getServerCertificatePrompt((X509Certificate) serverAuth, realm, url.getHost()) : serverAuth;
    if (serverAuth == null) {
      serverAuth = "Unsupported certificate type '" + (serverAuth != null ? serverAuth.getClass().getName() : "null") + "'";
    }
    return sslPrompt.askTrustSSLServer(serverAuth.toString(), resultMayBeStored);
  }
  return ACCEPTED;
}

origin: org.jvnet.hudson.svnkit/svnkit

public static StringBuffer getServerCertificatePrompt(X509Certificate cert, String realm, String hostName) {
  int failures = getServerCertificateFailures(cert, hostName);
  StringBuffer prompt = new StringBuffer();
  prompt.append("Error validating server certificate for '");
  prompt.append(realm);
  prompt.append("':\n");
  if ((failures & 8) != 0) {
    prompt.append(" - The certificate is not issued by a trusted authority. Use the\n" +
           "   fingerprint to validate the certificate manually!\n");
  }
  if ((failures & 4) != 0) {
    prompt.append(" - The certificate hostname does not match.\n");
  }
  if ((failures & 2) != 0) {
    prompt.append(" - The certificate has expired.\n");
  }
  if ((failures & 1) != 0) {
    prompt.append(" - The certificate is not yet valid.\n");
  }
  getServerCertificateInfo(cert, prompt);
  return prompt;
}

origin: org.tmatesoft.svnkit/svnkit

int failures = SVNSSLUtil.getServerCertificateFailures(certs[0], myURL.getHost());
origin: sonia.svnkit/svnkit-cli

    prompt.append("\n(R)eject or accept (t)emporarily? "); 
  System.err.print(MessageFormat.format(prompt.toString(), new Object[] {url.getHost(), SVNSSLUtil.getFingerprint((byte[]) certificate, "MD5")}));
  System.err.flush();
  while(true) {
StringBuffer prompt = SVNSSLUtil.getServerCertificatePrompt(cert, realm, hostName, trustServerCertificateFailureKinds);
if (resultMayBeStored) {
  prompt.append("\n(R)eject, accept (t)emporarily or accept (p)ermanently? "); 
origin: org.tmatesoft.svnkit/svnkit

private static void getServerCertificateInfo(X509Certificate cert, StringBuffer info) {
  info.append("Certificate information:");
  info.append('\n');
  info.append(" - Subject: ");
  info.append(cert.getSubjectDN().getName());
  info.append('\n');
  info.append(" - Valid: ");
  info.append("from " + cert.getNotBefore() + " until " + cert.getNotAfter());
  info.append('\n');
  info.append(" - Issuer: ");
  info.append(cert.getIssuerDN().getName());
  info.append('\n');
  info.append(" - Fingerprint: ");
  info.append(getFingerprint(cert));
}
origin: org.jvnet.hudson.svnkit/svnkit

public int acceptServerAuthentication(SVNURL url, String realm, Object serverAuth,  boolean resultMayBeStored) {
  if (myPrompt instanceof PromptUserPassword2 && serverAuth instanceof X509Certificate) {
    PromptUserPassword2 sslPrompt = (PromptUserPassword2) myPrompt;
    serverAuth = serverAuth instanceof X509Certificate ?
        SVNSSLUtil.getServerCertificatePrompt((X509Certificate) serverAuth, realm, url.getHost()) : serverAuth;
    if (serverAuth == null) {
      serverAuth = "Unsupported certificate type '" + (serverAuth != null ? serverAuth.getClass().getName() : "null") + "'";
    }
    return sslPrompt.askTrustSSLServer(serverAuth.toString(), resultMayBeStored);
  } else if (myPrompt != null && serverAuth instanceof byte[]) {
    String prompt = "The ''{0}'' server''s key fingerprint is:\n{1}\n" +
        "If you trust this host, select ''Yes'' to add the key to the SVN cache and carry on connecting.\n" +
        "If you do not trust this host, select ''No'' to abandon the connection.";            
    if (!myPrompt.askYesNo(realm, prompt, false)) {
      return REJECTED;
    }                
  }
  return ACCEPTED;
}
origin: org.tmatesoft.svnkit/svnkit

public static StringBuffer getServerCertificatePrompt(X509Certificate cert, String realm, String hostName, EnumSet<SVNCertificateFailureKind> trustCertificateFailureKinds) {
  int failures = getServerCertificateFailures(cert, hostName);
  int trustMask = SVNCertificateFailureKind.createMask(trustCertificateFailureKinds);
  failures &= ~trustMask;
  StringBuffer prompt = new StringBuffer();
  prompt.append("Error validating server certificate for '");
  prompt.append(realm);
  prompt.append("':\n");
  if ((failures & SVNCertificateFailureKind.UNKNOWN_CA.getCode()) != 0) {
    prompt.append(" - The certificate is not issued by a trusted authority. Use the\n" +
           "   fingerprint to validate the certificate manually!\n");
  }
  if ((failures & SVNCertificateFailureKind.CN_MISMATCH.getCode()) != 0) {
    prompt.append(" - The certificate hostname does not match.\n");
  }
  if ((failures & SVNCertificateFailureKind.EXPIRED.getCode()) != 0) {
    prompt.append(" - The certificate has expired.\n");
  }
  if ((failures & SVNCertificateFailureKind.NOT_YET_VALID.getCode()) != 0) {
    prompt.append(" - The certificate is not yet valid.\n");
  }
  getServerCertificateInfo(cert, prompt);
  return prompt;
}

origin: org.jvnet.hudson.svnkit/svnkit

private static void getServerCertificateInfo(X509Certificate cert, StringBuffer info) {
  info.append("Certificate information:");
  info.append('\n');
  info.append(" - Subject: ");
  info.append(cert.getSubjectDN().getName());
  info.append('\n');
  info.append(" - Valid: ");
  info.append("from " + cert.getNotBefore() + " until " + cert.getNotAfter());
  info.append('\n');
  info.append(" - Issuer: ");
  info.append(cert.getIssuerDN().getName());
  info.append('\n');
  info.append(" - Fingerprint: ");
  info.append(getFingerprint(cert));
}
origin: org.codehaus.jtstand/jtstand-svnkit

private static void getServerCertificateInfo(X509Certificate cert, StringBuffer info) {
  info.append("Certificate information:");
  info.append('\n');
  info.append(" - Subject: ");
  info.append(cert.getSubjectDN().getName());
  info.append('\n');
  info.append(" - Valid: ");
  info.append("from " + cert.getNotBefore() + " until " + cert.getNotAfter());
  info.append('\n');
  info.append(" - Issuer: ");
  info.append(cert.getIssuerDN().getName());
  info.append('\n');
  info.append(" - Fingerprint: ");
  info.append(getFingerprint(cert));
}
org.tmatesoft.svn.core.internal.utilSVNSSLUtil

Most used methods

  • getFingerprint
  • getServerCertificatePrompt
  • getServerCertificateFailures
  • getServerCertificateInfo

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • findViewById (Activity)
  • runOnUiThread (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • JLabel (javax.swing)
  • JTextField (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now