paseto-toolkit / jpaseto

A library for creating and parsing Paseto in Java
Apache License 2.0
65 stars 15 forks source link

java.lang.SecurityException: JVM does not provide a strong secure random number generator #184

Open madanprabhud opened 1 year ago

madanprabhud commented 1 year ago

java.lang.SecurityException: JVM does not provide a strong secure random number generator at dev.paseto.jpaseto.impl.DefaultPasetoV1LocalBuilder.compact(DefaultPasetoV1LocalBuilder.java:61)

Caused by: java.security.NoSuchAlgorithmException: Null/empty securerandom.strongAlgorithms Security Property at java.security.SecureRandom.getInstanceStrong(SecureRandom.java:623) at dev.paseto.jpaseto.impl.DefaultPasetoV1LocalBuilder.compact(DefaultPasetoV1LocalBuilder.java:59) ... 132 more

Java -- Version: java version "1.8.0_341" Java(TM) SE Runtime Environment (build 1.8.0_341-b10) Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode) Red Hat Enterprise Linux Server release 7.9 (Maipo) haveged 1.9.13

madanprabhud commented 1 year ago

The same code is working fine with jdk1.8.0_301

It's not working in jdk1.8.0_341

bdemers commented 1 year ago

It sounds like this might be a JVM or a VM issue. Have you tried this with a newer version of Java 8?

Are you running this inside a VM that doesn't have a secure random device?

Something like this: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-guest_virtual_machine_device_configuration-random_number_generator_device