diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java | 10 | ||||
-rw-r--r-- | src/test/resources/at/gv/egiz/moazs/ITSignatureVerifierTest/valid-signed-notification.xml | 91 |
2 files changed, 101 insertions, 0 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java b/src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java index e4dbec7..592b108 100644 --- a/src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java +++ b/src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java @@ -43,6 +43,16 @@ import java.nio.file.Files; verifier.accept(signature); } + @Test + public void acceptValidDeliveryNotification() throws IOException { + + var path = resourcesPath + "valid-signed-notification.xml"; + var signature = Files.readAllBytes(new File(path).toPath()); + + verifier.accept(signature); + } + + @Test(expected = MoaZSException.class) public void rejectInvalidSignedDeliveryResponse() throws IOException { diff --git a/src/test/resources/at/gv/egiz/moazs/ITSignatureVerifierTest/valid-signed-notification.xml b/src/test/resources/at/gv/egiz/moazs/ITSignatureVerifierTest/valid-signed-notification.xml new file mode 100644 index 0000000..7dfd2ee --- /dev/null +++ b/src/test/resources/at/gv/egiz/moazs/ITSignatureVerifierTest/valid-signed-notification.xml @@ -0,0 +1,91 @@ +<DeliveryNotification xmlns="http://reference.e-government.gv.at/namespace/zustellung/msg" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:p="http://reference.e-government.gv.at/namespace/persondata/20020228#" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"> + <Success> + <DeliveryService>https://localhost/example-delivery-system</DeliveryService> + <AppDeliveryID>12345</AppDeliveryID> + <ZSDeliveryID>678910</ZSDeliveryID> + <Sender> + <Organisation> + <p:FullName>Musterbehörde</p:FullName> + </Organisation> + <p:PostalAddress type="undefined"> + <p:CountryCode>AT</p:CountryCode> + <p:PostalCode>1234 </p:PostalCode> + <p:Municipality>Graz</p:Municipality> + <p:DeliveryAddress> + <p:StreetName>Musterstraße</p:StreetName> + <p:BuildingNumber>1 </p:BuildingNumber> + <p:Unit>b2</p:Unit> + </p:DeliveryAddress> + </p:PostalAddress> + <p:InternetAddress> + <p:Address>max.mustermann@musterbehoerde.gv.at</p:Address> + </p:InternetAddress> + </Sender> + <Receiver> + <p:PhysicalPerson> + <p:Name> + <p:GivenName>Maxi</p:GivenName> + <p:FamilyName primary="undefined">Mustermann1</p:FamilyName> + </p:Name> + <p:DateOfBirth>1984-01-24-02:00</p:DateOfBirth> + </p:PhysicalPerson> + <p:PostalAddress type="undefined"> + <p:PostalCode>1010</p:PostalCode> + <p:Municipality>Wien</p:Municipality> + <p:DeliveryAddress> + <p:StreetName>Muststrasse</p:StreetName> + <p:BuildingNumber>10</p:BuildingNumber> + </p:DeliveryAddress> + </p:PostalAddress> + </Receiver> + <NotificationsPerformed> + <RecipientNotification> + <NotificationMethod>electronic</NotificationMethod> + <Timestamp>2002-05-30T09:00:00</Timestamp> + </RecipientNotification> + </NotificationsPerformed> + <ConfirmationTimestamp>2002-05-30T09:00:00</ConfirmationTimestamp> + <AuthBlock AssertionID="asdf" IssueInstant="2002-05-30T09:00:00" Issuer="mee" MajorVersion="1" MinorVersion="100"> + <saml:AttributeStatement> + <saml:Subject> + <saml:NameIdentifier>1234</saml:NameIdentifier> + <saml:SubjectConfirmation> + <saml:ConfirmationMethod>1234</saml:ConfirmationMethod> + </saml:SubjectConfirmation> + </saml:Subject> + <saml:Attribute AttributeName="1234" AttributeNamespace="123"> + <saml:AttributeValue>100</saml:AttributeValue> + </saml:Attribute> + </saml:AttributeStatement> + </AuthBlock> + </Success> + <dsig:Signature Id="signature-1-1" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:SignedInfo><dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><dsig:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><dsig:Reference Id="reference-1-1" URI=""><dsig:Transforms><dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><dsig:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><dsig:DigestValue>kh0DDpXv4nh2gqK3lVle+3O/Oz4nSB2exjUHfalqyG0=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo><dsig:SignatureValue>OV3sSaUEkAh2Kls7g0v2EHCDnpsaN3BDU5dgwKhw8inkeADfhAgNbJyeq0Y/Hwl6 +JmfJOD1aF7qmxICI5/ZfTE9h+LIebcMZ30qkZ6YnzyxoeBa+hnTmvPKvSpQtGUYL +Xa1gakY5LN3l/w1AokkPN9j7WCGjF8ZoDZLP2M0KXcjhyPuwQ3XzXD8Cqnl42jfI +oL3b6P9Wd/MYugFTho9cY1awpPqIlXG4kob9zjDfFyTyEqa5A6LgcjdU5e3viSoh +N7hLuSYH6BfaLxuolwF3Bszj1GP1vGSWNQBPSHVu5crnfPb5KpDmZE4nzw3wp4zo +hovAEEVexRtqYZEX95TTiA==</dsig:SignatureValue><dsig:KeyInfo><dsig:X509Data><dsig:X509Certificate>MIIEqzCCBBSgAwIBAgIHANux81oNezANBgkqhkiG9w0BAQUFADBAMSIwIAYDVQQD +ExlJQUlLIFRlc3QgSW50ZXJtZWRpYXRlIENBMQ0wCwYDVQQKEwRJQUlLMQswCQYD +VQQGEwJBVDAeFw0xMzA5MjcwNTMzMzdaFw0yMzA5MjcwNTMzMzdaMIHkMQswCQYD +VQQGEwJBVDENMAsGA1UEBxMER3JhejEmMCQGA1UEChMdR3JheiBVbml2ZXJzaXR5 +IG9mIFRlY2hub2xvZ3kxSDBGBgNVBAsTP0luc3RpdHV0ZSBmb3IgQXBwbGllZCBJ +bmZvcm1hdGlvbiBQcm9jZXNzaW5nIGFuZCBDb21tdW5pY2F0aW9uczEUMBIGA1UE +BBMLTU9BLVNTIFRlc3QxGDAWBg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