Class Base64StringKeyGenerator
- java.lang.Object
-
- org.springframework.security.crypto.keygen.Base64StringKeyGenerator
-
- All Implemented Interfaces:
StringKeyGenerator
public class Base64StringKeyGenerator extends java.lang.Object implements StringKeyGenerator
A StringKeyGenerator that generates base64-encoded String keys. Delegates to aBytesKeyGenerator
for the actual key generation.- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description Base64StringKeyGenerator()
Creates an instance with keyLength of 32 bytes and standard Base64 encoding.Base64StringKeyGenerator(int keyLength)
Creates an instance with the provided key length in bytes and standard Base64 encoding.Base64StringKeyGenerator(java.util.Base64.Encoder encoder)
Creates an instance with keyLength of 32 bytes and the provided encoder.Base64StringKeyGenerator(java.util.Base64.Encoder encoder, int keyLength)
Creates an instance with the provided key length and encoder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
generateKey()
-
-
-
Constructor Detail
-
Base64StringKeyGenerator
public Base64StringKeyGenerator()
Creates an instance with keyLength of 32 bytes and standard Base64 encoding.
-
Base64StringKeyGenerator
public Base64StringKeyGenerator(int keyLength)
Creates an instance with the provided key length in bytes and standard Base64 encoding.- Parameters:
keyLength
- the key length in bytes
-
Base64StringKeyGenerator
public Base64StringKeyGenerator(java.util.Base64.Encoder encoder)
Creates an instance with keyLength of 32 bytes and the provided encoder.- Parameters:
encoder
- the encoder to use
-
Base64StringKeyGenerator
public Base64StringKeyGenerator(java.util.Base64.Encoder encoder, int keyLength)
Creates an instance with the provided key length and encoder.- Parameters:
encoder
- the encoder to usekeyLength
- the key length to use
-
-
Method Detail
-
generateKey
public java.lang.String generateKey()
- Specified by:
generateKey
in interfaceStringKeyGenerator
-
-