@Test public void sign() throws Exception { byte[] data = "Hello world".getBytes(); PrivateKey k = TestKeys.privateKey(3); byte [] signature = ExtendedSignature.sign(k, data); PublicKey pubKey = k.getPublicKey(); ExtendedSignature es = ExtendedSignature.verify(pubKey, signature, data); assertNotNull(es); assertAlmostSame(es.getCreatedAt(), ZonedDateTime.now()); assertEquals(ExtendedSignature.keyId(k), ExtendedSignature.keyId(pubKey)); assertEquals(ExtendedSignature.keyId(k), ExtendedSignature.extractKeyId(signature)); }
static public byte[] sign(PrivateKey key, byte[] data) { return sign(key, data, true); }
ExtendedSignature { static public byte[] sign(PrivateKey key, byte[] data) { return sign(key, data, true); } }
ExtendedSignature { static public byte[] sign(PrivateKey key, byte[] data) { return sign(key, data, true); }  }
ExtendedSignature { static public byte[] sign(PrivateKey key, byte[] data) { return sign(key, data, true); }  Bytes getKeyId(); ZonedDateTime getCreatedAt(); PublicKey getPublicKey(); static byte[] sign(PrivateKey key, byte[] data); static byte[] sign(PrivateKey key, byte[] data, boolean savePublicKey); static byte[] createTargetSignature(PublicKey publicKey, byte[] data, boolean savePublicKey); @Deprecated static byte[] of(byte[] targetSignature, byte[] sign, byte[] sign2); static byte[] ofSha512AndSha3_384(byte[] targetSignature, byte[] sign512, byte[] sign3_384); static Bytes keyId(AbstractKey key); static Bytes extractKeyId(byte[] signature); static PublicKey extractPublicKey(byte[] signature); byte[] getSignature(); static ExtendedSignature verify(PublicKey key, byte[] signature, byte[] data); }
ExtendedSignature { static public byte[] sign(PrivateKey key, byte[] data) { return sign(key, data, true); }  Bytes getKeyId(); ZonedDateTime getCreatedAt(); PublicKey getPublicKey(); static byte[] sign(PrivateKey key, byte[] data); static byte[] sign(PrivateKey key, byte[] data, boolean savePublicKey); static byte[] createTargetSignature(PublicKey publicKey, byte[] data, boolean savePublicKey); @Deprecated static byte[] of(byte[] targetSignature, byte[] sign, byte[] sign2); static byte[] ofSha512AndSha3_384(byte[] targetSignature, byte[] sign512, byte[] sign3_384); static Bytes keyId(AbstractKey key); static Bytes extractKeyId(byte[] signature); static PublicKey extractPublicKey(byte[] signature); byte[] getSignature(); static ExtendedSignature verify(PublicKey key, byte[] signature, byte[] data);  }