public static byte[] convertToDER(String pemCert){
  String base64=pemCert.replace(CERT_BEGIN,"");
  base64=base64.replace(CERT_END,"");
  base64=base64.replaceAll("\\s","");
  return Base64.decodeBase64(base64);
}

public static byte [ ] convertToDER ( String pemCert ) { String base64 = pemCert . replace ( CERT_BEGIN , "" ) ; base64 = base64 . replace ( CERT_END , "" ) ; base64 = base64 . replaceAll ( "\\s" , "" ) ; return Base64 . decodeBase64 ( base64 ) ; }
this method converts a pem encoded certificate to der encoded
