Get public key
GET https://{domainname}/client/v1/{customerId}/crypto/publickey
Crypto
The crypto API allows you to retrieve a transaction specific public key from our server that should be used to encrypt sensitive data, like card details.
You should always use the encryption functions provided in our SDKs even if you are not using any of the other functions provided by the SDKs. The implementation of encryption functionality can be tricky and small errors can have big consequences.
Request
The request does not have any additional input parameters.
Request example
SDK: iOS
This scenario you will probably use the most
-
NSString *clientSessionId = @"<clientSessionId from Create Session>"; NSString *customerId = @"<customerId from Create Session>"; NSString *baseURL = @"<clientApiUrl from Create Session>"; NSString *assetBaseURL = @"<assetUrl from Create Session>"; NSString *appIdentifier = @"<your app name>"; ICUtil *util = [[ICUtil alloc] init]; ICC2SCommunicatorConfiguration *configuration = [[ICC2SCommunicatorConfiguration alloc] initWithClientSessionId:clientSessionId customerId:customerId baseURL:baseURL assetBaseURL:assetBaseURL appIdentifier:appIdentifier util:util]; ICC2SCommunicator *communicator = [[ICC2SCommunicator alloc] initWithConfiguration:configuration]; [communicator publicKey:^(ICPublicKeyResponse *publicKeyResponse) { NSString *keyId = publicKeyResponse.keyId; NSString *encodedPublicKey = publicKeyResponse.encodedPublicKey; // Process public key. } failure:^(NSError *error) { DLog(@"Error while retrieving public key: %@", [error localizedDescription]); }];
Responses
Please find below an overview of the possible responses.
Response 200 - OKPublicKey
The response contains the needed input for the encryption process.
Properties
|
|||
Property | Type | Required | Details |
---|---|---|---|
keyId | string | yes | read close |
close
DescriptionThe identifier of the key that is used to encrypt sensitive data
|
|||
publicKey | string | yes | read close |
close
DescriptionThe public key that is used to encrypt the sensitive data with. Only we have the private key and will be able to decrypt the encrypted payment details
|
Response example
SDK: iOS
This scenario you will probably use the most
-
{ "keyId" : "86b64e4e-f43e-4a27-9863-9bbd5b499f82", "publicKey" : "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkiJlGL1QjUnGDLpMNBtZPYVtOU121jfFcV4WrZayfw9Ib/1AtPBHP/0ZPocdA23zDh6aB+QiOQEkHZlfnelBNnEzEu4ibda3nDdjSrKveSiQPyB5X+u/IS3CR48B/g4QJ+mcMV9hoFt6Hx3R99A0HWMs4um8elQsgB11MsLmGb1SuLo0S1pgL3EcckXfBDNMUBMQ9EtLC9zQW6Y0kx6GFXHgyjNb4yixXfjo194jfhei80sVQ49Y/SHBt/igATGN1l18IBDtO0eWmWeBckwbNkpkPLAvJfsfa3JpaxbXwg3rTvVXLrIRhvMYqTsQmrBIJDl7F6igPD98Y1FydbKe5QIDAQAB" }