Package io.cui.tools.net.ssl
Class KeyMaterialHolder
- java.lang.Object
-
- io.cui.tools.net.ssl.KeyMaterialHolder
-
- All Implemented Interfaces:
Serializable
public final class KeyMaterialHolder extends Object implements Serializable
Runtime representation of key-material. The actual key is provided as byte[]. An optional keyPassword is available as well.- Author:
- Oliver Wolff
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKeyMaterialHolder.KeyMaterialHolderBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KeyMaterialHolder.KeyMaterialHolderBuilderbuilder()static byte[]deserializeKeyMaterial(String serializedKeyMaterial)booleanequals(Object o)StringgetDescription()Optional: additional information transporting some context-information.KeyAlgorithmgetKeyAlgorithm()StringgetKeyAlias()Optional: An alias name for a given key.KeyHolderTypegetKeyHolderType()@lombok.NonNull byte[]getKeyMaterial()StringgetKeyPassword()(Optional) password for the key, or in case ofKeyHolderType.KEY_STOREfor the store.char[]getKeyPasswordAsCharArray()StringgetName()Optional: An arbitrary name for displaying the key in an ui or logging context.inthashCode()static StringserializeKeyMaterial(byte[] keyMaterial)StringtoString()
-
-
-
Method Detail
-
getKeyPasswordAsCharArray
public char[] getKeyPasswordAsCharArray()
- Returns:
- NPE-safe char-array representation of
getKeyPassword(). If keyPassword isnullor empty it returns an empty char[], nevernull
-
deserializeKeyMaterial
public static byte[] deserializeKeyMaterial(String serializedKeyMaterial)
- Parameters:
serializedKeyMaterial- the Base64 encoded key material- Returns:
- Raw i.e. original key material
- Throws:
IllegalArgumentException- if serializedKeyMaterial is not Base64 encoded
-
serializeKeyMaterial
public static String serializeKeyMaterial(byte[] keyMaterial)
- Parameters:
keyMaterial- Raw i.e. original key material- Returns:
- Base64 encoded key material
-
builder
public static KeyMaterialHolder.KeyMaterialHolderBuilder builder()
-
getKeyMaterial
@NonNull public @lombok.NonNull byte[] getKeyMaterial()
-
getKeyPassword
public String getKeyPassword()
(Optional) password for the key, or in case ofKeyHolderType.KEY_STOREfor the store.
-
getName
public String getName()
Optional: An arbitrary name for displaying the key in an ui or logging context.
-
getDescription
public String getDescription()
Optional: additional information transporting some context-information.
-
getKeyAlias
public String getKeyAlias()
Optional: An alias name for a given key.
-
getKeyHolderType
public KeyHolderType getKeyHolderType()
-
getKeyAlgorithm
public KeyAlgorithm getKeyAlgorithm()
-
-