Code example for X509Certificate

Methods: getIssuerDN

0
	 *  
	 * @param cert 
	 * @return 
	 */ 
	public static String getCNOfSubject(X509Certificate cert) {
		String distinguishedName = cert.getIssuerDN().getName();
 
		if (distinguishedName.contains("CN=")) {
			int beginIndex = distinguishedName.indexOf("CN=");
			int endIndex = distinguishedName.indexOf(",", beginIndex);
			return distinguishedName.substring(beginIndex + 3, endIndex).trim();
		} 
		return null; 
	} 
 
	/** 
	 * Retrieves the DN Of Issuer 
	 *  
	 * @param inString 
	 * @return 
	 */