Skip to content

Instantly share code, notes, and snippets.

@hkneptune
hkneptune / xml_signing.java
Created October 9, 2023 03:51
Signing XML File Content with p12 File
public static String signXmlContent(String inputFile, String keyStoreFilePath,
String keyStorePassword, String keyStoreAlias) throws Exception {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(new FileInputStream(keyStoreFilePath), keyStorePassword.toCharArray());
DocumentBuilderFactory buildFactory = DocumentBuilderFactory.newInstance();
buildFactory.setNamespaceAware(true);
Document document = buildFactory.newDocumentBuilder().parse(inputFile);
XMLSignatureFactory xmLSignatureFactory = XMLSignatureFactory.getInstance("DOM",
(Provider) Class.forName("org.jcp.xml.dsig.internal.dom.XMLDSigRI").newInstance());
@hkneptune
hkneptune / sha256sum.java
Created October 9, 2023 03:58
SHA256Sum
public static String sha256(File input) throws IOException {
Digest sha256 = new Digest();
sha256.update(Files.readAllBytes(input.toPath()));
StringBuilder buff = new StringBuilder();
for (byte b : sha256.digest()) {
buff.append(String.format("%02x", b & 0xFF));
}
@hkneptune
hkneptune / wildfly-control.sh
Created October 14, 2025 03:36
WildFly Startup Script
#!/bin/bash
# WildFly Startup Script
# Configuration variables
WILDFLY_HOME="/opt/wildfly-12.0.0.Final"
STANDALONE_DIR="standalone"
BIND_ADDRESS="0.0.0.0"
WILDFLY_BIN="${WILDFLY_HOME}/bin"
STANDALONE_FULL_PATH="${WILDFLY_HOME}/${STANDALONE_DIR}"
@hkneptune
hkneptune / soap_request_mtom.cs
Created March 27, 2026 04:08
SOAP Request Samples
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
/// <summary>Holds file attachment metadata for a SOAP request.</summary>
public class AttachmentData