SSE4E GPError GPSystem ByteString ByteBuffer TLV TLVList Card Atr Key Crypto Application GPApplication GPSecDomain ASN1 CardFile IsoSecureChannel ApplFactory GPXML JsScript CardSim X509 CRL KeyStore CMSSignedData CMSGenerator XMLSignature OCSPQuery LDAP SOAP URLConnection PKCS11Provider PKCS11Session PKCS11Object OutlineNode OpenSCDP |
XMLSignature - Reference Documentation
Class implementing support for XML Digital Signatures This class provides for the ability to create and verify XML Digital Signatures. Index of MethodsConstants
ConstructorPrototypeXMLSignature(String filename) DescriptionCreate object and initialize from document in referenced file.Arguments
Exceptions
Examplevar ds = new XMLSignature("xmlsig1.xml"); addReference()Prototypevoid addReference(String uri, Number digestMech) void addReference(String uri, Number digestMech, String[] transformations) DescriptionAdd a reference to the SignedInfo Arguments
Return
Exceptions
Exampleds.addReference("", Crypto.SHA_256, [XMLSignature.ENVELOPED]); ds.addReference("./xmlsig1.xml", Crypto.SHA_256); sign()Prototypevoid sign(Crypto crypto, String c14n, Number mech, Key privateKey, Key publicKey) DescriptionCreate signature using the private key and signature mechanism. The data to be signed is canonicalized using the selected method. The public key is stored in the KeyInfo section. Arguments
Return
Exceptions
Example// Create empty public key object and set size var pubKey = new Key(); pubKey.setType(Key.PUBLIC); pubKey.setSize(1024); // Create empty private key object and set size var priKey = new Key(); priKey.setType(Key.PRIVATE); var crypto = new Crypto(); // Generate key pair crypto.generateKeyPair(Crypto.RSA, pubKey, priKey); ds.sign(crypto, XMLSignature.EXCLUSIVE, Crypto.RSA_SHA256, priKey, pubKey); verify()Prototypeboolean verify(Crypto crypto, Key publicKey) DescriptionVerify XML signature using the public key provided. Arguments
Return
Exceptions
Exampleassert(ds.verify(crypto, pubKey)); saveAs()Prototypevoid saveAs(String filename) DescriptionSave XML Digital Signature to file. Return
Exceptions
Examplevar fn = GPSystem.mapFilename("xmlsig2.xml", GPSystem.CWD); ds.saveAs(fn); © Copyright 2003 - 2010 CardContact Software & System Consulting, Minden, Germany |