252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
# File 'ext/xmlsig/t/tc_tsik.rb', line 252
def test_Cert
signer = sign1('in.xml', privateKey(), NIL, resdir() + 'mycert.x509')
signer.attachPublicKey(1)
assert_equal(false, signer.nil?)
doc = sign2(signer, '/', NIL)
assert_equal(false, doc.nil?)
sigLoc = '/books/ds:Signature'
assert_equal(true, verify(doc, sigLoc, publicKey(), 0, 0), "Verify")
assert_equal(true, verify(doc, sigLoc, NIL, 1, 0), "Verify")
assert_equal(true, verify(doc, sigLoc, NIL, 1, 1), "Verify")
xpath = Xmlsig::XPath.new(sigLoc)
xpath.addNamespace("ds", "http://www.w3.org/2000/09/xmldsig#")
verifier = Xmlsig::Verifier.new(doc, xpath)
l = verifier.getCertificateChain()
assert_equal(1, l.length, "Chain length")
end
|