public interface SaltGenerator
Common interface for all salt generators which can be applied in digest or encryption operations.
Every implementation of this interface must be thread-safe.
Modifier and Type | Method and Description |
---|---|
byte[] |
generateSalt(int lengthBytes)
This method will be called for requesting the generation of a new
salt of the specified length.
|
boolean |
includePlainSaltInEncryptionResults()
Determines if the digests and encrypted messages created with a
specific salt generator will include (prepended) the unencrypted
salt itself, so that it can be used for matching and decryption
operations.
|
byte[] generateSalt(int lengthBytes)
This method will be called for requesting the generation of a new salt of the specified length.
lengthBytes
- the requested length for the salt.boolean includePlainSaltInEncryptionResults()
Determines if the digests and encrypted messages created with a specific salt generator will include (prepended) the unencrypted salt itself, so that it can be used for matching and decryption operations.
Generally, including the salt unencrypted in encryption results will be mandatory for randomly generated salts, or for those generated in a non-predictable manner. Otherwise, digest matching and decryption operations will always fail. For fixed salts, inclusion will be optional (and in fact undesirable if we want to hide the salt value).
Copyright © 2017 JBoss by Red Hat. All rights reserved.