core: Add newSecureRandom() that uses a non-blocking SecureRandom provider

This commit is contained in:
Andras Slemmer 2016-06-16 17:06:01 +01:00
parent 60d175da02
commit 6229e39b42

View File

@ -10,6 +10,10 @@ import java.security.*
import java.security.interfaces.ECPublicKey
import net.i2p.crypto.eddsa.KeyPairGenerator as EddsaKeyPairGenerator
fun newSecureRandom(): SecureRandom {
return SecureRandom.getInstance("NativePRNGNonBlocking")
}
// "sealed" here means there can't be any subclasses other than the ones defined here.
sealed class SecureHash private constructor(bits: ByteArray) : OpaqueBytes(bits) {
class SHA256(bits: ByteArray) : SecureHash(bits) {