code: public static String getFirstValueOf(final X509Certificate certificate,
  		final ASN1ObjectIdentifier style) throws CertificateEncodingException
  	{
  		final X500Name x500name = new JcaX509CertificateHolder(certificate).getSubject();
  		final RDN[] rdns = x500name.getRDNs(style);
  		if (rdns != null && 0 < rdns.length)
  		{
  			final RDN rdn = rdns[0];
  			final String firstValue = IETFUtils.valueToString(rdn.getFirst().getValue());
  			return firstValue;
  		}
  		return "";
  	}
docs: Gets the first value of the given {@link X509Certificate} and the given
  {@link ASN1ObjectIdentifier}.
  
  @param certificate
  the certificate
  @param style
  the style
  @return the first value of the given {@link X509Certificate} and the given
  {@link ASN1ObjectIdentifier} or an empty String if the {@link ASN1ObjectIdentifier}
  does not exists.
  @throws CertificateEncodingException
  is thrown if an encoding error occurs.