Class ProxyCertificateImpl
- java.lang.Object
-
- eu.emi.security.authn.x509.helpers.proxy.ProxyCertificateImpl
-
- All Implemented Interfaces:
ProxyCertificate
public class ProxyCertificateImpl extends java.lang.Object implements ProxyCertificate
Default implementation of theProxyCertificate
interface.- Author:
- K. Benedyczak
-
-
Constructor Summary
Constructors Constructor Description ProxyCertificateImpl(java.security.cert.X509Certificate[] chain)
ProxyCertificateImpl(java.security.cert.X509Certificate[] chain, java.security.PrivateKey privateKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.cert.X509Certificate[]
getCertificateChain()
Returns the certificate chain of the proxy.X509Credential
getCredential()
Returns the X509Credential wrapping the generated private key and proxy certificate.java.security.PrivateKey
getPrivateKey()
Returns the generated private key of this proxy.boolean
hasPrivateKey()
-
-
-
Constructor Detail
-
ProxyCertificateImpl
public ProxyCertificateImpl(java.security.cert.X509Certificate[] chain, java.security.PrivateKey privateKey) throws java.security.KeyStoreException
- Throws:
java.security.KeyStoreException
-
ProxyCertificateImpl
public ProxyCertificateImpl(java.security.cert.X509Certificate[] chain)
-
-
Method Detail
-
getCertificateChain
public java.security.cert.X509Certificate[] getCertificateChain()
Description copied from interface:ProxyCertificate
Returns the certificate chain of the proxy.- Specified by:
getCertificateChain
in interfaceProxyCertificate
- Returns:
- the Certificate chain starting with the generated proxy certificate.
-
getPrivateKey
public java.security.PrivateKey getPrivateKey() throws java.lang.IllegalStateException
Description copied from interface:ProxyCertificate
Returns the generated private key of this proxy. If public key was manually set an exception is thrown.- Specified by:
getPrivateKey
in interfaceProxyCertificate
- Returns:
- The private key.
- Throws:
java.lang.IllegalStateException
- if the private and public keys were not generated
-
getCredential
public X509Credential getCredential() throws java.lang.IllegalStateException
Description copied from interface:ProxyCertificate
Returns the X509Credential wrapping the generated private key and proxy certificate. This method is useful if KeyStore or KeyManager with the newly generated proxy certificate is needed.- Specified by:
getCredential
in interfaceProxyCertificate
- Returns:
- The generated credential wrapped in
X509Credential
- Throws:
java.lang.IllegalStateException
- if the private and public keys were not generated
-
hasPrivateKey
public boolean hasPrivateKey()
- Specified by:
hasPrivateKey
in interfaceProxyCertificate
- Returns:
- true if private key was generated and is available through
ProxyCertificate.getPrivateKey()
andProxyCertificate.getCredential()
-
-