====== Signature on iOS ======
Basic Electronic Signature (BES) format is supported on iOS devices.
===== Notes =====
* API depends on Qt.
===== Capabilities =====
* Signatures can be created with type CAdES-BES.
* Generated signature is saved with name "sig.der" under "Documents" directory of the application.
* License is checked. You are not allowed to sign without a valid license.
===== Constraints =====
* The document that is going to be signed is digested using SHA-256.
* Created signature will have SigningCertificateV2.
* RSA-with-SHA256 is used as signing algorithm.
* (Card reader restriction).
===== Usage =====
* Latest version of Qt (5.2.1 and later) must be installed.
* Required content must be added to ''plist'' file. ("iTunes file sharing" to reach files under ''Documents'' folder from iTunes and for the card reader access "external accessory")
===== License =====
* License file must be placed under ''Documents'' folder of the application.
* Name of the license file must be ''license.dat''.
* Files can be added to ''Documents'' folder using iTunes, but before that ''iTunes file sharing'' must be activated in ''plist'' file.
===== Code =====
* Interfaces are the same with JAVA and C# libraries.
* Session opening process must be done in a seperated thread. Following line is where we start a new thread. For more, refer to ''NSThread'' class reference of iOS library from Apple.
[NSThread detachNewThreadSelector:@selector(login:) toTarget:(id)self withObject:nil];
* An instance of SmartCardManager should be created first.
SmartCardManager smartCardManager;
* Then session is opened into smart card.
smartCardManager.openSession();
* Certificate that is going to be used for signing is retrieved.
ECertificate cert = smartCardManager.getSignatureCertificate();
* ''Container'' object is created to encapsulate the signature object.
SignatureContainer *container = new CMSContainer();
* ''Signature'' object is created using the certificate retrieved before.
Signature *signature = container->createSignature(cert);
* Content to be signed is generated and added to ''Signature'' object. Also whether the content is placed in the signature is determined by boolean value passed to ''addContent'' function.
Signable *data = new SignableBytes(dataBytes);
signature->addContent(data, true);
* ''Signer'' object, which will do signing, is generated by giving PIN of smart card and certificate.
BaseSigner *signer = smartCardManager.getSigner("12345", cert);
* In the end, ''sign'' function is called.
signature->sign(signer);