Provisioning Certificates Using URL with Afaria

Returns the certificate as a base64 encoded string.

Syntax

- (NSString *) getSignedCertificateFromAfariaForURL: (NSSTring *) url
withUsername: (NSString *) username
withPassword: (NSString *) password

Parameters

  • url – URL passed by the Afaria client.
  • username – Common name used to generate the CSR.
  • password – Certificate Authority password that should associate with CSR.

Returns

Returns the certificate as a base64 encoded string.

Examples

  • Provisioning Certificates Using URL
    if ([[url absoluteString] length] != 0 ) {
            @try {
                LiteSUPCertificateStore* store = [LiteSUPCertificateStore getInstance];
                NSString* certBase64 = [store getSignedCertificateFromAfariaForURL:[url absoluteString] withUsername:@"Username" withPassword:@"Password"];
                NSLog(@"%@", certBase64);
            }
            @catch (NSException *exception) {NSLog(@"%@", [exception reason]);
            }
        }

Usage

This API has to mandatorily be called in the
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
method of your application delegate. The API is called after the Afaria client generates a URL and forwards it to the application via the delegate. This is required only if the above call is the first call to Afaria in the application.