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(); } YkneoBitcoinSoft(); @Override byte[] exportExtendedPublicKey(); @Override String getAppletVersion(); @Override boolean isKeyLoaded(); @Override void unlockUser(String pin); @Override void unlockAdmin(String pin); @Override boolean isUserUnlocked(); @Override boolean isAdminUnlocked(); @Override void setUserPin(String oldPin, String newPin); @Override void setAdminPin(String oldPin, String newPin); @Override void resetUserPin(String newPin); @Override byte[] getHeader(); @Override void setAdminRetryCount(int attempts); @Override void setUserRetryCount(int attempts); @Override byte[] getPublicKey(boolean compress, int... index); @Override byte[] sign(byte[] hash, int... index); @Override byte[] generateMasterKeyPair(boolean allowExport, boolean returnPrivateKey, boolean testnetKey); @Override void importExtendedKeyPair(byte[] extendedPrivateKey, boolean allowExport);  }
@Test public void testSign() throws Exception { testImportExtended(); neo.unlockUser(userPin); byte[] hash = new byte[32]; byte[] signature = neo.sign(hash, 0); assertThat(signature.length, Matchers.lessThanOrEqualTo(72)); }