Search in sources :

Example 1 with DAddExtensions

use of org.kse.gui.dialogs.extensions.DAddExtensions in project keystore-explorer by kaikramer.

the class DGenerateKeyPairCert method addExtensionsPressed.

private void addExtensionsPressed() {
    PublicKey subjectPublicKey = keyPair.getPublic();
    PublicKey caPublicKey = null;
    X500Name caIssuerName = null;
    BigInteger caSerialNumber = null;
    if (issuerCert != null) {
        caIssuerName = X500NameUtils.x500PrincipalToX500Name(issuerCert.getIssuerX500Principal());
        caPublicKey = issuerCert.getPublicKey();
        caSerialNumber = issuerCert.getSerialNumber();
    } else {
        // May be null
        caIssuerName = jdnName.getDistinguishedName();
        caPublicKey = keyPair.getPublic();
        String serialNumberStr = jtfSerialNumber.getText().trim();
        if (serialNumberStr.length() != 0) {
            try {
                caSerialNumber = new BigInteger(serialNumberStr);
            } catch (NumberFormatException ex) {
            // Don't set serial number
            }
        }
    }
    DAddExtensions dAddExtensions = new DAddExtensions(this, extensions, caPublicKey, caIssuerName, caSerialNumber, subjectPublicKey);
    dAddExtensions.setLocationRelativeTo(this);
    dAddExtensions.setVisible(true);
    if (dAddExtensions.getExtensions() != null) {
        extensions = dAddExtensions.getExtensions();
    }
}
Also used : DAddExtensions(org.kse.gui.dialogs.extensions.DAddExtensions) PublicKey(java.security.PublicKey) BigInteger(java.math.BigInteger) X500Name(org.bouncycastle.asn1.x500.X500Name)

Example 2 with DAddExtensions

use of org.kse.gui.dialogs.extensions.DAddExtensions in project keystore-explorer by kaikramer.

the class DSignCsr method addExtensionsPressed.

private void addExtensionsPressed() {
    DAddExtensions dAddExtensions = new DAddExtensions(this, extensions, verificationCertificate.getPublicKey(), X500NameUtils.x500PrincipalToX500Name(verificationCertificate.getSubjectX500Principal()), verificationCertificate.getSerialNumber(), csrPublicKey);
    dAddExtensions.setLocationRelativeTo(this);
    dAddExtensions.setVisible(true);
    if (dAddExtensions.getExtensions() != null) {
        // Dialog not cancelled
        extensions = dAddExtensions.getExtensions();
    }
}
Also used : DAddExtensions(org.kse.gui.dialogs.extensions.DAddExtensions)

Aggregations

DAddExtensions (org.kse.gui.dialogs.extensions.DAddExtensions)2 BigInteger (java.math.BigInteger)1 PublicKey (java.security.PublicKey)1 X500Name (org.bouncycastle.asn1.x500.X500Name)1