public final class CertificateParameter
extends java.lang.Object
CertificateParameter cp = new CertificateParameter();
X500NameBuilder subject = new X500NameBuilder();
subject.addRDN(X509ObjectIdentifiers.countryName, "GB");
subject.addRDN(X509ObjectIdentifiers.stateOrProvinceName, "Middlesex");
subject.addRDN(X509ObjectIdentifiers.localityName, "Uxbridge");
subject.addRDN(X509ObjectIdentifiers.organization, "Adaptris");
subject.addRDN(X509ObjectIdentifiers.organizationalUnitName, "Development");
subject.addRDN(X509ObjectIdentifiers.commonName, "My Name");
subject.addRDN(PKCSObjectIdentifiers.pkcs_9_at_emailAddress, "myname@mycompany.com");
cp.setSignatureAlgorithm("Md5WithRSAencryption");
cp.setKeyAlgorithm("RSA", 2048);
cp.setSubjectInfo(subject.build());
CertificateBuilder
Constructor and Description |
---|
CertificateParameter()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getKeyAlgorithm()
Return the keyAlgorithm.
|
int |
getKeySize()
Return the key size.
|
java.lang.String |
getSignatureAlgorithm()
Return the signatureAlgorithm.
|
org.bouncycastle.asn1.x500.X500Name |
getSubjectInfo()
Return the subject.
|
void |
setKeyAlgorithm(java.lang.String keyAlg,
int bits)
Set the key algorithm for a certificate.
|
void |
setSignatureAlgorithm(java.lang.String sigAlg)
Set the signature algorithm for a certificate.
|
void |
setSubjectInfo(org.bouncycastle.asn1.x500.X500Name name)
Set the subject of the certificate.
|
public void setSignatureAlgorithm(java.lang.String sigAlg) throws java.security.NoSuchAlgorithmException
Common certificate signature algorithms are
MD5withRSAencryption, SHA1withRSAEncryption,
MD4withRSAEncryption
sigAlg
- the signature algorithm to usejava.security.NoSuchAlgorithmException
- if the algorithm is not availablepublic void setKeyAlgorithm(java.lang.String keyAlg, int bits) throws java.security.NoSuchAlgorithmException
The most common key algorithm is RSA
with a bit size
of either 1024/2048 bits
keyAlg
- the key algorithm to usebits
- the number of bits for the key algorithmjava.security.NoSuchAlgorithmException
- if the algorithm is not availablepublic java.lang.String getSignatureAlgorithm()
public java.lang.String getKeyAlgorithm()
public int getKeySize()
public void setSubjectInfo(org.bouncycastle.asn1.x500.X500Name name)
name
- the subject info for a certificateX500Name
public org.bouncycastle.asn1.x500.X500Name getSubjectInfo()