/** * Compute the key that signed the given signature. * * @param messageHash 32-byte hash of message * @param signatureBase64 Base-64 encoded signature * * @return ECKey */ public static ECKey signatureToKey(byte[] messageHash, String signatureBase64) throws SignatureException { byte[] keyBytes = signatureToKeyBytes(messageHash, signatureBase64); return fromPublicOnly(keyBytes); }
/** * Recover the public key from an encoded node id. * * @param nodeId a 64-byte X,Y point pair */ public static ECKey fromNodeId(byte[] nodeId) { check(nodeId.length == 64, "Expected a 64 byte node id"); byte[] pubBytes = new byte[65]; System.arraycopy(nodeId, 0, pubBytes, 1, nodeId.length); pubBytes[0] = 0x04; // uncompressed return fromPublicOnly(pubBytes); }
/** * Compute the key that signed the given signature. * * @param messageHash 32-byte hash of message * @param sig - * * @return ECKey */ public static ECKey signatureToKey(byte[] messageHash, ECDSASignature sig) throws SignatureException { byte[] keyBytes = signatureToKeyBytes(messageHash, sig); return fromPublicOnly(keyBytes); }
/** * @param recId Which possible key to recover. * @param sig the R and S components of the signature, wrapped. * @param messageHash Hash of the data that was signed. * * @return ECKey */ @Nullable public static ECKey recoverFromSignature(int recId, ECDSASignature sig, byte[] messageHash) { byte[] pubBytes = recoverPubBytesFromSignature(recId, sig, messageHash); if (pubBytes == null) { return null; } else { return fromPublicOnly(pubBytes); } } /**