-
Notifications
You must be signed in to change notification settings - Fork 12
API documentation
First-time setup and version info
MoppLibManager.h, @interface MoppLibManager
- (void)setupWithSuccess:(VoidBlock)success andFailure:(FailureBlock)failure usingTestDigiDocService:(BOOL)useTestDDS andTSUrl:(NSString *)tsUrl withMoppConfiguration:(MoppLibConfiguration *)moppConfiguration;
Parameter | Type | Description |
---|---|---|
success | EmptySuccessBlock |
Called by the setupWithSuccess when setup is completed successfully |
failure | FailureBlock |
Called when something goes wrong with the setup |
useTestDDS | BOOL |
Set to YES when need to use Digidoc Test Service |
andTSUrl | NSString |
TS URL to use with Digidoc Service |
moppConfiguration | MoppLibConfiguration |
Central configuration to get data from |
None
Preliminary setup for MoppLib. Digidocpp is configured and initialized. TLS certificates cache is updated.
This method should be called before any other API call
MoppLibManager.h, @interface MoppLibManager
- (NSString *)moppLibVersion;
None
Type | Description |
---|---|
NSString* |
Textual representation of MoppLib version |
This method returns textual representation of MoppLib version
MoppLibManager.h, @interface MoppLibManager
- (NSString *)libdigidocppVersion;
None
Type | Description |
---|---|
NSString* |
Textual representation of libdigidocpp version |
This method returns textual representation of libdigidocpp version
Signed container actions:
- creating container
- validating container
- removing and adding signature to and from container
- adding and removing data files to and from container
- extracting data files from container
MoppLibContainerActions.h, @interface MoppLibContainerActions
- (void)openContainerWithPath:(NSString *)containerPath success:(ContainerBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
containerPath | NSString* |
File path to existing container file |
success | ContainerBlock |
Called when container is successfully validated; has MoppLibContainer object as a parameter |
failure | FailureBlock |
Called when invalidating container fails; has NSError* object as parameter for additional information |
None
This method is used to validate container. If container is successfully validated then MoppLibContainer
object is returned
as ContainerBlock
parameter
MoppLibContainerActions.h, @interface MoppLibContainerActions
- (void)createContainerWithPath:(NSString *)containerPath withDataFilePaths:(NSArray *)dataFilePaths success:(ContainerBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
containerPath | NSString* |
File path for new container |
dataFilePaths | NSArray* |
Array of strings containing file paths to data files for including to created container |
success | ContainerBlock |
Called when container is successfully created; has MoppLibContainer object as a parameter |
failure | FailureBlock |
Called when creating new container fails; has NSError* object as parameter for additional information |
None
This method creates a new container and validates it. MoppLibContainer
object is returned from ContainerBlock if operations is successful
MoppLibContainerActions.h, @interface MoppLibContainerActions
- (void)addDataFilesToContainerWithPath:(NSString *)containerPath withDataFilePaths:(NSArray *)dataFilePaths success:(ContainerBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
containerPath | NSString* |
Existing file path to container |
dataFilePaths | NSArray* |
Array of data file paths to add to container |
success | ContainerBlock |
Called when data files are successfully added to container; has MoppLibContainer object as a parameter |
failure | FailureBlock |
Called when adding data files to container fails; has NSError* object as parameter for additional error information |
None
This method adds files to container
MoppLibContainerActions.h, @interface MoppLibContainerActions
- (void)removeDataFileFromContainerWithPath:(NSString *)containerPath atIndex:(NSUInteger)dataFileIndex success:(ContainerBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
containerPath | NSString* |
Path to existing container file |
dataFileIndex | NSUInteger |
Index to data file to remove from container |
success | ContainerBlock |
Called when data file is successfully removed from container; has MoppLibContainer object as a parameter |
failure | FailureBlock |
Called when removing data file from container fails; has NSError* object as parameter for additional error information |
None
This method removes data file from container
MoppLibContainerActions.h, @interface MoppLibContainerActions
- (void)getContainersWithSuccess:(void(^)(NSArray *containers))success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
success | void(^)(NSArray *containers) |
Called when data file is successfully removed from container; has array of MoppLibContainer type objects as a parameter |
failure | FailureBlock |
Called when receiving available containers fail; has NSError* object as parameter for additional error information |
None
This method receives all available containers
MoppLibContainerActions.h, @interface MoppLibContainerActions
- (void)removeSignature:(MoppLibSignature *)moppSignature fromContainerWithPath:(NSString *)containerPath success:(ContainerBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
moppSignature | MoppLibSignature |
Signature to remove from container |
containerPath | NSString* |
Path to existing container file |
success | ContainerBlock |
Called when signature is successfully removed from container; has MoppLibContainer object as a parameter |
failure | FailureBlock |
Called when removing signature from container fails; has NSError* object as parameter for additional error information |
None
This method removes signature from container
MoppLibContainerActions.h, @interface MoppLibContainerActions
- (void)container:(NSString *)containerPath saveDataFile:(NSString *)fileName to:(NSString *)path success:(VoidBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
containerPath | NSString* |
Path to existing container file |
filename | NSString* |
File name to save data file as |
path | NSString* |
Folder path to save data file to |
success | VoidBlock |
Called when data file is successfully extracted from container and saved to specified location |
failure | FailureBlock |
Called when extracting data file from container fails to saving data file to specified location fails; has NSError* object as parameter for additional error information |
None
This method extracts data file from the container and saves it to the specified location
MoppLibContainerActions.h, @interface MoppLibContainerActions
- (void)addSignature:(NSString *)containerPath withPin2:(NSString*)pin2 success:(void(^)(MoppLibContainer *container, BOOL signatureWasAdded))success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
containerPath | NSString* |
File path to existing container |
pin2 | NSString* |
PIN2 code |
success | void(^)(MoppLibContainer *container, BOOL signatureWasAdded) |
Returns MoppLibContainer as a parameter; signatureWasAdded indicates whether signature was added |
failure | FailureBlock |
Called when adding signature to container fails; |
None
This method adds a signature to the container
ID-card actions
MoppLibCardActions.h, @interface MoppLibCardActions
+ (void)minimalCardPersonalDataWithSuccess:(PersonalDataBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
success | PersonalDataBlock |
Called when minimal card personal data is received successfully |
failure | FailureBlock |
Called when receiving minimal card personal data fails |
None
This method receives minimal card personal data
MoppLibCardActions.h, @interface MoppLibCardActions
+ (void)cardPersonalDataWithSuccess:(PersonalDataBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
success | PersonalDataBlock |
Called when receiving card personal data succeeds |
failure | FailureBlock |
Called when receiving card personal data fails |
None
This method receives card personal data
MoppLibCardActions.h, @interface MoppLibCardActions
+ (BOOL)isReaderConnected;
None
Type | Description |
---|---|
BOOL |
YES if reader connected, NO otherwise |
This method checks if reader is connected
MoppLibCardActions.h, @interface MoppLibCardActions
+ (void)isCardInserted:(BoolBlock) completion;
Parameter | Type | Description |
---|---|---|
completion | BoolBlock |
YES if card is inserted, NO otherwise |
None
This method checks if card is inserted into the reader
MoppLibCardActions.h, @interface MoppLibCardActions
+ (void)signingCertificateWithSuccess:(CertDataBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
success | CertDataBlock |
Called when information about signing certificate is successfully received |
failure | FailureBlock |
Called when receiving information about signing certificate fails |
None
This method provides information about signing certificate
MoppLibCardActions.h, @interface MoppLibCardActions
+ (void)authenticationCertificateWithSuccess:(CertDataBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
success | CertDataBlock |
Called when information about authentication certificate is successfully received |
failure | FailureBlock |
Called when receiving information about authentication certificate fails |
None
This method provides information about authentication certificate
MoppLibCardActions.h, @interface MoppLibCardActions
+ (void)pin1RetryCountWithSuccess:(NumberBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
success | NumberBlock |
Success block returning PIN1 retry count as NSNumber |
failure | FailureBlock |
Called when something went wrong requesting PIN1 retry count |
None
This method provides number of PIN1 attempts left before PIN1 is blocked.
MoppLibCardActions.h, @interface MoppLibCardActions
+ (void)pin1RetryCountWithSuccess:(NumberBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
success | NumberBlock |
Success block returning PIN2 retry count as NSNumber |
failure | FailureBlock |
Called when something went wrong requesting PIN2 retry count |
None
This method provides number of PIN2 attempts left before PIN2 is blocked.
MoppLibCardActions.h, @interface MoppLibCardActions
+ (void)pukRetryCountWithSuccess:(NumberBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
success | NumberBlock |
Success block returning PUK retry count as NSNumber |
failure | FailureBlock |
Called when something went wrong requesting PUK retry count |
None
This method provides number of PUK attempts left before PUK is blocked.
MoppLinPinActions.h, @interface MoppLinPinActions
+ (void)changePukTo:(NSString *)newPuk withOldPuk:(NSString *)oldPuk success:(VoidBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
newPuk | NSString* |
New PUK code |
oldPuk | NSString* |
Current PUK code |
success | VoidBlock |
Called when PUK is successfully changed to a new one |
failure | FailureBlock |
Called when something went wrong changing PUK code |
None
This method changes PUK code from old to new one
MoppLinPinActions.h, @interface MoppLibPinActions
+ (void)changePin1To:(NSString *)newPin1 withOldPin1:(NSString *)oldPin1 success:(VoidBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
newPin1 | NSString* |
New PIN1 code |
oldPin1 | NSString* |
Old PIN1 code |
success | VoidBlock |
Called when PIN1 is changed successfully using PIN1 |
failure | FailureBlock |
Called when something went wrong changing PIN1 code |
None
This method changes PIN1 code using old PIN1
MoppLibPinActions.h, @interface MoppLibPinActions
+ (void)changePin1To:(NSString *)newPin1 withPuk:(NSString *)puk success:(VoidBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
newPin1 | NSString* |
New PIN1 code |
puk | NSString* |
PUK code |
success | SuccessBlock |
Called when PIN1 is successfully changed with PUK code |
failure | FailureBlock |
Called something went wrong changing PIN1 with PUK code |
None
This method changes PIN1 code using PUK code
MoppLibPinActions.h, @interface MoppLibPinActions
+ (void)changePin2To:(NSString *)newPin2 withOldPin2:(NSString *)oldPin2 success:(VoidBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
newPin2 | NSString* |
New PIN2 code |
oldPin2 | NSString* |
Old PIN2 code |
success | SuccessBlock |
Called when PIN2 is successfully changed with PIN2 code |
failure | FailureBlock |
Called when something went wrong changing PIN2 code |
None
This method changes PIN2 code using old PIN2
MoppLibPinActions.h, @interface MoppLibPinActions
+ (void)changePin2To:(NSString *)newPin2 withPuk:(NSString *)puk success:(VoidBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
newPin2 | NSString* |
New PIN2 code |
puk | NSString* |
PUK code |
success | SuccessBlock |
Called when PIN2 is successfully changed |
failure | FailureBlock |
Called when PIN2 changing failed |
None
This method changes PIN2 code using PUK code
MoppLibPinActions.h, @interface MoppLibPinActions
+ (void)unblockPin1WithPuk:(NSString *)puk newPin1:(NSString *)newPin1 success:(VoidBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
puk | NSString* |
PUK code |
newPin1 | NSString* |
new PIN1 code |
success | SuccessBlock |
Called when PIN1 code successfully unblocked |
failure | FailureBlock |
Called when PIN1 code unblocking fails |
None
This method unblocks PIN1 using PUK code
MoppLibPinActions.h, @interface MoppLibPinActions
+ (void)unblockPin2WithPuk:(NSString *)puk newPin2:(NSString *)newPin2 success:(VoidBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
puk | NSString* |
PUK code |
newPin2 | NSString* |
New PIN2 code |
success | SuccessBlock |
Called when PIN2 code successfully unblocked |
failure | FailureBlock |
Called when PIN2 code unblocking fails |
None
This method unblocks PIN2 code using PUK
MoppLibCryptoActions.h, @interface MoppLibCryptoActions
- (void)searchLdapData:(NSString *)identifier success:(LdapBlock)success failure:(FailureBlock)failure configuration:(MoppLdapConfiguration *)moppLdapConfiguration;
Parameter | Type | Description |
---|---|---|
identifier | NSString* |
LDAP search request identifier |
success | LdapBlock |
Called on successful completion of action. |
failure | FailureBlock |
Block to be called when action fails. Includes error |
moppLdapConfiguration | MoppLdapConfiguration |
LDAP configuration from central configuration |
None
This method is used to search ldap data
MoppLibCryptoActions.h, @interface MoppLibCryptoActions
- (void)encryptData:(NSString *)fullPath withDataFiles:(NSArray*)dataFiles withAddressees:(NSArray*)addressees success:(VoidBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
fullPath | NSString* |
Full path of encrypted file |
dataFiles | NSArray* |
Array of CryptoDataFile associated with data files to be encrypted |
addressees | NSArray* |
Array of Addressee associated with addressees of the encrypted file |
success | VoidBlock |
Called when file is encrypted successfully |
failure | FailureBlock |
Called when something went wrong with encryption |
None
This method is used to encrypt data
MoppLibCryptoActions.h, @interface MoppLibCryptoActions
- (void)decryptData:(NSString *)fullPath withPin1:(NSString*)pin1 success:(DecryptedDataBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
fullPath | NSString* |
Full path of encrypted file |
pin1 | NSString* |
PIN1 code |
success | DecryptedDataBlock |
Called when file is decrypted successfully |
failure | FailureBlock |
Called when something went wrong with decryption |
None
This method is used to decrypt CDOC
MoppLibCryptoActions.h, @interface MoppLibCryptoActions
- (void)parseCdocInfo:(NSString *)fullPath success:(CdocContainerBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
fullPath | NSString* |
Full path of CDOC container |
success | CdocContainerBlock |
Called when file is parsed successfully |
failure | FailureBlock |
Called when something went wrong with parsing |
None
This method is used to parse and get info of CDOC container
MoppLibCardReaderManager.h, @interface MoppLibCardReaderManager
- (void)startDiscoveringReaders;
None
None
Starts supported smart-card readers discovery.
MoppLibCardReaderManagerDelegate
can be used for discovered reader
status change
MoppLibCardReaderManager.h, @interface MoppLibCardReaderManager
- (void)stopDiscoveringReaders;
None
None
Prevents supported smart-card readers discovery when called
MoppLibCardReaderManager.h, @interface MoppLibCardReaderManager
- (void)setDelegate:id<MoppLibCardReaderManagerDelegate> delegate;
Parameter | Type | Description |
---|---|---|
delegate | MoppLibCardReaderManagerDelegate |
Protocol to propagate card reader status change events |
None
Set's status change delegate for MoppLibCardReaderManager
MoppLibCardReaderManager.h, @interface MoppLibCardReaderManager
@protocol MoppLibCardReaderManagerDelegate
- (void)moppLibCardReaderStatusDidChange:(MoppLibCardReaderStatus)status;
Used to delegate card reader status to the protocol implementation.
MoppLibCardReaderManager.h, @interface MoppLibCardReaderManager
@protocol MoppLibCardReaderManagerDelegate
Name | Value | Description |
---|---|---|
ReaderNotConnected | 0 | Supported reader is discovered |
ReaderConnected | 1 | Reader is discovered and connection to it has been made |
CardConnected | 2 | Card is inserted into the reader and powered on |
Smart-card reader status returned from MopplibCardReaderManagerDelegate's moppLibCardReaderStatusDidChange
MoppLibConstants.h
typedef NS_ENUM(int, MoppLibSignatureStatus)
Name | Value | Description |
---|---|---|
Valid | 0 | Signature is valid and equal to a handwritten signature |
Warning | 1 | Signature is valid but has warnings. Container has a specific feature that usually has arisen accidentally when containers were created. |
NonQSCD | 2 | The signature is not created by a QSCD |
Invalid | 3 | Digital signature has been declared invalid |
UnknownStatus | 4 | Program was unable to check the validity of the signature at the given moment. |
MoppLibConstants.h
typedef NS_ENUM(NSUInteger, MoppLibErrorCode)
Name | Value | Description |
---|---|---|
moppLibErrorReaderNotFound | 10001 | Reader is not connected to phone |
moppLibErrorCardNotFound | 10002 | Reader is connected, but card is not detected |
moppLibErrorCardVersionUnknown | 10003 | Unknown card version |
moppLibErrorWrongPin | 10004 | Provided pin is wrong |
moppLibErrorGeneral | 10005 | General error |
moppLibErrorInvalidPin | 10006 | New pin does not apply to rules |
moppLibErrorPinMatchesVerificationCode | 10007 | New pin must be different from old pin or puk |
moppLibErrorIncorrectPinLength | 10008 | New pin is too short or too long |
moppLibErrorPinTooEasy | 10009 | New pin is too easy |
moppLibErrorPinContainsInvalidCharacters | 10010 | Pin contains invalid characters. Only numbers are allowed |
moppLibErrorUrlSessionCanceled | 10012 | NSURLErrorCanceled occurred when connecting to external service. |
moppLibErrorXmlParsingError | 10013 | AEXMLDocument loadXml failed to parse data to XML. |
MoppLibErrorDDSError | 10014 | DigiDoc Service error |
moppLibErrorPinNotProvided | 10015 | User did not provide pin for action that required authentication |
moppLibErrorPinBlocked | 10016 | User did not provide pin for action that required authentication |
moppLibErrorFileNameTooLong | 10017 | File name too long |
moppLibErrorNoInternetConnection | 10018 | No internet connection |
moppLibErrorPinMatchesOldCode | 10019 | New pin must be different from old pin or puk |
moppLibErrorReaderSelectionCanceled | 10020 | User canceled card reader selection |
moppLibErrorRestrictedApi | 10021 | Restricted API. Some functionality is not available for third-party apps |
moppLibErrorLdapResponseNotFound | 10022 | Empty Ldap response |
moppLibErrorDuplicatedFilename | 10023 | Filename already exists in container |
MoppLibConstants.h
Name | Description |
---|---|
kMoppLibNotificationReaderStatusChanged | Notification to indicate reader status change |
kMoppLibNotificationRetryCounterChanged | Notification to indicate retry counter change |
MoppLibConstants.h
Name | Type | Description |
---|---|---|
DataSuccessBlock | void (^)(NSData *responseData); |
NSData* type object returned on successful operation |
ObjectSuccessBlock | void (^)(NSObject *responseObject); |
NSObject* type object returned on successful operation |
FailureBlock | void (^)(NSError *error); |
NSError* type object return upon operation failure |
CertDataBlock | void (^)(MoppLibCertificateData *certData); |
MoppLibCertificateData* type object returned on successful operation |
PersonalDataBlock | void (^)(MoppLibPersonalData *personalData); |
MoppLibPersonalData* type object returned on successful operation |
SignatureStatusBlock | void (^) (MoppLibContainer *container, NSError *error, NSString *status); |
Block used for signature status information |
ContainerBlock | void (^)(MoppLibContainer *container); |
MoppLibContainer* type object returned on successful container operation |
LdapBlock | void (^)(NSMutableArray *ldapResponse); |
NSMutableArray* of Addressee objects returned on successful operation |
CdocContainerBlock | void (^)(CdocInfo *cdocInfo); |
CdocInfo* type object returned on successful operation |
DecryptedDataBlock | void (^)(NSMutableDictionary *decryptedData); |
NSMutableDictionary* type object returned on successful operation |
MobileCreateSignatureResponseBlock | void (^)(MoppLibMobileCreateSignatureResponse); |
Mobile-ID signature response object return on successful Mobile-ID sign operation |
BoolBlock | void (^)(BOOL); |
Block type with BOOL as a parameter |
NumberBlock | void (^)(NSNumber*) |
Block type with NSNumber* as a parameter |
VoidBlock | void (^)(void); |
Empty callback block |
Objects returned from various MoppLib operations
MoppLibCertificateData.h, @interface MoppLibCertificateData
Name | Type | Description |
---|---|---|
isValid | BOOL |
YES if certificate is valid, NO otherwise |
expiryDate | NSDate* |
Expiry date of certificate |
organization | MoppLibCertOrganization |
Organization of certificate |
Name | Value | Description |
---|---|---|
IDCard | 0 | ID-card |
MobileID | 1 | Mobile-ID |
SmartID | 2 | Smart-ID |
DigiID | 3 | Digi-ID |
EResident | 4 | E-resident |
Unknown | 5 | Unknown |
MoppLibPersonalData.h, @interface MoppLibPersonalData
Name | Type | Description |
---|---|---|
firstNameLine1 | NSString* |
Person's given name |
firstNameLine2 | NSString* |
Person's given name |
surname | NSString* |
Person's surname |
sex | NSString* |
Person's sex |
nationality | NSString* |
Person's nationality |
birthDate | NSString* |
Person's birth date |
personalIdentificationCode | NSString* |
Personal identification code |
documentNumber | NSString* |
Document number |
expiryDate | NSString* |
Expiration date |
dateIssued | NSString* |
Date issued |
residentPermitType | NSString* |
Type of residence permit |
MoppLibContainer.h, @interface MoppLibContainer
Name | Type | Description |
---|---|---|
fileName | NSString* |
Name of the container |
filePath | NSString* |
File path of the container |
fileAttributes | NSDictionary* |
File attributes of the container |
dataFiles | NSArray* |
Array of MoppLibDataFile objects associated with the container |
signatures | NSArray* |
Array of MoppLibSignature objects associated with the container |
Name | Return value | Description |
---|---|---|
isSigned | BOOL |
Returns YES if container is signed, NO otherwise |
isEmpty | BOOL |
Returns YES if container has no signatures of data files, NO otherwise |
isDDocType | BOOL |
Returns YES container is DDOC type, NO otherwise |
isAsiceType | BOOL |
Returns YES if container is ASiC-E type, NO otherwise |
isLegacyType | BOOL |
Return YES if container is legacy type (ADOC, EDOC, DDOC, ASICS, PDF), NO otherwise |
fileNameWithoutExtension | NSString* |
Container name without the extension |
getNextSignatureId | NSString* |
Returns next signature ID |
MoppLibDataFile.h, @interface MoppLibDataFile
Name | Type | Description |
---|---|---|
mediaType | NSString* |
Media type of the data file |
fieldId | NSString* |
File ID of the data file |
fileName | NSString* |
Filename of data file |
fileSize | long |
File size of data file |
MoppLibSignature.h, @interface MoppLibSignature
Name | Type | Description |
---|---|---|
subjectName | NSString* |
Contains signer's full name and personal identification code |
timestamp | NSDate* |
Signature timestamp |
status | MoppLibSignatureStatus |
Signature status |
MoppLibMobileCreateSignatureResponse.h, @interface MoppLibMobileCreateSignatureResponse
Name | Type | Description |
---|---|---|
challengeId | NSString* |
Mobile-ID challenge ID |
sessCode | NSInteger |
Session code |
status | NSString* |
Signature response status |
CdocInfo.h, @interface CdocInfo
Name | Type | Description |
---|---|---|
addressees | NSMutableArray<Addressee *> |
Cdoc container addressees |
dataFiles | NSMutableArray<CryptoDataFile *> |
Cdoc container data files |
Addressee.h, @interface Addressee
Name | Type | Description |
---|---|---|
givenName | NSString* |
Given name of addressee |
surname | NSString* |
Surname of addressee |
identifier | NSString* |
Identifier of addressee |
type | NSString* |
Type of addressee certificate |
cert | NSData* |
Auth certificate of addressee |
validTo | NSDate* |
Expiration date of addressee auth certificate |
CryptoDataFile.h, @interface CryptoDataFile
Name | Type | Description |
---|---|---|
filename | NSString* |
Filename of data file |
filePath | NSString* |
File path of data file |
MoppLdapConfiguration.h, @interface MoppLdapConfiguration
Name | Type | Description |
---|---|---|
LDAPPERSONURL | NSString* |
LDAP URL to search persons |
LDAPCORPURL | NSString* |
LDAP URL to search corporations |
MoppLibConfiguration.h, @interface MoppLibConfiguration
Name | Type | Description |
---|---|---|
SIVAURL | NSString* |
SiVa (Signature Verification) URL |
TSLURL | NSString* |
TSL (Trust Service Status List) URL |
TSLCERTS | NSArray* |
Array of NSString associated with TSL certificates (PEM or DER format) |
TSAURL | NSString* |
TSA (Time Stamping Authority) URL |
OCSPISSUERS | NSDictionary* |
Dictionary of NSString : NSString associated with OCSP (Online Certificate Status Protocol) issuers |
Mobile-ID service now uses the Mobile-ID REST API and has been moved to "SkSigningLib" package. The package is written in Swift programming language. The following examples are in Swift language.
Requests signature for Mobile-ID
RequestSignature.swift, protocol CertificateRequest
func getCertificate(baseUrl: String, requestParameters: CertificateRequestParameters, trustedCertificates: [String]?, completionHandler: @escaping (Result<CertificateResponse, SigningError>) -> Void)
Parameter | Type | Description |
---|---|---|
baseUrl | String |
The base URL for Mobile-ID. Path "/certificate" will be added to the base URL. |
requestParameters | CertificateRequestParameters |
Parameters that are sent to the service. |
completionHandler | Result<CertificateResponse, SigningError> |
Callback handling on request response. |
None
This method is used to get certificate for signing with Mobile-ID.
Gets the session ID and polls session status
Session.swift, protocol SessionRequest
func getSession(baseUrl: String, requestParameters: SessionRequestParameters, trustedCertificates: [String]?, completionHandler: @escaping (Result<SessionResponse, SigningError>) -> Void)
Parameter | Type | Description |
---|---|---|
baseUrl | String |
The base URL for Mobile-ID. Path "/signature" will be added to the base URL. |
requestParameters | SessionRequestParameters |
Parameters that are sent to the service. |
completionHandler | Result<SessionResponse, SigningError> |
Callback handling on request response. |
None
This method is used to get session ID for signing with Mobile-ID. Session ID is used to poll session status.
Session.swift, protocol SessionRequest
func getSessionStatus(baseUrl: String, process: PollingProcess, requestParameters: SessionStatusRequestParameters, trustedCertificates: [String]?, completionHandler: @escaping (Result<SessionStatusResponse, SigningError>) -> Void)
Parameter | Type | Description |
---|---|---|
baseUrl | String |
The base URL for Mobile-ID. Path "/signature/session/{sessionId}?timeoutMs={timeoutMs}" will be added to the base URL. Values are taken from requestParameters. |
process | PollingProcess |
Determines if session is for authentication or signing. |
requestParameters | SessionRequestParameters |
Parameters that are used in URL. |
completionHandler | Result<SessionStatusResponse, SigningError> |
Callback handling on request response. |
None
This method is used to poll as long as Mobile-ID signing service responds.
Validate signature after successful Mobile-ID response. MoppLib framework must be used.
MoppLibManager.h, @interface MoppLibManager
+ (void)isSignatureValid:(NSString *)cert signatureValue:(NSString *)signatureValue success:(BoolBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
cert | NSString* |
Certificate in base64 format |
signatureValue | NSString* |
Signature value from Mobile-ID successful response |
success | BoolBlock |
YES if validation is successful, NO otherwise |
failure | FailureBlock |
Called when validating signature fails |
None
This method validates Mobile-ID signature
Smart-ID service uses the Smart-ID REST API and has been implemented in "SkSigningLib" package. The package is written in Swift programming language. The following examples are in Swift language.
Requests certificate for Smart-ID
SIDRequest.swift, protocol SIDRequestProtocol
func getCertificate(baseUrl: String, country: String, nationalIdentityNumber: String, requestParameters: SIDCertificateRequestParameters, trustedCertificates: [String]?, completionHandler: @escaping (Result<SIDSessionResponse, SigningError>) -> Void)
Parameter | Type | Description |
---|---|---|
baseUrl | String |
The base URL for Smart-ID. Path "/certificate/pno/{country}/{nationalIdentityNumber}" will be added to the base URL. |
country | String |
User country |
nationalIdentityNumber | String |
User personal code |
requestParameters | SIDCertificateRequestParameters |
Parameters that are sent to the service. |
trustedCertificates | [String]? |
Certificates to trust |
completionHandler | Result<SIDSessionResponse, SigningError> |
Callback handling on request response. |
None
This method is used to get certificate and session ID for signing with Smart-ID.
Requests signature for Smart-ID
SIDRequest.swift, protocol SIDRequestProtocol
func getSignature(baseUrl: String, documentNumber: String, requestParameters: SIDSignatureRequestParameters, trustedCertificates: [String]?, completionHandler: @escaping (Result<SIDSessionResponse, SigningError>) -> Void)
Parameter | Type | Description |
---|---|---|
baseUrl | String |
The base URL for Smart-ID. Path "/certificate/pno/{country}/{nationalIdentityNumber}" will be added to the base URL. |
documentNumber | String |
User country |
requestParameters | SIDCertificateRequestParameters |
Parameters that are sent to the service. |
trustedCertificates | [String]? |
Certificates to trust |
completionHandler | Result<SIDSessionResponse, SigningError> |
Callback handling on request response. |
None
This method is used to get session ID for signing with Smart-ID.
Requests session status and response for Smart-ID
SIDRequest.swift, protocol SIDRequestProtocol
func getSessionStatus(baseUrl: String, sessionId: String, timeoutMs: Int?, trustedCertificates: [String]?, completionHandler: @escaping (Result<SIDSessionStatusResponse, SigningError>) -> Void)
Parameter | Type | Description |
---|---|---|
baseUrl | String |
The base URL for Smart-ID. Path "/certificate/pno/{country}/{nationalIdentityNumber}" will be added to the base URL |
sessionId | String |
Session ID retrieved from signature response |
timeoutMs | Int? |
Timeout interval to poll session status (milliseconds) |
trustedCertificates | [String]? |
Certificates to trust |
completionHandler | Result<SIDSessionStatusResponse, SigningError> |
Callback handling on request response. |
None
This method is used to poll as long as Smart-ID signing service responds.
Validate signature after successful Smart-ID response. MoppLib framework must be used.
MoppLibManager.h, @interface MoppLibManager
+ (void)isSignatureValid:(NSString *)cert signatureValue:(NSString *)signatureValue success:(BoolBlock)success failure:(FailureBlock)failure;
Parameter | Type | Description |
---|---|---|
cert | NSString* |
Certificate in base64 format |
signatureValue | NSString* |
Signature value from Smart-ID successful response |
success | BoolBlock |
YES if validation is successful, NO otherwise |
failure | FailureBlock |
Called when validating signature fails |
None
This method validates Smart-ID signature
Type | Description |
---|---|
CertificateRequestParameters | Object needed to send to Mobile-ID service to request user certificate |
CertificateResponse | Certificate will be returned on successful response |
SessionRequestParameters | Object needed to send to Mobile-ID service to request session ID |
SessionResponse | Session ID will be returned on successful response |
PollingProcess | Determines if polling authentication or signing request |
SessionStatusRequestParameters | Object needed to send to Mobile-ID service to request session status |
SessionStatusResponse | Returns session signature on successful response |
SIDCertificateRequestParameters | Object needed to send to Smart-ID service to request session ID |
SIDSessionResponse | Returns session ID on successful response |
SIDSignatureRequestParameters | Relying party UUID and relying party name that are sent to Smart-ID service |
SIDSessionStatusResponse | Returns session signature on successful response |
SigningError | Object returned on operation failure |
SkSigningLib request objects
CertificateRequestParameters.swift, struct CertificateRequestParameters
Name | Type | Description |
---|---|---|
relyingPartyUUID | String |
Relying party UUID |
relyingPartyName | String |
Relying party name |
phoneNumber | String |
Phone number |
nationalIdentityNumber | String |
Personal code |
SessionRequestParameters.swift, struct SessionRequestParameters
Name | Type | Description |
---|---|---|
relyingPartyName | String |
Relying party name |
relyingPartyUUID | String |
Relying party UUID |
phoneNumber | String |
Phone number |
nationalIdentityNumber | String |
Personal code |
hash | String |
Hash to be sent to Mobile-ID service |
hashType | String |
Hash type (eg. SHA256) |
language | String |
Language (eg. EST) |
displayText | String? |
Text to display on user's phone |
displayTextFormat | String? |
Display format (eg. GSM-7) |
RequestMethod.swift
PollingProcess.SIGNING
Name | Description |
---|---|
AUTHENTICATION | Poll for authentication (not supported) |
SIGNING | Poll for signing |
SessionStatusRequestParameters.swift, struct SessionStatusRequestParameters
Name | Type | Description |
---|---|---|
sessionId | String |
Session ID retrieved from session request |
timeoutMs | String |
Timeout interval to poll session status (milliseconds) |
SIDCertificateRequestParameters.swift, struct SIDCertificateRequestParameters
Name | Type | Description |
---|---|---|
relyingPartyName | String |
Relying party name |
relyingPartyUUID | String |
Relying party UUID |
SIDSignatureRequestParameters.swift, struct SIDSignatureRequestParameters
Name | Type | Description |
---|---|---|
relyingPartyName | String |
Relying party name |
relyingPartyUUID | String |
Relying party UUID |
hash | String |
Hash to be sent to Smart-ID service |
hashType | String |
Hash type (eg. SHA256) |
displayText | String? |
Text to display on user's phone |
requestProperties | SIDSignatureRequestParametersProperties? |
Relying party UUID |
SIDSignatureRequestParameters.swift, struct SIDSignatureRequestParametersProperties
Name | Type | Description |
---|---|---|
vcChoice | String |
Verification code choice |
SkSigningLib response objects
CertificateResponse.swift, struct CertificateResponse
Name | Type | Description |
---|---|---|
result | ResponseResult? |
OK if certificate is valid, NOT_FOUND or NOT_ACTIVE otherwise |
cert | String? |
Certificate in base64 if response is successful |
time | String? |
Request time if response is successful |
traceId | String? |
Trace ID if response is successful |
error | String? |
Error description if response is unsuccessful |
| Name | Description | ---- | ----- | ---- | | OK | Result is successful | NOT_FOUND | Mobile-ID account not found | NOT_ACTIVE | Mobile-ID account not active
SessionResponse.swift, struct SessionResponse
Name | Type | Description |
---|---|---|
sessionID | String? |
Session ID will be returned if response is successful |
time | String? |
Request time if response is successful |
traceId | String? |
Trace ID if response is successful |
error | String? |
Error description if response is unsuccessful |
SessionStatusResponse.swift, struct SessionStatusResponse
Name | Type | Description |
---|---|---|
state | SessionResponseState |
Determines if session is running or has completed |
result | SessionResultCode? |
Session result. OK on successful response |
signature | SessionResponseSignature? |
Returned signature value |
cert | String? |
Certificate in base64 if response is successful |
time | String? |
Request time if response is successful |
traceId | String? |
Trace ID if response is successful |
error | String? |
Error description if response is unsuccessful |
Name | Description |
---|---|
RUNNING | Session is still processing |
COMPLETE | Session processing has finished |
Name | Description |
---|---|
OK | Session result successful |
TIMEOUT | Session has timed out |
NOT_MID_CLIENT | Account does not have Mobile-ID |
USER_CANCELLED | User has cancelled signing process |
SIGNATURE_HASH_MISMATCH | Signature hash mismatched |
PHONE_ABSENT | SIM card is not available |
DELIVERY_ERROR | Error when sending SMS |
SIM_ERROR | Invalid response from SIM card |
SessionResponseSignature.swift, struct SessionResponseSignature
Name | Type | Description |
---|---|---|
value | String |
Signature value |
algorithm | String |
Signature algorithm |
SIDSessionResponse.swift, struct SIDSessionResponse
Name | Type | Description |
---|---|---|
sessionID | String |
Session ID to poll for status |
SIDSessionStatusResponse.swift, struct SIDSessionStatusResponse
Name | Type | Description |
---|---|---|
state | SIDSessionStatusResponseState |
Determines if session is running or has completed |
result | SIDSessionStatusResponseResult? |
Session result. OK on successful response with documentNumber |
signature | SIDSessionStatusResponseSignature? |
Returned signature value |
cert | SIDSessionStatusResponseCertificate? |
Returned certificate value with level |
SIDSessionStatusResponse.swift, struct SIDSessionStatusResponseResult
Name | Type | Description |
---|---|---|
endResult | SIDSessionStatusResponseState |
Returned session status. OK for successful response |
documentNumber | SIDSessionStatusResponseResult? |
User document number |
Name | Description |
---|---|
OK | Successful response |
USER_REFUSED | User refused to continue |
TIMEOUT | Session has timed out |
DOCUMENT_UNUSABLE | Unknown error |
WRONG_VC | Incorrect verification code choice |
SIDSessionStatusResponse.swift, struct SIDSessionStatusResponseSignature
Name | Type | Description |
---|---|---|
value | String |
Signature value |
algorithm | String |
Signature algorithm |
SIDSessionStatusResponse.swift, struct SIDSessionStatusResponseCertificate
Name | Type | Description |
---|---|---|
value | String |
Certificate value |
certificateLevel | String |
Certificate level |
SigningError.swift
SigningError.generalError
Name | Description |
---|---|
invalidURL | URL is not valid |
noResponseError | No response, no Internet connection |
generalError | General error |
generalSignatureAddingError | Error when adding signature to container |
invalidSSLCert | SSL certificate is invalid |
notFound | Account not found |
notActive | Account not active |
parameterNameNull | Required parameter is empty |
userAuthorizationFailed | Failed to authorize user |
methodNotAllowed | Method not allowed response error |
internalError | Internal error on server side |
hashLengthInvalid | Invalid hash length |
hashEncodingInvalid | Invalid hash encoding |
sessionIdMissing | Session ID missing |
sessionIdNotFound | Session ID not found |
exceededUnsuccessfulRequests | Too many unsuccessful requests |
timeout | Session status timeout |
notMidClient | Not a Mobile-ID client |
userCancelled | User cancelled request |
signatureHashMismatch | Signature hash mismatch |
phoneAbsent | SIM is not available |
deliveryError | Unable to send SMS |
simError | Invalid response from SIM card |
tooManyRequests | Too many requests (Rate limiting) |
midInvalidAccessRights | Invalid relying party UUID for Mobile-ID |
sidInvalidAccessRights | Invalid relying party UUID for Smart-ID |
ocspInvalidTimeSlot | Invalid OCSP time slot |
certificateRevoked | Account certificate has been revoked |
wrongVC | Incorrect verification code choice |
documentUnusable | Unknown error |
notQualified | Invalid qualification |
oldApi | API too old |
sidTimeout | Smart-ID timeout error |
forbidden | Wrong country with RPUUID |
accountNotFound | Smart-ID account not found |