code: public static String X509CertToString( String cert )
      {
          String cert64CharPerLine = cert.replaceAll( "(.{64})", "$1\n" );
          return BEGIN_CERT + "\n" + cert64CharPerLine + "\n"+ END_CERT + "\n";
      }
docs: Convert a certificate in base 64 binary format with BEGIN and END strings
  @param cert encoded cert string
  @return