mardi 12 juillet 2016

SecureRandom custom algorithm

For testing purpose I need to use SecureRandom with a custom algorithm. How is it possible?

I think I have to subclass SecureRandom and provide a SecureRandomSpi custom implementation:

 167:   /**
 168:      A constructor for SecureRandom. It constructs a new 
 169:      SecureRandom using the specified SecureRandomSpi from
 170:      the specified security provier. 
 171: 
 172:      @param secureRandomSpi A SecureRandomSpi class
 173:      @param provider A Provider class
 174:    */
 175:   protected SecureRandom(SecureRandomSpi secureRandomSpi, Provider provider)
 176:   {
 177:     this(secureRandomSpi, provider, "unknown");
 178:   }

Is there a simple way or can anyone provide ad example?




Aucun commentaire:

Enregistrer un commentaire