Package org.netxms.certificate.manager
Class CertificateManager
java.lang.Object
org.netxms.certificate.manager.CertificateManager
-
Method Summary
Modifier and TypeMethodDescriptionextractSignature(Certificate cert) getCerts()protected Certificate[]protected StringGet password for key store entry from password request listenerprotected PrivateKeygetPrivateKey(Certificate cert) Get private key from certificatebooleanvoidload()Load certificates from key storevoidsetKeyStoreRequestListener(KeyStoreRequestListener keyStoreRequestListener) voidsetPasswordRequestListener(KeyStoreEntryPasswordRequestListener passwordRequestListener) Set password request listenerbyte[]sign(Certificate cert, byte[] challenge) booleanverify(Certificate cert, byte[] original, byte[] signed)
-
Method Details
-
setPasswordRequestListener
public void setPasswordRequestListener(KeyStoreEntryPasswordRequestListener passwordRequestListener) Set password request listener- Parameters:
passwordRequestListener- new password request listener
-
setKeyStoreRequestListener
-
getCerts
-
hasNoCertificates
public boolean hasNoCertificates() -
sign
- Throws:
SignatureImpossibleException
-
extractSignature
- Throws:
SignatureImpossibleException
-
verify
public boolean verify(Certificate cert, byte[] original, byte[] signed) throws SignatureVerificationImpossibleException -
getPrivateKey
protected PrivateKey getPrivateKey(Certificate cert) throws KeyStoreException, CertificateNotInKeyStoreException, CertificateHasNoPrivateKeyException, NoSuchAlgorithmException, UnrecoverableEntryException Get private key from certificate- Parameters:
cert- certificate- Returns:
- private key for given certificate
- Throws:
KeyStoreException- on key store errorCertificateNotInKeyStoreException- when certificate not in key storeCertificateHasNoPrivateKeyException- when certificate has no private keyNoSuchAlgorithmException- when a particular cryptographic algorithm is requested but is not available in the environment.UnrecoverableEntryException- if an entry in the keystore cannot be recovered
-
getEntryPassword
Get password for key store entry from password request listener- Returns:
- password
-
load
Load certificates from key store- Throws:
KeyStoreLoaderException- on loader error
-
getCertsFromKeyStore
protected Certificate[] getCertsFromKeyStore() throws KeyStoreException, UnrecoverableEntryException, NoSuchAlgorithmException
-