Package org.eclipse.hono.config
Class SignatureSupportingConfigProperties
- java.lang.Object
-
- org.eclipse.hono.config.SignatureSupportingConfigProperties
-
public class SignatureSupportingConfigProperties extends Object
Common properties required for creating/validating cryptographic signatures.
-
-
Constructor Summary
Constructors Constructor Description SignatureSupportingConfigProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCertPath()
Gets the path to the X.509 certificate containing the public key to be used for validating RSA based signatures.String
getKeyPath()
Gets the path to the file containing the private key to be used for validating RSA based signatures.String
getSharedSecret()
Gets the secret used for creating and validating HmacSHA256 based signatures.long
getTokenExpiration()
Gets the period of time after which tokens created using this configuration should expire.boolean
isAppropriateForCreating()
Checks if this configuration contains enough information for creating assertions.boolean
isAppropriateForValidating()
Checks if this configuration contains enough information for validating assertions.void
setCertPath(String certPath)
Sets the path to the X.509 certificate containing the public key to be used for validating SHA256withRSA based signatures.void
setKeyPath(String keyPath)
Sets the path to the file containing the private key to be used for creating SHA256withRSA based signatures.void
setSharedSecret(String secret)
Sets the secret to use for creating and validating HmacSHA256 based signatures.void
setTokenExpiration(long seconds)
Sets the period of time after which tokens created using this configuration should expire.
-
-
-
Method Detail
-
getSharedSecret
public final String getSharedSecret()
Gets the secret used for creating and validating HmacSHA256 based signatures.- Returns:
- The secret or
null
if not set.
-
setSharedSecret
public final void setSharedSecret(String secret)
Sets the secret to use for creating and validating HmacSHA256 based signatures.- Parameters:
secret
- The shared secret.- Throws:
NullPointerException
- if secret isnull
.IllegalArgumentException
- if the secret is < 32 bytes.
-
setKeyPath
public final void setKeyPath(String keyPath)
Sets the path to the file containing the private key to be used for creating SHA256withRSA based signatures.The file must be in PKCS8 PEM format.
- Parameters:
keyPath
- The path to the PEM file.- Throws:
NullPointerException
- if the path isnull
.
-
getKeyPath
public final String getKeyPath()
Gets the path to the file containing the private key to be used for validating RSA based signatures.- Returns:
- The path to the file or
null
if not set.
-
getTokenExpiration
public final long getTokenExpiration()
Gets the period of time after which tokens created using this configuration should expire.- Returns:
- The number of seconds after which tokens expire.
-
setTokenExpiration
public final void setTokenExpiration(long seconds)
Sets the period of time after which tokens created using this configuration should expire.The default value is 600 seconds (10 minutes).
- Parameters:
seconds
- The number of seconds after which tokens expire.- Throws:
IllegalArgumentException
- if seconds is <= 0.
-
setCertPath
public final void setCertPath(String certPath)
Sets the path to the X.509 certificate containing the public key to be used for validating SHA256withRSA based signatures.The file must be in PKCS8 PEM format.
- Parameters:
certPath
- The path to the PEM file.- Throws:
NullPointerException
- if the path isnull
.
-
getCertPath
public final String getCertPath()
Gets the path to the X.509 certificate containing the public key to be used for validating RSA based signatures.- Returns:
- The path to the file or
null
if not set.
-
isAppropriateForCreating
public final boolean isAppropriateForCreating()
Checks if this configuration contains enough information for creating assertions.- Returns:
true
if any of sharedSecret or keyPath is notnull
.
-
isAppropriateForValidating
public final boolean isAppropriateForValidating()
Checks if this configuration contains enough information for validating assertions.- Returns:
true
if any of sharedSecret or certificatePath is notnull
.
-
-