Package net.jsign
Class KeyStoreBuilder
- java.lang.Object
-
- net.jsign.KeyStoreBuilder
-
public class KeyStoreBuilder extends Object
Keystore builder.Example:
KeyStore keystore = new KeyStoreBuilder().storetype(PKCS12).keystore("keystore.p12").storepass("password").build();- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description KeyStoreBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyStorebuild()Builds the keystore.KeyStoreBuildercertfile(File certfile)Sets the file containing the certificate chain.KeyStoreBuildercertfile(String certfile)Sets the file containing the certificate chain.KeyStoreBuilderkeyfile(File keyfile)Sets the file containing the private key.KeyStoreBuilderkeyfile(String keyfile)Sets the file containing the private key.KeyStoreBuilderkeypass(String keypass)Sets the password to access the private key.KeyStoreBuilderkeystore(File keystore)Sets the file containing the keystore.KeyStoreBuilderkeystore(String keystore)Sets the name of the resource containing the keystore.Providerprovider()Returns the provider used to sign with the keystore.KeyStoreBuilderstorepass(String storepass)Sets the password to access the keystore.KeyStoreBuilderstoretype(String storetype)Sets the type of the keystore.KeyStoreBuilderstoretype(KeyStoreType storetype)Sets the type of the keystore.
-
-
-
Constructor Detail
-
KeyStoreBuilder
public KeyStoreBuilder()
-
-
Method Detail
-
keystore
public KeyStoreBuilder keystore(File keystore)
Sets the file containing the keystore.
-
keystore
public KeyStoreBuilder keystore(String keystore)
Sets the name of the resource containing the keystore. Either the path of the keystore file, the SunPKCS11 configuration file or the cloud keystore name depending on the type of keystore.
-
storepass
public KeyStoreBuilder storepass(String storepass)
Sets the password to access the keystore. The password can be loaded from a file by using thefile:prefix followed by the path of the file, or from an environment variable by using theenv:prefix followed by the name of the variable.
-
storetype
public KeyStoreBuilder storetype(KeyStoreType storetype)
Sets the type of the keystore.
-
storetype
public KeyStoreBuilder storetype(String storetype)
Sets the type of the keystore.- Parameters:
storetype- the type of the keystore- Throws:
IllegalArgumentException- if the type is not recognized
-
keypass
public KeyStoreBuilder keypass(String keypass)
Sets the password to access the private key. The password can be loaded from a file by using thefile:prefix followed by the path of the file, or from an environment variable by using theenv:prefix followed by the name of the variable.
-
keyfile
public KeyStoreBuilder keyfile(String keyfile)
Sets the file containing the private key.
-
keyfile
public KeyStoreBuilder keyfile(File keyfile)
Sets the file containing the private key.
-
certfile
public KeyStoreBuilder certfile(String certfile)
Sets the file containing the certificate chain. The certificate used for signing must be the first one.
-
certfile
public KeyStoreBuilder certfile(File certfile)
Sets the file containing the certificate chain. The certificate used for signing must be the first one.
-
build
public KeyStore build() throws KeyStoreException
Builds the keystore.- Throws:
IllegalArgumentException- if the parameters are invalidKeyStoreException- if the keystore can't be loaded
-
-