libsodium-jna icon indicating copy to clipboard operation
libsodium-jna copied to clipboard

SodiumLibraryException: invalid key length 184 bytes

Open raymondtiongco opened this issue 6 years ago • 2 comments

Issue when im decrypting a key of 184 bytes. the allowed is 32 bytes. how can we change the constant NativeLong crypto_box_secretkeybytes() into 184

raymondtiongco avatar Mar 20 '19 13:03 raymondtiongco

Exception in thread "main" com.muquit.libsodiumjna.exceptions.SodiumLibraryException: invalid key length 184 bytes at com.muquit.libsodiumjna.SodiumLibrary.cryptoSecretBoxOpenEasy(SodiumLibrary.java:792) at test.com.muquit.libsodiumjna.TestSodiumLibrary.testCryptoSecretBoxEasyEcryptDecrypt(TestSodiumLibrary.java:203) at test.com.muquit.libsodiumjna.TestSodiumLibrary.main(TestSodiumLibrary.java:222)

raymondtiongco avatar Mar 20 '19 13:03 raymondtiongco

This constant is defined in crypto_box.h of libsodium C library. If you want to change it, you have to change it in the libsodium C library. I am not a cryptographer, so I prefer to use default constants and settings of libsodium C library set by the people who understand it more than I do. libsodium-jna is a thin wrapper around libsodium C library. Thanks.

muquit avatar Mar 21 '19 01:03 muquit