Closed emartynov closed 4 years ago
Hi @emartynov,
Yes so nearly all methods in the Lazy
interface will throw a SodiumException
which you can catch if anything goes wrong in Lazysodium.
In the Native
interface it is generally expected that the underlying libsodium library will throw all the relevant exceptions. The Native
interface assumes the developer knows what they are doing as it is very low level.
As Lazysodium uses JNA for its bindings, see here for more details https://stackoverflow.com/questions/7231583/jna-catching-exceptions.
So native exceptions will be wrapped with lazy sodium exception?
Only for the Lazy
interface. As it's the Lazy interface, Lazysodium tries to handle the exceptions and make them more suitable for developers.
For the Native
interface it is up to the developer to handle exceptions.
Perfect! Thank you!
Hi people,
The new user question here coming from java crypto API. How does library report about errors?
If key can not be generated? Could encryption/decryption fail?
Kind Regards, Eugen