Package org.xipki.scep.client
Class Client
- java.lang.Object
-
- org.xipki.scep.client.Client
-
- Direct Known Subclasses:
ScepClient
public abstract class Client extends Object
SCEP client.- Author:
- Lijun Liao (xipki)
-
-
Field Summary
Fields Modifier and Type Field Description protected org.xipki.scep.message.CaCapscaCapsprotected CaIdentifiercaIdstatic longDEFAULT_SIGNINGTIME_BIASstatic StringREQ_CONTENT_TYPE
-
Constructor Summary
Constructors Constructor Description Client(CaIdentifier caId, CaCertValidator caCertValidator)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddestroy()org.xipki.scep.message.AuthorityCertStoregetAuthorityCertStore()org.xipki.scep.message.CaCapsgetCaCaps()org.xipki.security.X509CertgetCaCert()CaCertValidatorgetCaCertValidator()CaIdentifiergetCaId()longgetMaxSigningTimeBiasInMs()protected abstract ScepHttpResponsehttpGet(String url)Send request via HTTP GET.protected abstract ScepHttpResponsehttpPost(String url, String requestContentType, byte[] request)Send request via HTTP POST.voidinit()booleanisHttpGetOnly()voidrefresh()EnrolmentResponsescepCertPoll(PrivateKey identityKey, org.xipki.security.X509Cert identityCert, org.bouncycastle.asn1.pkcs.CertificationRequest csr, org.bouncycastle.asn1.x500.X500Name issuer)EnrolmentResponsescepCertPoll(PrivateKey identityKey, org.xipki.security.X509Cert identityCert, org.xipki.scep.transaction.TransactionId transactionId, org.bouncycastle.asn1.x500.X500Name issuer, org.bouncycastle.asn1.x500.X500Name subject)EnrolmentResponsescepEnrol(org.bouncycastle.asn1.pkcs.CertificationRequest csr, PrivateKey identityKey, org.xipki.security.X509Cert identityCert)List<org.xipki.security.X509Cert>scepGetCert(PrivateKey identityKey, org.xipki.security.X509Cert identityCert, org.bouncycastle.asn1.x500.X500Name issuer, BigInteger serialNumber)org.bouncycastle.cert.X509CRLHolderscepGetCrl(PrivateKey identityKey, org.xipki.security.X509Cert identityCert, org.bouncycastle.asn1.x500.X500Name issuer, BigInteger serialNumber)org.xipki.scep.message.AuthorityCertStorescepNextCaCert()EnrolmentResponsescepPkcsReq(org.bouncycastle.asn1.pkcs.CertificationRequest csr, PrivateKey identityKey, org.xipki.security.X509Cert identityCert)EnrolmentResponsescepRenewalReq(org.bouncycastle.asn1.pkcs.CertificationRequest csr, PrivateKey identityKey, org.xipki.security.X509Cert identityCert)voidsetHttpGetOnly(boolean httpGetOnly)voidsetMaxSigningTimeBiasInMs(long maxSigningTimeBiasInMs)Set the maximal signing time bias in milliseconds.
-
-
-
Field Detail
-
REQ_CONTENT_TYPE
public static final String REQ_CONTENT_TYPE
- See Also:
- Constant Field Values
-
DEFAULT_SIGNINGTIME_BIAS
public static final long DEFAULT_SIGNINGTIME_BIAS
- See Also:
- Constant Field Values
-
caId
protected final CaIdentifier caId
-
caCaps
protected org.xipki.scep.message.CaCaps caCaps
-
-
Constructor Detail
-
Client
public Client(CaIdentifier caId, CaCertValidator caCertValidator)
-
-
Method Detail
-
httpPost
protected abstract ScepHttpResponse httpPost(String url, String requestContentType, byte[] request) throws ScepClientException
Send request via HTTP POST.- Parameters:
url- SCEP server URL. Must not benull.requestContentType- Content type of the HTTP request. Must not benull.request- HTTP request. Must not benull.- Returns:
- the SCEP response
- Throws:
ScepClientException- If error happens
-
httpGet
protected abstract ScepHttpResponse httpGet(String url) throws ScepClientException
Send request via HTTP GET.- Parameters:
url- URL. Must not benull.- Returns:
- the response.
- Throws:
ScepClientException- If error occurs.
-
isHttpGetOnly
public boolean isHttpGetOnly()
-
setHttpGetOnly
public void setHttpGetOnly(boolean httpGetOnly)
-
getMaxSigningTimeBiasInMs
public long getMaxSigningTimeBiasInMs()
-
setMaxSigningTimeBiasInMs
public void setMaxSigningTimeBiasInMs(long maxSigningTimeBiasInMs)
Set the maximal signing time bias in milliseconds.- Parameters:
maxSigningTimeBiasInMs- zero or negative value deactivates the message time check
-
init
public void init() throws ScepClientException- Throws:
ScepClientException
-
refresh
public void refresh() throws ScepClientException- Throws:
ScepClientException
-
getCaCaps
public org.xipki.scep.message.CaCaps getCaCaps() throws ScepClientException- Throws:
ScepClientException
-
getCaCert
public org.xipki.security.X509Cert getCaCert()
-
getCaId
public CaIdentifier getCaId() throws ScepClientException
- Throws:
ScepClientException
-
getCaCertValidator
public CaCertValidator getCaCertValidator() throws ScepClientException
- Throws:
ScepClientException
-
getAuthorityCertStore
public org.xipki.scep.message.AuthorityCertStore getAuthorityCertStore() throws ScepClientException- Throws:
ScepClientException
-
scepGetCrl
public org.bouncycastle.cert.X509CRLHolder scepGetCrl(PrivateKey identityKey, org.xipki.security.X509Cert identityCert, org.bouncycastle.asn1.x500.X500Name issuer, BigInteger serialNumber) throws ScepClientException
- Throws:
ScepClientException
-
scepGetCert
public List<org.xipki.security.X509Cert> scepGetCert(PrivateKey identityKey, org.xipki.security.X509Cert identityCert, org.bouncycastle.asn1.x500.X500Name issuer, BigInteger serialNumber) throws ScepClientException
- Throws:
ScepClientException
-
scepCertPoll
public EnrolmentResponse scepCertPoll(PrivateKey identityKey, org.xipki.security.X509Cert identityCert, org.bouncycastle.asn1.pkcs.CertificationRequest csr, org.bouncycastle.asn1.x500.X500Name issuer) throws ScepClientException
- Throws:
ScepClientException
-
scepCertPoll
public EnrolmentResponse scepCertPoll(PrivateKey identityKey, org.xipki.security.X509Cert identityCert, org.xipki.scep.transaction.TransactionId transactionId, org.bouncycastle.asn1.x500.X500Name issuer, org.bouncycastle.asn1.x500.X500Name subject) throws ScepClientException
- Throws:
ScepClientException
-
scepEnrol
public EnrolmentResponse scepEnrol(org.bouncycastle.asn1.pkcs.CertificationRequest csr, PrivateKey identityKey, org.xipki.security.X509Cert identityCert) throws ScepClientException
- Throws:
ScepClientException
-
scepPkcsReq
public EnrolmentResponse scepPkcsReq(org.bouncycastle.asn1.pkcs.CertificationRequest csr, PrivateKey identityKey, org.xipki.security.X509Cert identityCert) throws ScepClientException
- Throws:
ScepClientException
-
scepRenewalReq
public EnrolmentResponse scepRenewalReq(org.bouncycastle.asn1.pkcs.CertificationRequest csr, PrivateKey identityKey, org.xipki.security.X509Cert identityCert) throws ScepClientException
- Throws:
ScepClientException
-
scepNextCaCert
public org.xipki.scep.message.AuthorityCertStore scepNextCaCert() throws ScepClientException- Throws:
ScepClientException
-
destroy
public void destroy()
-
-