src/main/java/com/appslandia/common/crypto/PKIUtils.java
public static String toPemEncoded(byte[] der, String label) {
		StringWriter pem = new StringWriter();
		PrintWriter pw = new PrintWriter(pem);
		pw.append("-----BEGIN ").append(label).println("-----");
		pw.write(new String(Base64Delegate.getDefault().mimeEncode(der), CharsetUtils.US_ASCII));
		pw.println();
		pw.append("-----END ").append(label).println("-----");
		pw.close();
		return pem.toString();
	}
public static String toPemEncoded(byte[] der, String label) {
		StringWriter pem = new StringWriter();
		PrintWriter pw = new PrintWriter(pem);
		pw.append("-----BEGIN ").append(label).println("-----");
		pw.write(new String(Base64Delegate.getDefault().mimeEncode(der), CharsetUtils.US_ASCII));
		pw.println();
		pw.append("-----END ").append(label).println("-----");
		pw.close();
		return pem.toString();
	}
PEM: Privacy-enhanced Electronic Mail