public class DefaultCertificate extends Object implements Certificate
DAY, HOUR, SECOND, YEAR
Constructor and Description |
---|
DefaultCertificate(BouncyKeygenService service) |
Modifier and Type | Method and Description |
---|---|
void |
addDurationInDays(String days)
set duration of cert in days.
|
void |
addDurationInHours(String hours)
set the duration of the certificate in hours
Useful for short durations ( for public kiosks for example )
If days is set then this will be added to the days.
|
void |
addSubjectAlternativeName(String urlStr)
Set the WebID for the certificate.
|
void |
generate()
see: http://www.bouncycastle.org/wiki/display/JA1/X.509+Public+Key+Certificate+and+Certification+Request+Generation
|
X509Certificate |
getCertificate() |
Date |
getEndDate() |
CertSerialisation |
getSerialisation()
get the encoded version of this certificate in a binary form
|
Date |
getStartDate() |
PubKey |
getSubjectPublicKey() |
void |
setDefaultSerialisation(CertSerialisation ser)
When we create a certificate we already know the serialisation it is going to require.
|
void |
setEndDate(Date endDate)
set the end date of validity of the certificate.
|
void |
setStartDate(Date startDate) |
void |
setSubjectCommonName(String name) |
void |
setSubjectPublicKey(PubKey pubkey)
Set the Spkac data sent by browser
One should set either this or the pemCSR.
|
void |
startEarlier(String hours)
in order to avoid synchronization problems it is good to set the
start date to be somewhat earlier than the current time.
|
public DefaultCertificate(BouncyKeygenService service)
public X509Certificate getCertificate()
getCertificate
in interface Certificate
public void addSubjectAlternativeName(String urlStr)
Certificate
addSubjectAlternativeName
in interface Certificate
public void setSubjectCommonName(String name)
setSubjectCommonName
in interface Certificate
name
- he user should set a himself a name that will be easily recognised in the browser.
Eg: "Henry-public"public void setStartDate(Date startDate)
setStartDate
in interface Certificate
startDate
- Set the start date for the validity of the certificate. If unset it will be now.public void setEndDate(Date endDate)
Certificate
setEndDate
in interface Certificate
endDate
- end datepublic void addDurationInDays(String days)
Certificate
addDurationInDays
in interface Certificate
days
- the duration of the certificate in days, as a floating point numberpublic void startEarlier(String hours)
Certificate
startEarlier
in interface Certificate
hours
- a floating point numberpublic void addDurationInHours(String hours)
Certificate
addDurationInHours
in interface Certificate
hours
- as floats, encoded as strings (it is easier to get a string from velocity). Partial hours are possiblepublic PubKey getSubjectPublicKey()
getSubjectPublicKey
in interface Certificate
public void setSubjectPublicKey(PubKey pubkey)
pubkey
- the public key for the subjectpublic void setDefaultSerialisation(CertSerialisation ser)
Certificate
setDefaultSerialisation
in interface Certificate
ser
- the serialisation implementationpublic CertSerialisation getSerialisation() throws Exception
Certificate
getSerialisation
in interface Certificate
Exception
- why? //todo: is this really neededpublic void generate() throws Exception
Exception
public Date getEndDate()
getEndDate
in interface Certificate
public Date getStartDate()
getStartDate
in interface Certificate
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.