@Override public TBSCertificate build() { return this.tbsGen.generateTBSCertificate(); } }
/** * Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the * certificate. */ public void setIssuerDN( X509Name issuer) { tbsGen.setIssuer(issuer); }
/** * Set the subject distinguished name. The subject describes the entity associated with the public key. */ public void setSubjectDN( X509Name subject) { tbsGen.setSubject(subject); }
public void setNotAfter( Date date) { tbsGen.setEndDate(new Time(date)); }
@Override public BcX509TBSCertificateBuilder setSerialNumber(BigInteger serial) { this.tbsGen.setSerialNumber(new ASN1Integer(serial)); return this; }
public void setPublicKey( PublicKey key) { try { tbsGen.setSubjectPublicKeyInfo(SubjectPublicKeyInfo.getInstance(key.getEncoded())); } catch (Exception e) { throw new IllegalArgumentException("unable to process key - " + e.toString()); } }
public void setNotBefore( Date date) { tbsGen.setStartDate(new Time(date)); }
@Override public BcX509TBSCertificateBuilder setSignature(Signer signer) { this.tbsGen.setSignature(BcUtils.getSignerAlgoritmIdentifier(signer)); return this; }
/** * reset the generator */ public void reset() { tbsGen = new V1TBSCertificateGenerator(); }
@Override public BcX509TBSCertificateBuilder setEndDate(Date time) { this.tbsGen.setEndDate(new Time(time)); return this; }
/** * set the serial number for the certificate. */ public void setSerialNumber( BigInteger serialNumber) { if (serialNumber.compareTo(BigInteger.ZERO) <= 0) { throw new IllegalArgumentException("serial number must be a positive integer"); } tbsGen.setSerialNumber(new ASN1Integer(serialNumber)); }
@Override public BcX509TBSCertificateBuilder setSubjectPublicKeyInfo(PublicKeyParameters subject) { this.tbsGen.setSubjectPublicKeyInfo(BcUtils.getSubjectPublicKeyInfo(subject)); return this; }
@Override public BcX509TBSCertificateBuilder setStartDate(Date time) { this.tbsGen.setStartDate(new Time(time)); return this; }
/** * Set the signature algorithm. This can be either a name or an OID, names * are treated as case insensitive. * * @param signatureAlgorithm string representation of the algorithm name. */ public void setSignatureAlgorithm( String signatureAlgorithm) { this.signatureAlgorithm = signatureAlgorithm; try { sigOID = X509Util.getAlgorithmOID(signatureAlgorithm); } catch (Exception e) { throw new IllegalArgumentException("Unknown signature type requested"); } sigAlgId = X509Util.getSigAlgID(sigOID, signatureAlgorithm); tbsGen.setSignature(sigAlgId); }
public X509V1CertificateGenerator() { tbsGen = new V1TBSCertificateGenerator(); }
@Override public BcX509TBSCertificateBuilder setIssuer(PrincipalIndentifier issuer) { this.tbsGen.setIssuer(BcUtils.getX500Name(issuer)); return this; }
@Override public BcX509TBSCertificateBuilder setSubject(PrincipalIndentifier subject) { this.tbsGen.setSubject(BcUtils.getX500Name(subject)); return this; }
/** * generate an X509 certificate, based on the current issuer and subject, * using the passed in provider for the signing, and the passed in source * of randomness (if required). */ public X509Certificate generate( PrivateKey key, String provider, SecureRandom random) throws CertificateEncodingException, IllegalStateException, NoSuchProviderException, NoSuchAlgorithmException, SignatureException, InvalidKeyException { TBSCertificate tbsCert = tbsGen.generateTBSCertificate(); byte[] signature; try { signature = X509Util.calculateSignature(sigOID, signatureAlgorithm, provider, key, random, tbsCert); } catch (IOException e) { throw new ExtCertificateEncodingException("exception encoding TBS cert", e); } return generateJcaObject(tbsCert, signature); }
/** * Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the * certificate. */ public void setIssuerDN( X500Principal issuer) { try { tbsGen.setIssuer(new X509Principal(issuer.getEncoded())); } catch (IOException e) { throw new IllegalArgumentException("can't process principal: " + e); } }
/** * Set the subject distinguished name. The subject describes the entity associated with the public key. */ public void setSubjectDN( X500Principal subject) { try { tbsGen.setSubject(new X509Principal(subject.getEncoded())); } catch (IOException e) { throw new IllegalArgumentException("can't process principal: " + e); } }