Bu sayfanın seçili sürümü ile mevcut sürümü arasındaki farkları gösterir.
en:esya:ios:ios [2014/04/07 13:25] Süleyman Uslu oluşturuldu |
en:esya:ios:ios [2014/04/10 08:10] (mevcut) Süleyman Uslu |
||
---|---|---|---|
Satır 15: | Satır 15: | ||
* Signatures can be created with type CAdES-BES. | * Signatures can be created with type CAdES-BES. | ||
* Generated signature is saved with name "sig.der" under "Documents" directory of the application. | * Generated signature is saved with name "sig.der" under "Documents" directory of the application. | ||
- | * Lisans dosyası kontrolü yapılıyor. Geçerli bir lisans dosyası olmadan imza atmaya izin vermiyor. | + | * License is checked. You are not allowed to sign without a valid license. |
Satır 21: | Satır 21: | ||
- | * İmzalanacak dökümanın özeti SHA-256 ile alınıyor. | + | * The document that is going to be signed is digested using SHA-256. |
- | * Oluşturulan imza SigningCertificateV2'ye sahip oluyor. | + | * Created signature will have SigningCertificateV2. |
- | * İmzalama algoritması olarak RSA-with-SHA256 kullanılıyor. | + | * RSA-with-SHA256 is used as signing algorithm. |
- | * (Kart okuyucu kısıtı). | + | * (Card reader restriction). |
- | ===== Kullanım ===== | + | ===== Usage ===== |
- | * Qt'nin son versiyonu (5.2 ve sonrası) kurulu olmalıdır. | + | * Latest version of Qt (5.2.1 and later) must be installed. |
- | * plist dosyasına gereken içerik eklenmelidir. ("iTunes file sharing" ve kart okuyucu icin "external accessory") | + | * 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") |
- | ===== Lisansın Eklenmesi ===== | + | ===== License ===== |
- | * Lisans uygulamanın altındaki 'Documents' dizinine konulmalıdır. | + | * License file must be placed under ''Documents'' folder of the application. |
- | * İsmi lisans.dat olmalıdır. | + | * Name of the license file must be ''license.dat''. |
- | * Dizine dosya ekleme işlemi iTunes ile yapılabilir, yalnız öncesinde plist'te "iTunes file sharing" aktif edilmelidir. | + | * Files can be added to ''Documents'' folder using iTunes, but before that ''iTunes file sharing'' must be activated in ''plist'' file. |
- | ===== Kodun Kullanımı ===== | + | ===== Code ===== |
- | * Arayüzler JAVA ve C# kütüphaneleri ile aynıdır. | + | * 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. | ||
- | * Karta session acma işlemleri ayrı bir thread içinde yapılmalıdır. | + | <sxh c> |
- | + | ||
- | + | ||
- | <sxh objc> | + | |
[NSThread detachNewThreadSelector:@selector(login:) toTarget:(id)self withObject:nil]; | [NSThread detachNewThreadSelector:@selector(login:) toTarget:(id)self withObject:nil]; | ||
</sxh> | </sxh> | ||
+ | * An instance of SmartCardManager should be created first. | ||
- | * Öncelikle SmartCardManager sınıfı üretilir. | + | <sxh c> |
- | + | ||
- | + | ||
- | <sxh objc> | + | |
SmartCardManager smartCardManager; | SmartCardManager smartCardManager; | ||
</sxh> | </sxh> | ||
- | * Daha sonra session açılır. | + | * Then session is opened into smart card. |
- | <sxh objc> | + | <sxh c> |
smartCardManager.openSession(); | smartCardManager.openSession(); | ||
</sxh> | </sxh> | ||
- | * Şimdi imzalama işlemlerine geçilebilir. | + | * Certificate that is going to be used for signing is retrieved. |
- | + | ||
- | * İmzalamada kullanılacak sertifika alınır. | + | |
- | <sxh objc> | + | <sxh c> |
ECertificate cert = smartCardManager.getSignatureCertificate(); | ECertificate cert = smartCardManager.getSignatureCertificate(); | ||
</sxh> | </sxh> | ||
- | * İmzayı barındıracak "Container" oluşturulur. | + | * ''Container'' object is created to encapsulate the signature object. |
- | <sxh objc> | + | <sxh c> |
SignatureContainer *container = new CMSContainer(); | SignatureContainer *container = new CMSContainer(); | ||
</sxh> | </sxh> | ||
- | * Okunan sertifika ile imza oluşturulur. | + | * ''Signature'' object is created using the certificate retrieved before. |
- | <sxh objc> | + | <sxh c> |
Signature *signature = container->createSignature(cert); | Signature *signature = container->createSignature(cert); | ||
</sxh> | </sxh> | ||
- | * İmzalanacak content oluşturulur ve imzaya eklenir. Ayrıca content'in CAdES-BES içinde yer alıp almayacağı 'boolean' ile belirtilir. | + | * 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. |
- | <sxh objc> | + | <sxh c> |
Signable *data = new SignableBytes(dataBytes); | Signable *data = new SignableBytes(dataBytes); | ||
signature->addContent(data, true); | signature->addContent(data, true); | ||
</sxh> | </sxh> | ||
- | * İmzalamayı yapacak 'Signer' objesi, akıllı kartın PIN'i ve imzalama yapılacak sertifika verilerek oluşturulur. | + | * ''Signer'' object, which will do signing, is generated by giving PIN of smart card and certificate. |
- | <sxh objc> | + | <sxh c> |
BaseSigner *signer = smartCardManager.getSigner("12345", cert); | BaseSigner *signer = smartCardManager.getSigner("12345", cert); | ||
</sxh> | </sxh> | ||
- | * Son olarak imzalama işlemi yapılır. | + | * In the end, ''sign'' function is called. |
- | <sxh objc> | + | <sxh c> |
signature->sign(signer); | signature->sign(signer); | ||
</sxh> | </sxh> | ||