aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/dsig
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-11-27 10:05:17 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-11-27 10:05:17 +0100
commitf3476576c50efd922593c82656efda7aec5ae97f (patch)
tree66107d5c5d3a88af66bd4829d8fcecc5678b749e /pdf-as-lib/src/main/java/at/gv/egiz/dsig
parent7b2e2b640b0f392183f7927f692936950d3fabfc (diff)
downloadpdf-as-4-f3476576c50efd922593c82656efda7aec5ae97f.tar.gz
pdf-as-4-f3476576c50efd922593c82656efda7aec5ae97f.tar.bz2
pdf-as-4-f3476576c50efd922593c82656efda7aec5ae97f.zip
MOA integration sign/verification (not finished yet ...)
Lots of PDF-AS Web implementation
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/dsig')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/dsig/ObjectFactory.java118
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/dsig/X509DataType.java100
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/dsig/X509IssuerSerialType.java98
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/dsig/package-info.java9
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/dsig/util/DsigMarschaller.java52
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/dsig/util/package-info.java8
6 files changed, 385 insertions, 0 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/dsig/ObjectFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/ObjectFactory.java
new file mode 100644
index 00000000..49eec607
--- /dev/null
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/ObjectFactory.java
@@ -0,0 +1,118 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2013.11.19 at 11:53:18 AM CET
+//
+
+
+package at.gv.egiz.dsig;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the at.gv.egiz.dsig package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _X509Data_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Data");
+ private final static QName _X509DataTypeX509IssuerSerial_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509IssuerSerial");
+ private final static QName _X509DataTypeX509Certificate_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Certificate");
+ private final static QName _X509DataTypeX509SKI_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SKI");
+ private final static QName _X509DataTypeX509SubjectName_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SubjectName");
+ private final static QName _X509DataTypeX509CRL_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509CRL");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: at.gv.egiz.dsig
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link X509DataType }
+ *
+ */
+ public X509DataType createX509DataType() {
+ return new X509DataType();
+ }
+
+ /**
+ * Create an instance of {@link X509IssuerSerialType }
+ *
+ */
+ public X509IssuerSerialType createX509IssuerSerialType() {
+ return new X509IssuerSerialType();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link X509DataType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Data")
+ public JAXBElement<X509DataType> createX509Data(X509DataType value) {
+ return new JAXBElement<X509DataType>(_X509Data_QNAME, X509DataType.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link X509IssuerSerialType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509IssuerSerial", scope = X509DataType.class)
+ public JAXBElement<X509IssuerSerialType> createX509DataTypeX509IssuerSerial(X509IssuerSerialType value) {
+ return new JAXBElement<X509IssuerSerialType>(_X509DataTypeX509IssuerSerial_QNAME, X509IssuerSerialType.class, X509DataType.class, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Certificate", scope = X509DataType.class)
+ public JAXBElement<byte[]> createX509DataTypeX509Certificate(byte[] value) {
+ return new JAXBElement<byte[]>(_X509DataTypeX509Certificate_QNAME, byte[].class, X509DataType.class, ((byte[]) value));
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509SKI", scope = X509DataType.class)
+ public JAXBElement<byte[]> createX509DataTypeX509SKI(byte[] value) {
+ return new JAXBElement<byte[]>(_X509DataTypeX509SKI_QNAME, byte[].class, X509DataType.class, ((byte[]) value));
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509SubjectName", scope = X509DataType.class)
+ public JAXBElement<String> createX509DataTypeX509SubjectName(String value) {
+ return new JAXBElement<String>(_X509DataTypeX509SubjectName_QNAME, String.class, X509DataType.class, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509CRL", scope = X509DataType.class)
+ public JAXBElement<byte[]> createX509DataTypeX509CRL(byte[] value) {
+ return new JAXBElement<byte[]>(_X509DataTypeX509CRL_QNAME, byte[].class, X509DataType.class, ((byte[]) value));
+ }
+
+}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/dsig/X509DataType.java b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/X509DataType.java
new file mode 100644
index 00000000..1b1eaa95
--- /dev/null
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/X509DataType.java
@@ -0,0 +1,100 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2013.11.19 at 11:53:18 AM CET
+//
+
+
+package at.gv.egiz.dsig;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlElementRefs;
+import javax.xml.bind.annotation.XmlType;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for X509DataType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="X509DataType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence maxOccurs="unbounded">
+ * &lt;choice>
+ * &lt;element name="X509IssuerSerial" type="{http://www.w3.org/2000/09/xmldsig#}X509IssuerSerialType"/>
+ * &lt;element name="X509SKI" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
+ * &lt;element name="X509SubjectName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="X509Certificate" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
+ * &lt;element name="X509CRL" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
+ * &lt;any processContents='lax' namespace='##other'/>
+ * &lt;/choice>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "X509DataType", propOrder = {
+ "x509IssuerSerialOrX509SKIOrX509SubjectName"
+})
+public class X509DataType {
+
+ @XmlElementRefs({
+ @XmlElementRef(name = "X509IssuerSerial", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
+ @XmlElementRef(name = "X509CRL", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
+ @XmlElementRef(name = "X509SubjectName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
+ @XmlElementRef(name = "X509SKI", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
+ @XmlElementRef(name = "X509Certificate", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false)
+ })
+ @XmlAnyElement(lax = true)
+ protected List<Object> x509IssuerSerialOrX509SKIOrX509SubjectName;
+
+ /**
+ * Gets the value of the x509IssuerSerialOrX509SKIOrX509SubjectName property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the x509IssuerSerialOrX509SKIOrX509SubjectName property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getX509IssuerSerialOrX509SKIOrX509SubjectName().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link JAXBElement }{@code <}{@link X509IssuerSerialType }{@code >}
+ * {@link Object }
+ * {@link Element }
+ * {@link JAXBElement }{@code <}{@link byte[]}{@code >}
+ * {@link JAXBElement }{@code <}{@link byte[]}{@code >}
+ * {@link JAXBElement }{@code <}{@link String }{@code >}
+ * {@link JAXBElement }{@code <}{@link byte[]}{@code >}
+ *
+ *
+ */
+ public List<Object> getX509IssuerSerialOrX509SKIOrX509SubjectName() {
+ if (x509IssuerSerialOrX509SKIOrX509SubjectName == null) {
+ x509IssuerSerialOrX509SKIOrX509SubjectName = new ArrayList<Object>();
+ }
+ return this.x509IssuerSerialOrX509SKIOrX509SubjectName;
+ }
+
+}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/dsig/X509IssuerSerialType.java b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/X509IssuerSerialType.java
new file mode 100644
index 00000000..650ba68c
--- /dev/null
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/X509IssuerSerialType.java
@@ -0,0 +1,98 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2013.11.19 at 11:53:18 AM CET
+//
+
+
+package at.gv.egiz.dsig;
+
+import java.math.BigInteger;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for X509IssuerSerialType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="X509IssuerSerialType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="X509IssuerName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="X509SerialNumber" type="{http://www.w3.org/2001/XMLSchema}integer"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "X509IssuerSerialType", propOrder = {
+ "x509IssuerName",
+ "x509SerialNumber"
+})
+public class X509IssuerSerialType {
+
+ @XmlElement(name = "X509IssuerName", required = true)
+ protected String x509IssuerName;
+ @XmlElement(name = "X509SerialNumber", required = true)
+ protected BigInteger x509SerialNumber;
+
+ /**
+ * Gets the value of the x509IssuerName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getX509IssuerName() {
+ return x509IssuerName;
+ }
+
+ /**
+ * Sets the value of the x509IssuerName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setX509IssuerName(String value) {
+ this.x509IssuerName = value;
+ }
+
+ /**
+ * Gets the value of the x509SerialNumber property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getX509SerialNumber() {
+ return x509SerialNumber;
+ }
+
+ /**
+ * Sets the value of the x509SerialNumber property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setX509SerialNumber(BigInteger value) {
+ this.x509SerialNumber = value;
+ }
+
+}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/dsig/package-info.java b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/package-info.java
new file mode 100644
index 00000000..1675634c
--- /dev/null
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/package-info.java
@@ -0,0 +1,9 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2013.11.19 at 11:53:18 AM CET
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.w3.org/2000/09/xmldsig#", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package at.gv.egiz.dsig;
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/dsig/util/DsigMarschaller.java b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/util/DsigMarschaller.java
new file mode 100644
index 00000000..17770737
--- /dev/null
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/util/DsigMarschaller.java
@@ -0,0 +1,52 @@
+package at.gv.egiz.dsig.util;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+
+public class DsigMarschaller {
+ private static Marshaller marshaller = null;
+ private static Unmarshaller unmarshaller = null;
+
+ public final static QName X509DataTypeX509Certificate_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Certificate");
+
+ static {
+ try {
+ JAXBContext context = JAXBContext.newInstance("at.gv.egiz.dsig");
+ marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+
+ unmarshaller = context.createUnmarshaller();
+ } catch (JAXBException e) {
+ throw new RuntimeException(
+ "There was a problem creating a JAXBContext object for formatting the object to XML.");
+ }
+ }
+
+ public static void marshal(Object obj, OutputStream os) throws JAXBException {
+ marshaller.marshal(obj, os);
+ }
+
+ public static String marshalToString(Object obj) throws JAXBException {
+ StringWriter sw = new StringWriter();
+ marshaller.marshal(obj, sw);
+ return sw.toString();
+ }
+
+ public static Object unmarshal(InputStream is) throws JAXBException {
+ return unmarshaller.unmarshal(is);
+ }
+
+ public static Object unmarshalFromString(String message) throws JAXBException {
+ StringReader sr = new StringReader(message);
+ return unmarshaller.unmarshal(sr);
+ }
+}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/dsig/util/package-info.java b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/util/package-info.java
new file mode 100644
index 00000000..942b7215
--- /dev/null
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/dsig/util/package-info.java
@@ -0,0 +1,8 @@
+/**
+ *
+ */
+/**
+ * @author afitzek
+ *
+ */
+package at.gv.egiz.dsig.util; \ No newline at end of file