In order to establish a connection to a XignIn-Manager the corresponding private key and server certificate is needed. These are provided by the XignSys GmbH as files (server.pem and app.p12) and referred to as key material. Note that they are only used to limit arbitrary calls to the server and have no actual security relevance as one could expect from API keys. Nevertheless, they should not be passed to third parties. The key material to the official XignSys XignIn-Manager is provided by the SDK itself and normally does not need to be changed.
To establish a connection to a specific XignIn-Manager the key material files must be supplied to the SDK within the
app. For iOS apps the necessary files can be added as resources. On Android the files can either be added as raw
resources under res/raw or as assets within the assets directory (preferred variant) of the app. After that the
locations of these files must be made known to the SDK. This can be achieved by creating an instance of
the XignSdkConfig.Builder and invoking addKeyMaterial(serverCert:appKeystore:appKeystorePassphrase:hostnames:). The
last parameter expects a list of hostnames the key material should be used for. At least one hostname must be provided.
The following example shows how key material can be added to the XignSys SDK via a configuration object.
private func initializationWithKeyMaterial(_ application: UIApplication) throws {
let sdkConfig: XignSdkConfig = try XignSdkConfig.with { builder in
// add custom key material for on-premise XignIn-Managers
try builder.addKeyMaterial(
serverCert: Bundle.main.url(forResource: "your_server", withExtension: "pem")!,
appKeystore: Bundle.main.url(forResource: "your_app", withExtension: "p12")!,
appKeystorePassphrase: "your_passphrase",
hostnames: "your.domain"
)
// add more configurations if needed
// ...
}
try XignSdk.initialize(application: application, config: sdkConfig)
// After a successful initialization the instance of the XignSdk class can be accessed as follows:
let xignSdk: XignSdk = XignSdk.shared
// Important: Accessing the instance before initialization (or after de-initialization) results in
// a NSException!
}
private fun initializationWithKeyMaterial(context: Context) {
val sdkConfig: XignSdkConfig = XignSdkConfig.with { builder ->
// add custom key material for on-premise XinIn-Managers
builder.addKeyMaterial(
serverCert = context.assets.open("your_server.pem"),
appKeystore = context.assets.open("your_app.p12"),
appKeystorePassphrase = "your_passphrase",
"your.domain"
)
// add more configurations if needed
// ...
}
XignSdk.initialize(context = context, config = sdkConfig)
// After a successful initialization the instance of the XignSdk class can be accessed as follows:
val xignSdk: XignSdk = XignSdk.shared
// Important: Accessing the instance before initialization (or after de-initialization) results in
// an IllegalStateException!
}