[java-metadata-aggregator] 02/03: MDA-297 - Add Sign Using PKCS#11 Token example

Ian Young ian at iay.org.uk
Mon Oct 23 16:49:43 UTC 2023


This is an automated email from the git hooks/post-receive script.

iay pushed a commit to branch main
in repository java-metadata-aggregator.

View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=1eefed50620f8187030ff23e06514a45984f7aac

commit 1eefed50620f8187030ff23e06514a45984f7aac
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Mon Oct 23 17:32:10 2023 +0100

    MDA-297 - Add Sign Using PKCS#11 Token example
    
    https://shibboleth.atlassian.net/browse/MDA-297
---
 doc/wiki/README.md            |  4 +++
 doc/wiki/sign-using-token.xml | 68 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)

diff --git a/doc/wiki/README.md b/doc/wiki/README.md
index 8f42f87..819e15b 100644
--- a/doc/wiki/README.md
+++ b/doc/wiki/README.md
@@ -18,6 +18,10 @@ with new releases by having test data available alongside them.
 
     `.../mda.sh aggregate-and-republish.xml main`
 
+- [Sign Using PKCS#11 Token](https://shibboleth.atlassian.net/wiki/spaces/MA1/pages/1502216280/Sign+using+PKCS%2311+token)
+
+    `.../mda.sh sign-using-token.xml main`
+
 - [Generate Discovery Feed](https://shibboleth.atlassian.net/wiki/spaces/MA1/pages/1552614062/Generate+Discovery+Feed):
 
     `.../mda.sh discofeed.xml main`
diff --git a/doc/wiki/sign-using-token.xml b/doc/wiki/sign-using-token.xml
new file mode 100644
index 0000000..cdf61db
--- /dev/null
+++ b/doc/wiki/sign-using-token.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans default-init-method="initialize"
+       xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+
+    <!-- Import the Standard bean definition resource. -->
+    <!-- See https://shibboleth.atlassian.net/wiki/spaces/MA1/pages/3162439683/Standard+bean+definition+resource -->
+    <import resource="classpath:net/shibboleth/metadata/beans.xml"/>
+
+    <!-- First, we define the stages for our pipeline -->
+    <bean id="source" parent="mda.DOMFilesystemSourceStage">
+        <property name="id" value="source"/>
+        <property name="parserPool">
+            <bean class="net.shibboleth.shared.xml.impl.BasicParserPool" init-method="initialize"/>
+        </property>
+        <property name="source">
+            <bean class="java.io.File">
+                <constructor-arg value="path/to/input/aggregate.xml"/>
+            </bean>
+        </property>
+    </bean>
+
+    <bean id="generateContentReferenceId" parent="mda.GenerateIdStage">
+        <property name="id" value="generateContentReferenceId" />
+    </bean>
+
+    <bean id="signMetadata" parent="mda.XMLSignatureSigningStage">
+        <property name="id" value="signMetadata"/>
+        <property name="certificates">
+            <bean class="net.shibboleth.shared.spring.security.factory.X509CertificateFactoryBean">
+                <property name="resource" value="file:path/to/input/self-signed.pem"/>
+            </bean>
+        </property>
+        <property name="privateKey">
+            <bean class="net.shibboleth.shared.spring.security.factory.PKCS11PrivateKeyFactoryBean">
+                <property name="pkcs11Config" value="path/to/input/pkcs11-softhsm.cfg"/>
+                <property name="keyPassword" value="12341234"/>
+                <property name="keyAlias" value="key10"/>
+            </bean>
+        </property>
+    </bean>
+
+    <bean id="serialize" parent="mda.SerializationStage">
+        <property name="id" value="serializeIdPs"/>
+        <property name="outputFile">
+            <bean class="java.io.File">
+                <constructor-arg value="path/to/output/signed-with-token.xml"/>
+            </bean>
+        </property>
+        <property name="serializer">
+            <bean id="domSerializer" parent="mda.DOMElementSerializer" />
+        </property>
+    </bean>
+
+    <!-- Next we define a pipeline with all the stages in it -->
+    <bean id="main" parent="mda.SimplePipeline" init-method="initialize">
+        <property name="id" value="main"/>
+        <property name="stages">
+            <list>
+                <ref bean="source"/>
+                <ref bean="generateContentReferenceId" />
+                <ref bean="signMetadata"/>
+                <ref bean="serialize" />
+            </list>
+        </property>
+    </bean>
+
+</beans>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list