Skip to content

Instantly share code, notes, and snippets.

View BHSDuncan's full-sized avatar

Duncan Brown BHSDuncan

  • Toronto, Ontario, Canada
View GitHub Profile
@BHSDuncan
BHSDuncan / XMLDSigGenerator.java
Last active April 7, 2016 02:04
Class for generating an XML Digital Signature according to the W3C spec (https://www.w3.org/TR/xmldsig-core/). Note that the only part of this that requires JAXB is the output, which can then be assigned to the appropriate location in a SOAP envelope/message.
package com.whatever.service;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigInteger;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyStore;