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: Swift
This scenario you will probably use the most
-
import IngenicoConnectKit let clientSessionId = "<clientSessionId from Create Session>" let customerId = "<customerId from Create Session>" let baseURL = "<clientApiUrl from Create Session>" let assetBaseURL = "<assetUrl from Create Session>" let appIdentifier = "<your app name>" let configuration = C2SCommunicatorConfiguration(clientSessionId: clientSessionId, customerId: customerId, baseURL: baseURL, assetBaseURL: assetBaseURL, appIdentifier: appIdentifier) let communicator = C2SCommunicator(configuration: configuration) communicator.publicKey(success: { response in let keyId = response.keyId let encodedPublicKey = response.encodedPublicKey // Process public key. }, failure: { error in Macros.DLog(message: 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: Swift
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" }