NEP2 { public static ECKeyPair decrypt(String password, String nep2String) throws CipherException, NEP2InvalidFormat, NEP2InvalidPassphrase { return decrypt(password, nep2String, new ScryptParams(N_STANDARD, P_STANDARD, R_STANDARD)); }  static ECKeyPair decrypt(String password, String nep2String); static ECKeyPair decrypt(String password, String nep2String, ScryptParams scryptParams); static String encrypt(String password, ECKeyPair ecKeyPair); static String encrypt(String password, ECKeyPair ecKeyPair, ScryptParams scryptParams); static String encrypt(String password, ECKeyPair ecKeyPair, int n, int p, int r); static byte[] performCipherOperation(
            int mode, byte[] data, byte[] encryptKey); static byte[] getAddressHash(ECKeyPair ecKeyPair); static final int DKLEN; static final int NEP2_PRIVATE_KEY_LENGTH; static final byte NEP2_PREFIX_1; static final byte NEP2_PREFIX_2; static final byte NEP2_FLAGBYTE; static final int N_STANDARD; static final int P_STANDARD; static final int R_STANDARD; static final ScryptParams DEFAULT_SCRYPT_PARAMS; }
@Test public void decryptWithDefaultScryptParams() throws NEP2InvalidFormat, CipherException, NEP2InvalidPassphrase { String nep2Encrypted = "6PYSAe53CzgXq9yg7hmHQogZHxasVY2gYGB9rLXNbdggFyy2HBDdJhXZSp"; String password = "neo"; ECKeyPair pair = NEP2.decrypt(password, nep2Encrypted); String expected = "a7038726c5a127989d78593c423e3dad93b2d74db90a16c0a58468c9e6617a87"; assertThat(pair.getPrivateKey().getBytes(), is(Numeric.hexStringToByteArray(expected))); }
@Test public void decryptWithNonDefaultScryptParams() throws NEP2InvalidFormat, CipherException, NEP2InvalidPassphrase { ScryptParams nonDefaultScryptParams = new ScryptParams(256, 1, 1); String nep2Encrypted = "6PYSAe53E2MXoxZpr3Fmqtjf7FT3BBQU1pS55iYW1hrjU6xhXXHhYnTjkn"; String password = "neo"; ECKeyPair pair = NEP2.decrypt(password, nep2Encrypted, nonDefaultScryptParams); String expected = "a7038726c5a127989d78593c423e3dad93b2d74db90a16c0a58468c9e6617a87"; assertThat(pair.getPrivateKey().getBytes(), is(Numeric.hexStringToByteArray(expected))); }