Code example for PublicKey

Methods: getAlgorithm

0
  public PublicKey getKey() {
    return logKey;
  } 
 
  public String getSignatureAlgorithm() {
    return logKey.getAlgorithm();
  } 
 
  public boolean isSameLogId(byte[] idToCheck) {
    return Arrays.equals(getID(), idToCheck);
  } 
 
  private static byte[] calculateLogId(PublicKey logKey) {
    try { 
      MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
      sha256.update(logKey.getEncoded());
      return sha256.digest();
 
    } catch (NoSuchAlgorithmException e) {
      throw new UnsupportedCryptoPrimitiveException("Missing SHA-256", e);
    }