|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.emfstore.internal.client.model.connectionmanager.KeyStoreManager
public final class KeyStoreManager
The KeyStoreManager manages the client's KeyStore in which the SSL certificates for multiple EMFStore servers can be stored.
Field Summary | |
---|---|
static String |
DEFAULT_CERTIFICATE
Certificate Alias for development test certificate. |
static String |
KEYSTORENAME
Name of keyStore file. |
Method Summary | |
---|---|
void |
addCertificate(String alias,
InputStream certificate)
Adds a certificate to the KeyStore. |
void |
addCertificate(String alias,
String path)
Adds a certificate to the KeyStore. |
boolean |
certificateExists(String alias)
Checks whether a certificate for a given alias exists. |
boolean |
contains(String alias)
Returns true if the given alias maps to an existing certificate. |
void |
deleteCertificate(String alias)
Deletes a certificate in the keystore. |
String |
encrypt(String password,
ServerInfo server)
Encrypts a password. |
Certificate |
getCertificate(String alias)
Returns the certificate mapped by the given alias. |
ArrayList<String> |
getCertificates()
Lists all certificates in the client's KeyStore. |
String |
getDefaultCertificate()
Returns the default certificate alias. |
static KeyStoreManager |
getInstance()
Returns an instance of the KeyStoreManager . |
String |
getPathToKeyStore()
Returns the path to the KeyStore. |
SSLContext |
getSSLContext()
Returns a SSL Context. |
boolean |
isDefaultCertificate(String alias)
Test whether a given alias is the default certificate alias. |
boolean |
keyStoreExists()
True if a KeyStore file exists. |
void |
reloadKeyStore()
Reloads the keystore. |
void |
removeCertificate(String alias)
Remove certificate with the given alias. |
void |
setDefaultCertificate(String defaultCertificate)
Sets the alias for the default certificate. |
void |
setupKeys()
This method sets the JVM properties in order to use SSL encryption. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String KEYSTORENAME
public static final String DEFAULT_CERTIFICATE
Method Detail |
---|
public static KeyStoreManager getInstance()
KeyStoreManager
.
KeyStoreManager
public void setupKeys()
public ArrayList<String> getCertificates() throws ESCertificateException
ESCertificateException
- is thrown when problems occur with the CertificateStore, i.e.
illegal operations.public void deleteCertificate(String alias) throws ESCertificateException
alias
- alias of certificate
ESCertificateException
- is thrown when problems occur with the CertificateStore, i.e.
illegal operations.public void addCertificate(String alias, String path) throws ESCertificateException
addCertificate
in interface ESKeyStoreManager
alias
- alias for the certificatepath
- path to the certificate file
ESCertificateException
- if problems occur with storing, accessing or identifying the certificateESKeyStoreManager.addCertificate(java.lang.String,
java.lang.String)
public void removeCertificate(String alias) throws ESCertificateException
alias
- the certificate alias
ESCertificateException
- if removal failspublic void addCertificate(String alias, InputStream certificate) throws ESCertificateException
addCertificate
in interface ESKeyStoreManager
alias
- alias for the certificatecertificate
- InputStream
delivering the certificate. Stream is used by
CertificateFactory.generateCertificate(InputStream)
.
ESCertificateException
- if problems occur with storing, accessing or identifying the certificateESKeyStoreManager.addCertificate(java.lang.String,
java.io.InputStream)
public void reloadKeyStore() throws ESCertificateException
ESCertificateException
- in case of failurepublic SSLContext getSSLContext() throws ESCertificateException
ESCertificateException
- in case of failure retrieving the contextpublic boolean keyStoreExists()
public String getPathToKeyStore()
public String encrypt(String password, ServerInfo server)
password
- the password to be encryptedserver
- the server from which to fetch the public key that is used for encryption
public boolean isDefaultCertificate(String alias)
alias
- alias under test
public String getDefaultCertificate()
getDefaultCertificate
in interface ESKeyStoreManager
ESKeyStoreManager.getDefaultCertificate()
public boolean contains(String alias) throws ESCertificateException
alias
- Certificate alias
ESCertificateException
- is thrown when problems occur with the CertificateStore, i.e.
illegal operations.public void setDefaultCertificate(String defaultCertificate)
setDefaultCertificate
in interface ESKeyStoreManager
defaultCertificate
- certificate alias, use null to unset the currently set default certificateESKeyStoreManager.setDefaultCertificate(java.lang.String)
public Certificate getCertificate(String alias) throws ESCertificateException
alias
- String
ESCertificateException
- is thrown when problems occur with the CertificateStore, i.e.
illegal operations.public boolean certificateExists(String alias) throws ESCertificateException
certificateExists
in interface ESKeyStoreManager
alias
- the alias which needs to be check
true
if a certificate with the given alias exists, false
otherwise
ESCertificateException
- in case of failureESKeyStoreManager.certificateExists(java.lang.String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |