@@ -245,7 +245,7 @@ protected AlgorithmParameters engineGetParameters() {
245245 params .init ((new DerValue (
246246 DerValue .tag_OctetString , nonceData ).toByteArray ()));
247247 } catch (NoSuchAlgorithmException | IOException exc ) {
248- throw new RuntimeException (exc );
248+ throw new ProviderException (exc );
249249 }
250250 }
251251
@@ -353,7 +353,7 @@ protected void engineInit(int opmode, Key key,
353353 break ;
354354 default :
355355 // Should never happen
356- throw new RuntimeException ("ChaCha20 in unsupported mode" );
356+ throw new ProviderException ("ChaCha20 in unsupported mode" );
357357 }
358358 init (opmode , key , newNonce );
359359 }
@@ -426,7 +426,7 @@ protected void engineInit(int opmode, Key key,
426426 }
427427 break ;
428428 default :
429- throw new RuntimeException ("Invalid mode: " + mode );
429+ throw new ProviderException ("Invalid mode: " + mode );
430430 }
431431
432432 // Continue with initialization
@@ -730,7 +730,7 @@ protected byte[] engineDoFinal(byte[] in, int inOfs, int inLen)
730730 try {
731731 engine .doFinal (in , inOfs , inLen , output , 0 );
732732 } catch (ShortBufferException | KeyException exc ) {
733- throw new RuntimeException (exc );
733+ throw new ProviderException (exc );
734734 } finally {
735735 // Reset the cipher's state to post-init values.
736736 resetStartState ();
@@ -767,7 +767,7 @@ protected int engineDoFinal(byte[] in, int inOfs, int inLen, byte[] out,
767767 try {
768768 bytesUpdated = engine .doFinal (in , inOfs , inLen , out , outOfs );
769769 } catch (KeyException ke ) {
770- throw new RuntimeException (ke );
770+ throw new ProviderException (ke );
771771 } finally {
772772 // Reset the cipher's state to post-init values.
773773 resetStartState ();
0 commit comments