Codota Logo
Pin.fromString
Code IndexAdd Codota to your IDE (free)

How to use
fromString
method
in
eu.geekplace.javapinning.pin.Pin

Best Java code snippets using eu.geekplace.javapinning.pin.Pin.fromString (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: Flowdalic/java-pinning

protected final X509TrustManager tmForPins(String... pinStrings) {
  List<Pin> pins = new ArrayList<>(pinStrings.length);
  for (String pin : pinStrings) {
    pins.add(Pin.fromString(pin));
  }
  return tmForPins(pins);
}
origin: Flowdalic/java-pinning

protected final X509TrustManager tmForPins(String... pinStrings) {
  List<Pin> pins = new ArrayList<>(pinStrings.length);
  for (String pin : pinStrings) {
    pins.add(Pin.fromString(pin));
  }
  return tmForPins(pins);
}
origin: Flowdalic/java-pinning

@Test(expected = IllegalArgumentException.class)
public void pinWithControlChars() {
  final String pinString = "\tAB:cd\u1234";
  Pin.fromString("SHA256:" + pinString);
}
origin: Flowdalic/java-pinning

@Test(expected = IllegalArgumentException.class)
public void pinWithnonAsciiLetters() {
  final String pinString = "αΒΕGλ";
  Pin.fromString("SHA256:" + pinString);
}
origin: Flowdalic/java-pinning

@Test
public void pinWithWhitespaces() {
  // Let's shoot some holes into the pin string
  final int[] subsequences = new int[] { 4, 17, 21, 32 };
  StringBuilder sb = new StringBuilder();
  int start = 0;
  for (int i : subsequences) {
    sb.append(PIN_STRING_W_COLON.subSequence(start, i));
    sb.append(' ');
    start = i;
  }
  sb.append(PIN_STRING_W_COLON.subSequence(start, PIN_STRING_W_COLON.length()));
  Pin pin = Pin.fromString("CERTSHA256:" + sb.toString());
  byte[] pinBytes = pin.getPinBytes();
  final String pinString = HexUtilities.encodeToHex(pinBytes, true, true);
  // String.format() appends a ':' at the very end, so we have to do that too
  assertEquals(PIN_STRING_W_COLON, pinString);
}
origin: Flowdalic/java-pinning

@Test
public void fromString_plainCertHexString_returnsCertPlainPin() {
  CertPlainPin plainPin = (CertPlainPin) Pin.fromString("CERTPLAIN:" + TestUtilities.PLAIN_CERTIFICATE_1);
  assertNotNull(plainPin.getX509Certificate());
}
origin: Flowdalic/java-pinning

@Test
public void fromString_plainPinHexString_returnsPlainPin() {
  PlainPin plainPin = (PlainPin) Pin.fromString("PLAIN:" + TestUtilities.PLAIN_PUBLIC_KEY_1);
  assertNotNull(plainPin.getPublicKey());
}
origin: Flowdalic/java-pinning

@Test
public void pinWithFullwidthColon() {
  Pin pin = Pin.fromString("CERTSHA256:" + PIN_STRING_W_COLON);
  byte[] pinBytes = pin.getPinBytes();
  final String pinString = HexUtilities.encodeToHex(pinBytes, true, true);
  // String.format() appends a ':' at the very end, so we have to do that too
  assertEquals(PIN_STRING_W_COLON, pinString);
}
eu.geekplace.javapinning.pinPinfromString

Javadoc

Create a new Pin from the given String.

The Pin String must be in the format [type]:[hex-string], where type denotes the type of the Pin and hex-string is the binary value of the Pin encoded in hex. Currently supported types are

  • PLAIN
  • SHA256
  • CERTPLAIN
  • CERTSHA256
The hex-string must contain only of whitespace characters, colons (':'), numbers [0-9] and ASCII letters [a-fA-F]. It must be a valid hex-encoded binary representation. First the string is lower-cased, then all whitespace characters and colons are removed before the string is decoded to bytes.

Popular methods of Pin

  • pinsCertificate
  • getPinBytes
    Returns a clone of the bytes that represent this Pin. This method is meant for unit testing only and

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • putExtra (Intent)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now