Line 0
Link Here
|
|
|
1 |
package com.r_bg.stax; |
2 |
|
3 |
import java.io.ByteArrayInputStream; |
4 |
import java.math.BigInteger; |
5 |
import java.security.KeyFactory; |
6 |
import java.security.NoSuchAlgorithmException; |
7 |
import java.security.PublicKey; |
8 |
import java.security.cert.CertificateException; |
9 |
import java.security.cert.CertificateFactory; |
10 |
import java.security.cert.X509Certificate; |
11 |
import java.security.interfaces.RSAPublicKey; |
12 |
import java.security.spec.InvalidKeySpecException; |
13 |
import java.security.spec.RSAPublicKeySpec; |
14 |
|
15 |
import javax.xml.crypto.KeySelector; |
16 |
import javax.xml.crypto.XMLStructure; |
17 |
import javax.xml.crypto.dsig.Reference; |
18 |
import javax.xml.crypto.dsig.XMLSignature; |
19 |
import javax.xml.crypto.dsig.XMLSignatureFactory; |
20 |
import javax.xml.crypto.dsig.XMLValidateContext; |
21 |
import javax.xml.stream.XMLInputFactory; |
22 |
import javax.xml.stream.XMLStreamException; |
23 |
import javax.xml.stream.XMLStreamReader; |
24 |
|
25 |
import org.apache.xml.security.Init; |
26 |
import org.apache.xml.security.exceptions.Base64DecodingException; |
27 |
import org.apache.xml.security.exceptions.XMLSecurityException; |
28 |
import org.apache.xml.security.keys.content.x509.XMLX509Certificate; |
29 |
import org.apache.xml.security.utils.Base64; |
30 |
import org.apache.xml.security.utils.Constants; |
31 |
|
32 |
import sun.security.rsa.RSAKeyFactory; |
33 |
import sun.security.x509.X509Cert; |
34 |
|
35 |
import junit.framework.TestCase; |
36 |
|
37 |
public class XMLSignatureTest extends TestCase { |
38 |
/** @inheritDoc */ |
39 |
public static PublicKey getPublicKey(String certS) { |
40 |
|
41 |
try { |
42 |
CertificateFactory certFact = |
43 |
CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID); |
44 |
X509Certificate cert = |
45 |
(X509Certificate) certFact |
46 |
.generateCertificate(new ByteArrayInputStream( |
47 |
Base64.decode(certS.getBytes())) ); |
48 |
|
49 |
if (cert != null) { |
50 |
return cert.getPublicKey(); |
51 |
} |
52 |
} catch (CertificateException e) { |
53 |
// TODO Auto-generated catch block |
54 |
e.printStackTrace(); |
55 |
} catch (Base64DecodingException e) { |
56 |
// TODO Auto-generated catch block |
57 |
e.printStackTrace(); |
58 |
} |
59 |
return null; |
60 |
} |
61 |
|
62 |
public static PublicKey getPublicKey(String data,String exp) { |
63 |
|
64 |
try { |
65 |
KeyFactory rsaFactory = KeyFactory.getInstance("RSA"); |
66 |
// KeyFactory rsaFactory = KeyFactory.getInstance(JCE_RSA); |
67 |
RSAPublicKeySpec rsaKeyspec = |
68 |
new RSAPublicKeySpec(new BigInteger(1, Base64.decode(data.getBytes())), |
69 |
new BigInteger(1, Base64.decode(exp.getBytes())) ); |
70 |
PublicKey pk = rsaFactory.generatePublic(rsaKeyspec); |
71 |
|
72 |
return pk; |
73 |
} catch (NoSuchAlgorithmException ex) { |
74 |
ex.printStackTrace(); |
75 |
} catch (InvalidKeySpecException ex) { |
76 |
ex.printStackTrace(); |
77 |
} catch (Base64DecodingException e) { |
78 |
// TODO Auto-generated catch block |
79 |
e.printStackTrace(); |
80 |
} |
81 |
return null; |
82 |
} |
83 |
public void testEnvelopedSignature() throws Exception { |
84 |
String in="<RootObject><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
85 |
"<ds:SignedInfo>\n" + |
86 |
"<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></ds:CanonicalizationMethod>\n" + |
87 |
"<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></ds:SignatureMethod>\n" + |
88 |
"<ds:Reference URI=\"#1\">\n" + |
89 |
"<ds:Transforms>\n" + |
90 |
"<ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></ds:Transform>\n" + |
91 |
"</ds:Transforms>\n" + |
92 |
"<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></ds:DigestMethod>\n" + |
93 |
"<ds:DigestValue>oMQoFufPA7Un6cfz0GaEOJpE4Z8=</ds:DigestValue>\n" + |
94 |
"</ds:Reference>\n" + |
95 |
"</ds:SignedInfo>\n" + |
96 |
"<ds:SignatureValue>\n" + |
97 |
"AhyiFQ6hucykYJOJDBV3wbPBe2TAURXXfCUD7BmSAecT+izT9fHFsxRVez3s+6hYSgtaVhmeVgbd\n" + |
98 |
"ZEOMPFihBGldi1NV73Z/tpXxqNvY+/NwQmmasQp9gzFHxYF2cqi8m7sAHM03BIC1YoBctxVw/jxV\n" + |
99 |
"ClhLJuTSHoKwlzKH24g=\n" + |
100 |
"</ds:SignatureValue>\n" + |
101 |
"<ds:KeyInfo>\n" + |
102 |
"<ds:KeyValue>\n" + |
103 |
"<ds:RSAKeyValue>\n" + |
104 |
"<ds:Modulus>\n" + |
105 |
"skqbW7oBwM1lCWNwC1obkgj4VV58G1AX7ERMWEIrQQlZ8uFdQ3FNkgMdtmx/XUjNF+zXTDmxe+K/\n" + |
106 |
"lne+0KDwLWskqhS6gnkQmxZoR4FUovqRngoqU6bnnn0pM9gF/AI/vcdu7aowbF9S7TVlSw7IpxIQ\n" + |
107 |
"VjevEfohDpn/+oxljm0=\n" + |
108 |
"</ds:Modulus>\n" + |
109 |
"<ds:Exponent>AQAB</ds:Exponent>\n" + |
110 |
"</ds:RSAKeyValue>\n" + |
111 |
"</ds:KeyValue>\n" + |
112 |
"</ds:KeyInfo>\n" + |
113 |
"<ds:Object Id=\"1\"><UnderObject>A text in a box<OtherObject><OtherObject2></OtherObject2><OtherObject6></OtherObject6><OtherObject></OtherObject></OtherObject></UnderObject></ds:Object>\n" + |
114 |
"</ds:Signature></RootObject>"; |
115 |
XMLInputFactory im=XMLInputFactory.newInstance(); |
116 |
im.setProperty("javax.xml.stream.supportDTD", new Boolean(false)); |
117 |
XMLStreamReader reader=im.createXMLStreamReader(new ByteArrayInputStream(in.getBytes())); |
118 |
StaxValidateContext stx = StaxValidateContext.createEnvelopedValidator(reader); |
119 |
reader=im.createFilteredReader(reader, stx.getStreamReader()); |
120 |
while ((reader.getEventType())!=XMLStreamReader.END_DOCUMENT) { |
121 |
reader.next(); |
122 |
} |
123 |
XMLSignatureFactory fac=XMLSignatureFactory.getInstance("Stax"); |
124 |
stx.setSignatureNumber(0); |
125 |
XMLSignature sig=fac.unmarshalXMLSignature(stx); |
126 |
assertTrue("Signature reference must be right", |
127 |
((Reference)sig.getSignedInfo().getReferences().get(0)).validate(stx)); |
128 |
RSAPublicKey pl=(RSAPublicKey) getPublicKey( |
129 |
"skqbW7oBwM1lCWNwC1obkgj4VV58G1AX7ERMWEIrQQlZ8uFdQ3FNkgMdtmx/XUjNF+zXTDmxe+K/\n" + |
130 |
"lne+0KDwLWskqhS6gnkQmxZoR4FUovqRngoqU6bnnn0pM9gF/AI/vcdu7aowbF9S7TVlSw7IpxIQ\n" + |
131 |
"VjevEfohDpn/+oxljm0=\n" , |
132 |
"AQAB" |
133 |
); |
134 |
stx.setKeySelector(KeySelector.singletonKeySelector(pl)); |
135 |
assertTrue("Signature must be right", |
136 |
sig.validate(stx)); |
137 |
} |
138 |
public void testTamperedEnvelopedSignature() throws Exception { |
139 |
String in="<RootObject><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
140 |
"<ds:SignedInfo>\n" + |
141 |
"<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></ds:CanonicalizationMethod>\n" + |
142 |
"<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></ds:SignatureMethod>\n" + |
143 |
"<ds:Reference URI=\"#1\">\n" + |
144 |
"<ds:Transforms>\n" + |
145 |
"<ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></ds:Transform>\n" + |
146 |
"</ds:Transforms>\n" + |
147 |
"<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></ds:DigestMethod>\n" + |
148 |
"<ds:DigestValue>oMQoFufPA7Un6cfz0GaEOJpE4Z8=</ds:DigestValue>\n" + |
149 |
"</ds:Reference>\n" + |
150 |
"</ds:SignedInfo>\n" + |
151 |
"<ds:SignatureValue>\n" + |
152 |
"AhyiFQ6hucykYJOJDBV3wbPBe2TAURXXfCUD7BmSAecT+izT9fHFsxRVez3s+6hYSgtaVhmeVgbd\n" + |
153 |
"ZEOMPFihBGldi1NV73Z/tpXxqNvY+/NwQmmasQp9gzFHxYF2cqi8m7sAHM03BIC1YoBctxVw/jxV\n" + |
154 |
"ClhLJuTSHoKwlzKH24g=\n" + |
155 |
"</ds:SignatureValue>\n" + |
156 |
"<ds:KeyInfo>\n" + |
157 |
"<ds:KeyValue>\n" + |
158 |
"<ds:RSAKeyValue>\n" + |
159 |
"<ds:Modulus>\n" + |
160 |
"skqbW7oBwM1lCWNwC1obkgj4VV58G1AX7ERMWEIrQQlZ8uFdQ3FNkgMdtmx/XUjNF+zXTDmxe+K/\n" + |
161 |
"lne+0KDwLWskqhS6gnkQmxZoR4FUovqRngoqU6bnnn0pM9gF/AI/vcdu7aowbF9S7TVlSw7IpxIQ\n" + |
162 |
"VjevEfohDpn/+oxljm0=\n" + |
163 |
"</ds:Modulus>\n" + |
164 |
"<ds:Exponent>AQAB</ds:Exponent>\n" + |
165 |
"</ds:RSAKeyValue>\n" + |
166 |
"</ds:KeyValue>\n" + |
167 |
"</ds:KeyInfo>\n" + |
168 |
"<ds:Object Id=\"1\"><UnderObject>a text in a box<OtherObject><OtherObject2></OtherObject2><OtherObject6></OtherObject6><OtherObject></OtherObject></OtherObject></UnderObject></ds:Object>\n" + |
169 |
"</ds:Signature></RootObject>"; |
170 |
XMLInputFactory im=XMLInputFactory.newInstance(); |
171 |
im.setProperty("javax.xml.stream.supportDTD", new Boolean(false)); |
172 |
XMLStreamReader reader=im.createXMLStreamReader(new ByteArrayInputStream(in.getBytes())); |
173 |
StaxValidateContext stx = StaxValidateContext.createEnvelopedValidator(reader); |
174 |
reader=im.createFilteredReader(reader, stx.getStreamReader()); |
175 |
while ((reader.getEventType())!=XMLStreamReader.END_DOCUMENT) { |
176 |
reader.next(); |
177 |
} |
178 |
XMLSignatureFactory fac=XMLSignatureFactory.getInstance("Stax" ); |
179 |
stx.setSignatureNumber(0); |
180 |
XMLSignature sig=fac.unmarshalXMLSignature(stx); |
181 |
assertFalse("Signature must be wrong", |
182 |
((Reference)sig.getSignedInfo().getReferences().get(0)).validate(stx)); |
183 |
} |
184 |
public void testEnvelopingSignature() throws Exception{ |
185 |
String in="<?xml version=\"1.0\" encoding=\"UTF-8\"?><a>" + |
186 |
"<ns2:Assertion xmlns:ns2=\"urn:oasis:names:tc:SAML:2.0:assertion\" " + |
187 |
"ID=\"id3fe0b77e-c4a9-46db-be2f-c3a0d0a11d3f\" " + |
188 |
"IssueInstant=\"2006-05-23T11:20:28.750Z\" Version=\"2.0\">" + |
189 |
"<ns2:Issuer Format=\"urn:oasis:names:tc:SAML:2.0:nameid-format:entity\">" + |
190 |
"http://idp.idpdomain.com:9090/SAML2-IDP</ns2:Issuer>" + |
191 |
"<ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
192 |
"<ds:SignedInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
193 |
"<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"/>\n" + |
194 |
"<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"/>\n" + |
195 |
"<ds:Reference URI=\"#id3fe0b77e-c4a9-46db-be2f-c3a0d0a11d3f\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
196 |
"<ds:Transforms xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
197 |
"<ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"/>\n" + |
198 |
"<ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"/>\n" + |
199 |
"</ds:Transforms>\n" + |
200 |
"<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"/>\n" + |
201 |
"<ds:DigestValue xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">KXIBvPvqtl/8btEq1NfAyOc1Rxg=</ds:DigestValue>\n" + |
202 |
"</ds:Reference>\n" + |
203 |
"</ds:SignedInfo>\n" + |
204 |
"<ds:SignatureValue xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
205 |
"WtI8wWrmgVfEzvMJWLynE7F1UniubZNrynuQnDrbXrW8G3v4G8EpaD46iNUwOyh6qTCl9bLtamtl\n" + |
206 |
"jSiJkeWMLH0eTxlbLUHvftYHuvuM5QKue9sLGLJtbNC8AxyMThuG7Uz8MzZeu2vxffqXsGaWb3VQ\n" + |
207 |
"F0vyS4IlEq4d+YduUQ0=\n" + |
208 |
"</ds:SignatureValue>\n" + |
209 |
"<ds:KeyInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
210 |
"<ds:X509Data xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
211 |
"<ds:X509Certificate xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" + |
212 |
"MIICQjCCAasCBERCksgwDQYJKoZIhvcNAQEEBQAwaDELMAkGA1UEBhMCU1AxDzANBgNVBAgTBk1h\n" + |
213 |
"ZHJpZDERMA8GA1UEBxMITWlsZW5pdW0xFTATBgNVBAoTDEZ1bmN0aW9uVGVzdDEMMAoGA1UECxMD\n" + |
214 |
"RUlDMRAwDgYDVQQDEwdJRFBzaWduMB4XDTA2MDQxNjE4NTQwMFoXDTE2MDIyMzE4NTQwMFowaDEL\n" + |
215 |
"MAkGA1UEBhMCU1AxDzANBgNVBAgTBk1hZHJpZDERMA8GA1UEBxMITWlsZW5pdW0xFTATBgNVBAoT\n" + |
216 |
"DEZ1bmN0aW9uVGVzdDEMMAoGA1UECxMDRUlDMRAwDgYDVQQDEwdJRFBzaWduMIGfMA0GCSqGSIb3\n" + |
217 |
"DQEBAQUAA4GNADCBiQKBgQCeSYE0gfeoTyXtqlBGn7NEqWVMAE+KzlMBW8apoASb41e7kxGGBc5y\n" + |
218 |
"S4qLu5jMBwQTus9ctOhbMGnkonOvow7KC3axccsWc3cJt4aFGEbERJlhnwDmfa/Uk7qQ3aOmgl2P\n" + |
219 |
"6vY40En+jj4j5PkSETZXvtGBELLVOkVdTIQwjQ5sRQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAFbF\n" + |
220 |
"npwJ4XEcIyWEkkdSb30CCQsvflxVtvurhS97HzZxN3zi24KllnqtmYixM5S8Lsvrbov9Jz6ZaYnR\n" + |
221 |
"gD835oZDcSm/KKrRnFJxYxTjdbaolcEXyZU71v4JZMV6CMp9oLdyelYm08L6bacprw5VoF8sudQK\n" + |
222 |
"+7svI9827YEMeGPb\n" + |
223 |
"</ds:X509Certificate>\n" + |
224 |
"</ds:X509Data>\n" + |
225 |
"</ds:KeyInfo>\n" + |
226 |
"</ds:Signature>" + |
227 |
"<ns2:Subject><ns2:NameID Format=\"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent\" " + |
228 |
"NameQualifier=\"http://idp.idpdomain.com:9090/SAML2-IDP\" " + |
229 |
"SPNameQualifier=\"http://sp.spdomain.com:8080/SP1\" " + |
230 |
"SPProvidedID=\"FT5b5fc506-1b56-4cf3-ab8c-f904d9975f9e\">nida42d1765-d2c8-46b9-8568-c27eaddcd8a7" + |
231 |
"</ns2:NameID>" + |
232 |
"<ns2:SubjectConfirmation Method=\"urn:oasis:names:tc:SAML:2.0:cm:bearer\">" + |
233 |
"<ns2:SubjectConfirmationData InResponseTo=\"FTde99c35d-f413-42fb-8a60-289b86d39ebe\"" + |
234 |
" NotOnOrAfter=\"2006-05-23T11:42:28.796Z\" Recipient=\"http://sp.spdomain.com:8080/SP1\"/>" + |
235 |
"</ns2:SubjectConfirmation></ns2:Subject>" + |
236 |
"<ns2:Conditions NotBefore=\"2006-05-23T11:17:28.796Z\" " + |
237 |
"NotOnOrAfter=\"2006-05-23T11:42:28.796Z\">" + |
238 |
"<ns2:AudienceRestriction>" + |
239 |
"<ns2:Audience>http://sp.spdomain.com:8080/SP1</ns2:Audience>" + |
240 |
"</ns2:AudienceRestriction></ns2:Conditions>" + |
241 |
"<ns2:AuthnStatement AuthnInstant=\"2006-05-23T11:20:27.593Z\" " + |
242 |
"SessionIndex=\"A202FAFB0C3C80E9B360741F6F493085\" SessionNotOnOrAfter=\"2006-05-23T11:42:28.796Z\">" + |
243 |
"<ns2:AuthnContext>" + |
244 |
"<ns2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password" + |
245 |
"</ns2:AuthnContextClassRef></ns2:AuthnContext></ns2:AuthnStatement>" + |
246 |
"</ns2:Assertion></a>"; |
247 |
XMLInputFactory im=XMLInputFactory.newInstance(); |
248 |
im.setProperty("javax.xml.stream.supportDTD", new Boolean(false)); |
249 |
XMLStreamReader reader=im.createXMLStreamReader(new ByteArrayInputStream(in.getBytes())); |
250 |
StaxValidateContext stx = StaxValidateContext.createEnvelopedValidator(reader); |
251 |
reader=im.createFilteredReader(reader, stx.getStreamReader()); |
252 |
while ((reader.getEventType())!=XMLStreamReader.END_DOCUMENT) { |
253 |
if ((reader.getEventType()== XMLStreamReader.START_ELEMENT) && reader.getLocalName().equals("Assertion")) { |
254 |
stx.currentNodeIsReferenceTarget(reader.getAttributeValue(null, "ID"),null, "http://www.w3.org/2000/09/xmldsig#sha1"); |
255 |
} |
256 |
|
257 |
reader.next(); |
258 |
} |
259 |
XMLSignatureFactory fac=XMLSignatureFactory.getInstance("Stax" ); |
260 |
stx.setSignatureNumber(0); |
261 |
XMLSignature sig=fac.unmarshalXMLSignature(stx); |
262 |
assertTrue("Signature must be correct", |
263 |
((Reference)sig.getSignedInfo().getReferences().get(0)).validate(stx)); |
264 |
String cert="MIICQjCCAasCBERCksgwDQYJKoZIhvcNAQEEBQAwaDELMAkGA1UEBhMCU1AxDzANBgNVBAgTBk1h\n" + |
265 |
"ZHJpZDERMA8GA1UEBxMITWlsZW5pdW0xFTATBgNVBAoTDEZ1bmN0aW9uVGVzdDEMMAoGA1UECxMD\n" + |
266 |
"RUlDMRAwDgYDVQQDEwdJRFBzaWduMB4XDTA2MDQxNjE4NTQwMFoXDTE2MDIyMzE4NTQwMFowaDEL\n" + |
267 |
"MAkGA1UEBhMCU1AxDzANBgNVBAgTBk1hZHJpZDERMA8GA1UEBxMITWlsZW5pdW0xFTATBgNVBAoT\n" + |
268 |
"DEZ1bmN0aW9uVGVzdDEMMAoGA1UECxMDRUlDMRAwDgYDVQQDEwdJRFBzaWduMIGfMA0GCSqGSIb3\n" + |
269 |
"DQEBAQUAA4GNADCBiQKBgQCeSYE0gfeoTyXtqlBGn7NEqWVMAE+KzlMBW8apoASb41e7kxGGBc5y\n" + |
270 |
"S4qLu5jMBwQTus9ctOhbMGnkonOvow7KC3axccsWc3cJt4aFGEbERJlhnwDmfa/Uk7qQ3aOmgl2P\n" + |
271 |
"6vY40En+jj4j5PkSETZXvtGBELLVOkVdTIQwjQ5sRQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAFbF\n" + |
272 |
"npwJ4XEcIyWEkkdSb30CCQsvflxVtvurhS97HzZxN3zi24KllnqtmYixM5S8Lsvrbov9Jz6ZaYnR\n" + |
273 |
"gD835oZDcSm/KKrRnFJxYxTjdbaolcEXyZU71v4JZMV6CMp9oLdyelYm08L6bacprw5VoF8sudQK\n" + |
274 |
"+7svI9827YEMeGPb\n" ; |
275 |
RSAPublicKey pl=(RSAPublicKey) getPublicKey(cert); |
276 |
stx.setKeySelector(KeySelector.singletonKeySelector(pl)); |
277 |
assertTrue("Signature must be right", |
278 |
sig.validate(stx)); |
279 |
} |
280 |
|
281 |
static { |
282 |
Init.init(); |
283 |
|
284 |
StaxXMLSignatureFactory.getInstance("Stax", new StaxProvider()); |
285 |
|
286 |
}; |
287 |
|
288 |
} |