class YkneoBitcoinSoft implements YkneoBitcoin {

    @Override
    public byte[] sign(byte[] hash, int... index) throws PinModeLockedException, UnusableIndexException, IOException, NoKeyLoadedException {
        DeterministicKey key = getKey(index);
        ECKey.ECDSASignature signature = key.toECKey().sign(new Sha256Hash(hash));
        return signature.encodeToDER();
    }

}

class YkneoBitcoinSoftTest {

    private static final String TERMINAL_NAME;
    private static final String userPin;
    private static final String adminPin;
    private static final BaseEncoding HEX;
    private YkneoBitcoin neo;

    @Test
    public void testSign() throws Exception {

        testImportExtended();
        neo.unlockUser(userPin);
        byte[] hash = new byte[32];
        byte[] signature = neo.sign(hash, 0);
        //TODO: Verify signature.
        assertThat(signature.length, Matchers.lessThanOrEqualTo(72));
    }

}