Source:
public boolean appendSignature(final String signStr, final String certStr, String messageDigestAlgo, String provider, final OutputStream dataStream, final String blockComStart, final String blockComEnd) throws ScriptSignatureException { if (signStr == null || "".equals(signStr) || certStr == null || "".equals(certStr) || dataStream == null || blockComStart == null || blockComEnd == null) throw new ScriptSignatureException("One or more parameters are null or empty"); if (messageDigestAlgo == null || "".equals(messageDigestAlgo) || "default".equalsIgnoreCase(messageDigestAlgo)) messageDigestAlgo = "SHA1"; if (provider == null || "".equals(provider)) provider = "preferred"; final String begin = blockComStart + "\n" + beginString, end = endString + "\n" + blockComEnd, signatureParam = "Hash:" + messageDigestAlgo + " Provider:" + provider; BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(dataStream); try { bufferedOutputStream.write(begin.getBytes()); bufferedOutputStream.write("\n".getBytes()); bufferedOutputStream.write(signatureParam.getBytes()); bufferedOutputStream.write("\n\n".getBytes()); bufferedOutputStream.write(signStr.getBytes()); bufferedOutputStream.write("\n\n".getBytes()); int i = 0; for (String s : certStr.split("")) { bufferedOutputStream.write(s.getBytes()); i++; if (i % 48 == 0) bufferedOutputStream.write("\n".getBytes()); } if (i % 48 != 0) bufferedOutputStream.write("\n".getBytes()); bufferedOutputStream.write("\n".getBytes()); bufferedOutputStream.write(end.getBytes()); bufferedOutputStream.write("\n".getBytes()); return true; } catch (IOException e) { Logger.error(Activator.PLUGIN_ID, Arrays.toString(e.getStackTrace()), e); } finally { try { if (bufferedOutputStream != null) bufferedOutputStream.close(); } catch (IOException e) { Logger.error(Activator.PLUGIN_ID, Arrays.toString(e.getStackTrace()), e); } } return false; }

Target:
public static boolean appendSignature(final String signStr, final String certStr, String messageDigestAlgo, String provider, final OutputStream dataStream, final String blockComStart, final String blockComEnd) throws ScriptSignatureException { if (signStr == null || signStr.isEmpty() || certStr == null || certStr.isEmpty() || dataStream == null || blockComStart == null || blockComEnd == null) throw new ScriptSignatureException("One or more parameters are null or empty"); if (messageDigestAlgo == null || messageDigestAlgo.isEmpty() || "default".equalsIgnoreCase(messageDigestAlgo)) messageDigestAlgo = "SHA1"; if (provider == null || provider.isEmpty()) provider = "preferred"; final String begin = blockComStart + "\n" + BEGIN_STRING, end = END_STRING + "\n" + blockComEnd, signatureParam = "Hash:" + messageDigestAlgo + " Provider:" + provider; BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(dataStream); try { bufferedOutputStream.write(begin.getBytes()); bufferedOutputStream.write("\n".getBytes()); bufferedOutputStream.write(signatureParam.getBytes()); bufferedOutputStream.write("\n\n".getBytes()); bufferedOutputStream.write(signStr.getBytes()); bufferedOutputStream.write("\n\n".getBytes()); int i = 0; for (String s : certStr.split("")) { bufferedOutputStream.write(s.getBytes()); i++; if (i % 48 == 0) bufferedOutputStream.write("\n".getBytes()); } if (i % 48 != 0) bufferedOutputStream.write("\n".getBytes()); bufferedOutputStream.write("\n".getBytes()); bufferedOutputStream.write(end.getBytes()); bufferedOutputStream.write("\n".getBytes()); return true; } catch (IOException e) { Logger.error(Activator.PLUGIN_ID, Arrays.toString(e.getStackTrace()), e); } finally { try { if (bufferedOutputStream != null) bufferedOutputStream.close(); } catch (IOException e) { Logger.error(Activator.PLUGIN_ID, Arrays.toString(e.getStackTrace()), e); } } return false; }