private static String getFingerprint(X509Certificate cert) {
   try {
     MessageDigest dgst = MessageDigest.getInstance("SHA512");
     byte[] encoded = cert.getPublicKey().getEncoded();
     byte[] fingerprint = dgst.digest(encoded);
     return IntegralToString.bytesToHexString(fingerprint, false);
   } catch (NoSuchAlgorithmException e) {
     throw new AssertionError(e);
   }
 }
Example #2
0
 /**
  * Converts the specified signed long value into a string representation based on the specified
  * radix. The returned string is a concatenation of a minus sign if the number is negative and
  * characters from '0' to '9' and 'a' to 'z', depending on the radix. If {@code radix} is not in
  * the interval defined by {@code Character.MIN_RADIX} and {@code Character.MAX_RADIX} then 10 is
  * used as the base for the conversion.
  *
  * <p>This method treats its argument as signed. If you want to convert an unsigned value to one
  * of the common non-decimal bases, you may find {@link #toBinaryString}, {@code #toHexString}, or
  * {@link #toOctalString} more convenient.
  *
  * @param v the signed long to convert.
  * @param radix the base to use for the conversion.
  * @return the string representation of {@code v}.
  */
 public static String toString(long v, int radix) {
   return IntegralToString.longToString(v, radix);
 }
Example #3
0
 /**
  * Converts the specified long value into its decimal string representation. The returned string
  * is a concatenation of a minus sign if the number is negative and characters from '0' to '9'.
  *
  * @param n the long to convert.
  * @return the decimal string representation of {@code l}.
  */
 public static String toString(long n) {
   return IntegralToString.longToString(n);
 }
Example #4
0
 /**
  * Converts the specified long value into its octal string representation. The returned string is
  * a concatenation of characters from '0' to '7'.
  *
  * @param v the long value to convert.
  * @return the octal string representation of {@code l}.
  */
 public static String toOctalString(long v) {
   return IntegralToString.longToOctalString(v);
 }
Example #5
0
 /**
  * Converts the specified long value into its hexadecimal string representation. The returned
  * string is a concatenation of characters from '0' to '9' and 'a' to 'f'.
  *
  * @param v the long value to convert.
  * @return the hexadecimal string representation of {@code l}.
  */
 public static String toHexString(long v) {
   return IntegralToString.longToHexString(v);
 }
Example #6
0
 /**
  * Converts the specified long value into its binary string representation. The returned string is
  * a concatenation of '0' and '1' characters.
  *
  * @param v the long value to convert.
  * @return the binary string representation of {@code v}.
  */
 public static String toBinaryString(long v) {
   return IntegralToString.longToBinaryString(v);
 }