Code example for X509Certificate

Methods: getIssuerX500Principal

0
	/** 
	 * {@inheritDoc} 
	 */ 
    public void add(X509Certificate cert)
    { 
		String newAlias = cert.getIssuerX500Principal().getName() + ":" + cert.getIssuerX500Principal().getName();   									
 
		add(cert, newAlias);
    } 
     
	/** 
	 * {@inheritDoc} 
	 */     
    public void remove(X509Certificate cert)
    { 
    	if (certs.remove(cert))
    	{ 
    		// remove from the key store 
    		try 
    		{ 
    			String alias = ks.getCertificateAlias(cert);
    			if (alias != null)
    			{ 
    				ks.deleteEntry(alias);
    				// persist 
    				FileOutputStream outStream = new FileOutputStream(keyStoreFile);
    				ks.store(outStream, keyStorePassword == null ? null : keyStorePassword.toCharArray());	
    				 
    				outStream.close();
    			} 
    		} 
    		catch (Exception e)
    		{ 
    			throw new NHINDException(e);
    		} 
    	} 
    } 
 
	/** 
	 * {@inheritDoc} 
	 */ 
    public Collection<X509Certificate> getAllCertificates()
    { 
    	// internal operations may iterate the returned collection for modifiable operations, so create a copy of the list 
    	// instead of an unmodifiable collection backed by the set 
    	return new ArrayList<X509Certificate>(certs);
    } 
     
    /** 
     * Adds a certificate into the keystore with a given alias name. 
     * @param cert The certificate to add to the keystore. 
     * @param alias The alias of the certificate. 
     */ 
    public void add(X509Certificate cert, String alias)
    { 
    	if (certs.contains(cert))
    		throw new IllegalArgumentException("Cert already contained in store.  Use update() to update a certificate");
    	 
    	certs.add(cert);
    	 
		try 
		{ 
			 
			if (cert instanceof X509CertificateEx)