java.security.cert.X509Extension Java Examples

The following examples show how to use java.security.cert.X509Extension. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: X509CertificateGenerator.java    From keystore-explorer with GNU General Public License v3.0 5 votes vote down vote up
private ASN1Encodable getExtensionValue(X509Extension extensions, String oid) throws CryptoException {
	byte[] octets = ASN1OctetString.getInstance(extensions.getExtensionValue(oid)).getOctets();
	try (ASN1InputStream ais = new ASN1InputStream(octets)) {
		return ais.readObject();
	} catch (IOException ex) {
		throw new CryptoException(res.getString("CertificateGenFailed.exception.message"), ex);
	}
}
 
Example #2
Source File: X509CertificateGenerator.java    From keystore-explorer with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
		}
	}
}
 
Example #3
Source File: DAddExtensionType.java    From keystore-explorer with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 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();
}
 
Example #4
Source File: DViewExtensions.java    From portecle with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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();
}
 
Example #5
Source File: TSRequest.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #6
Source File: TSRequest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #7
Source File: TSRequest.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #8
Source File: DViewExtensions.java    From keystore-explorer with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #9
Source File: DViewExtensions.java    From keystore-explorer with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 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();
}
 
Example #10
Source File: X509CertificateGenerator.java    From keystore-explorer with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #11
Source File: TSRequest.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #12
Source File: TSRequest.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #13
Source File: TSRequest.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #14
Source File: TSRequest.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #15
Source File: TSRequest.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #16
Source File: TSRequest.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #17
Source File: TSRequest.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #18
Source File: TSRequest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #19
Source File: TSRequest.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #20
Source File: TSRequest.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}
 
Example #21
Source File: TSRequest.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the Time-Stamp Protocol extensions.
 *
 * @param extensions The protocol extensions.
 */
public void setExtensions(X509Extension[] extensions) {
    this.extensions = extensions;
}