@Test
    public void signAndVerifyWithOffset_works() throws Exception {
        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("Ed25519", conscryptProvider);
        KeyPair keyPair = keyGen.generateKeyPair();

        byte[] message = decodeHex("00112233");
        Signature signature = Signature.getInstance("Ed25519", conscryptProvider);
        signature.initSign(keyPair.getPrivate());
        signature.update(message);
        byte[] sig = signature.sign();

        int offset = 5;

        signature.initSign(keyPair.getPrivate());
        byte[] messageWithOffset = new byte[message.length + 10];
        System.arraycopy(message, 0, messageWithOffset, 5, message.length);
        signature.update(messageWithOffset, 5, message.length);
        byte[] outputBuffer = new byte[100];
        int written = signature.sign(outputBuffer, offset, sig.length);

        assertEquals(written, sig.length);
        assertArrayEquals(sig, Arrays.copyOfRange(outputBuffer, offset, offset + sig.length));

        signature.initVerify(keyPair.getPublic());
        signature.update(message);

        assertTrue(signature.verify(outputBuffer, offset, sig.length));
    }
Implements a KeySpec that contains the raw bytes of a key.
common/src/test/java/org/conscrypt/EdDsaTest.java