private ASN1Encodable getExtensionValue(X509Extension extensions, String oid) throws CryptoException { try (ASN1InputStream ais = new ASN1InputStream(extensions.getExtensionValue(oid))) { return ais.readObject(); } catch (IOException ex) { throw new CryptoException(res.getString("CertificateGenFailed.exception.message"), ex); } }
/** * Generate a certificate. * * @param subject * Certificate subject * @param issuer * Certificate issuer * @param validityStart * Validity start date of certificate in msecs * @param validityEnd * Validity end date of certificate in msecs * @param publicKey * Public part of key pair * @param privateKey * Private part of key pair * @param signatureType * Signature Type * @param serialNumber * Serial number * @param extensions * Extensions, ignored by version 1 generators * @return The generated certificate * @throws CryptoException * If there was a problem generating the certificate */ public X509Certificate generate(X500Name subject, X500Name issuer, Date validityStart, Date validityEnd, PublicKey publicKey, PrivateKey privateKey, SignatureType signatureType, BigInteger serialNumber, X509Extension extensions, Provider provider) throws CryptoException { if (version == X509CertificateVersion.VERSION1) { // TODO return generateVersion1(subject, issuer, validityStart, validityEnd, publicKey, privateKey, signatureType, serialNumber); } else { try { return generateVersion3(subject, issuer, validityStart, validityEnd, publicKey, privateKey, signatureType, serialNumber, extensions, provider); } catch (CertIOException e) { throw new CryptoException(e); } } }
/** * Creates new DViewExtensions dialog. * * @param parent Parent window * @param sTitle The dialog title * @param modal Is dialog modal? * @param extensions Extensions to display */ public DViewExtensions(Window parent, String sTitle, boolean modal, X509Extension extensions) { super(parent, sTitle, modal); m_extensions = extensions; initComponents(); }
/** * Creates new DAddExtensionType dialog. * * @param parent * Parent dialog * @param extensions * Current set of extensions */ public DAddExtensionType(JDialog parent, X509Extension extensions) { super(parent, Dialog.ModalityType.DOCUMENT_MODAL); setTitle(res.getString("DAddExtensionType.Title")); this.extensions = extensions; initComponents(); }
/** * Sets the Time-Stamp Protocol extensions. * * @param extensions The protocol extensions. */ public void setExtensions(X509Extension[] extensions) { this.extensions = extensions; }
/** * Generate a self-signed certificate. * * @param name * Certificate subject and issuer * @param validityStart * Validity start date of certificate in msecs * @param validityEnd * Validity end date of certificate in msecs * @param publicKey * Public part of key pair * @param privateKey * Private part of key pair * @param signatureType * Signature Type * @param serialNumber * Serial number * @param extensions * Extensions, ignored by version 1 generators * @return The generated certificate * @throws CryptoException * If there was a problem generating the certificate */ public X509Certificate generateSelfSigned(X500Name name, Date validityStart, Date validityEnd, PublicKey publicKey, PrivateKey privateKey, SignatureType signatureType, BigInteger serialNumber, X509Extension extensions, Provider provider) throws CryptoException { return generate(name, name, validityStart, validityEnd, publicKey, privateKey, signatureType, serialNumber, extensions, provider); }
/** * Creates a new DViewExtensions dialog. * * @param parent * Parent frame * @param title * The dialog title * @param extensions * Extensions to display */ public DViewExtensions(JFrame parent, String title, X509Extension extensions) { super(parent, title, Dialog.ModalityType.DOCUMENT_MODAL); this.extensions = extensions; initComponents(); }
/** * Creates new DViewExtensions dialog. * * @param parent * Parent dialog * @param title * The dialog title * @param extensions * Extensions to display */ public DViewExtensions(JDialog parent, String title, X509Extension extensions) { super(parent, title, Dialog.ModalityType.DOCUMENT_MODAL); this.extensions = extensions; initComponents(); }