Developer key setup
Security

Developer key setup

These keys authenticate the consumer wallet integration. POS terminal keys are created/imported and managed through the merchant key lifecycle.

Prepare your RSA credentials, register the public material with Wollette, then import the private key before your app signs requests. The SDK receives only the developer ID, nonce and signature.

Choose your key path

IntegrationFollow
Minimal repository starterSelect approved development key files through the system picker; follow the Android or iOS app steps and the local formats below
Original complete development starterSteps 1–5 below: generate/register approved test material, convert platform files and import before signing
Existing-app componentsProvisioned keys: the signer reads an installed alias/tag; your approved provisioner supplies the key
Production applicationObtain delivery, enrolment, rotation/revocation and packaging approval before using either example

The conversion/import code documents local formats. It does not establish a production provisioning service or the server's accepted public-key upload encoding.

1. Generate the key pair

Use an RSA key of 3072–4096 bits and separate pairs for development and production. These commands use OpenSSL 3.x:

Shell
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out developer-private-key.pem
openssl rsa -in developer-private-key.pem -pubout -out developer-public-key.pem

Keep developer-private-key.pem private. Obtain your developer-id from Wollette and save it as a single line of text.

2. Register the public material

Wollette must register the public key matching your private key against your DeveloperId before authenticated API requests succeed.

If Wollette confirms certificate registration, generate a certificate containing the same public key:

Shell
openssl req -new -x509 -sha512 -days 3650 \
  -key developer-private-key.pem \
  -subj "/CN=Your Company Wollette Developer" \
  -out developer-public.pem

Submit only the confirmed public-key or certificate file. Never submit the private key. Certificate lifetime and renewal policy must be agreed with Wollette; the command's lifetime is an example.

Confirm the enrolment contract

The native SDK does not upload keys. Submit public material only through Wollette's approved enrolment process.

The repository notes an existing developer public-key API, but the recorded route has a prefix discrepancy: SDK notes show /api/v1/developers/{developerId}/public-keys, while the referenced core controller declares /developers/{developerId}/public-keys. The platform owner must confirm the externally supported route and any gateway rewrite before you copy an upload request.

Upload encoding also needs an end-to-end test. The inspected service stores Base64-encoded UTF-8 request text; the verifier reconstructs DER SubjectPublicKeyInfo. This does not establish a working PEM-certificate upload. Keep the Android certificate used for local Keystore import separate from server enrolment.

Ask for proof that the approved upload is followed by an accepted signed read, plus wrong-key, changed-nonce and repeated-proof behaviour. The public signing test validates fixed bytes locally and supplies no private key.

Confirm rotation, overlap, revocation and expiry separately.

3. Package and import on Android

Android uses a PKCS#8 DER private key and a matching X.509 certificate. The KeyProtection / KeyStore.setEntry import method below is available from API 23, within the SDK's API 24 minimum. It does not require API 28.

Shell
openssl pkcs8 -topk8 -nocrypt \
  -in developer-private-key.pem -outform DER -out developer-private-key.der
openssl req -new -x509 -sha512 -days 3650 \
  -key developer-private-key.pem -subj "/CN=Wollette Developer" \
  -outform DER -out developer-certificate.der

During the build, copy these files into app/src/main/assets/ from controlled storage:

FileFormat
developer-idOne line of text
developer-private-key.derPKCS#8 DER private key
developer-certificate.derX.509 DER certificate containing the matching public key

The local import certificate and Wollette's public-key enrolment format are separate requirements.

File: DeveloperCredentials.kt. Use your app's package name:

Kotlin
package com.example.app

import android.content.Context
import android.security.keystore.KeyProperties
import android.security.keystore.KeyProtection
import java.security.KeyFactory
import java.security.KeyStore
import java.security.cert.CertificateFactory
import java.security.interfaces.RSAPrivateKey
import java.security.interfaces.RSAPublicKey
import java.security.spec.PKCS8EncodedKeySpec

object DeveloperCredentials {
    const val ALIAS = "wollette-developer-key-v1"

    fun importIfNeeded(context: Context) {
        val store = KeyStore.getInstance("AndroidKeyStore").apply { load(null) }
        if (store.containsAlias(ALIAS)) return
        val privateBytes = context.assets.open("developer-private-key.der").use { it.readBytes() }
        val privateKey = try {
            KeyFactory.getInstance("RSA").generatePrivate(PKCS8EncodedKeySpec(privateBytes))
        } finally {
            privateBytes.fill(0)
        }
        val certificate = context.assets.open("developer-certificate.der").use {
            CertificateFactory.getInstance("X.509").generateCertificate(it)
        }
        val rsaPrivate = privateKey as RSAPrivateKey
        val rsaPublic = certificate.publicKey as RSAPublicKey
        require(rsaPrivate.modulus == rsaPublic.modulus) { "Key and certificate do not match" }
        require(rsaPublic.modulus.bitLength() in 3072..4096) { "Unsupported RSA key size" }
        val protection = KeyProtection.Builder(KeyProperties.PURPOSE_SIGN)
            .setDigests(KeyProperties.DIGEST_SHA512)
            .setSignaturePaddings(KeyProperties.SIGNATURE_PADDING_RSA_PKCS1)
            .build()
        store.setEntry(
            ALIAS, KeyStore.PrivateKeyEntry(privateKey, arrayOf(certificate)), protection
        )
    }
}

Call importIfNeeded before creating the provider. The Android quickstart contains the signer using SHA512withRSA and android.util.Base64.NO_WRAP. Use a new alias for a rotated key; an existing alias is not overwritten by this helper.

4. Package and import on iOS

Convert both keys to PKCS#1 DER:

Shell
openssl rsa -in developer-private-key.pem -traditional -outform DER -out developer-private-key.pkcs1.der
openssl rsa -pubin -in developer-public-key.pem -RSAPublicKey_out -outform DER -out developer-public-key.pkcs1.der

Add these files to your app bundle during the build, with app target membership:

FileFormat
developer-idOne line of text
developer-private-key.pkcs1.derPKCS#1 DER private key
developer-public-key.pkcs1.derMatching PKCS#1 DER public key

This section preserves the original complete starter's development bundle layout. The native iOS signer uses only the private key. A bundled public key is not required by native SDK signing; the minimal starter and a new host can use the installed private-key tag. Keep matching public material available for approved server enrolment.

File: DeveloperCredentials.swift:

Swift
import Foundation
import Security

enum DeveloperCredentials {
    private static let tag = Data("com.example.wollette.developer-key-v1".utf8)

    enum Failure: Error {
        case missingKeyFile
        case keyImport
        case signing
        case keychain(OSStatus)
    }

    private static var query: [CFString: Any] {
        [kSecClass: kSecClassKey,
         kSecAttrApplicationTag: tag,
         kSecAttrKeyType: kSecAttrKeyTypeRSA,
         kSecAttrKeyClass: kSecAttrKeyClassPrivate]
    }

    private static func storedKey() throws -> SecKey? {
        var lookup = query
        lookup[kSecReturnRef] = true
        var result: CFTypeRef?
        let status = SecItemCopyMatching(lookup as CFDictionary, &result)
        if status == errSecItemNotFound { return nil }
        guard status == errSecSuccess, let result else { throw Failure.keychain(status) }
        return (result as! SecKey) // The query requests a key reference.
    }

    static func importIfNeeded() throws {
        if try storedKey() != nil { return }
        guard let url = Bundle.main.url(
            forResource: "developer-private-key.pkcs1", withExtension: "der"
        ) else { throw Failure.missingKeyFile }
        let data = try Data(contentsOf: url)
        let attributes: [CFString: Any] = [
            kSecAttrKeyType: kSecAttrKeyTypeRSA,
            kSecAttrKeyClass: kSecAttrKeyClassPrivate
        ]
        var error: Unmanaged<CFError>?
        guard let key = SecKeyCreateWithData(data as CFData, attributes as CFDictionary, &error) else {
            if let error { throw error.takeRetainedValue() }
            throw Failure.keyImport
        }
        var add = query
        add[kSecValueRef] = key
        add[kSecAttrAccessible] = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
        let status = SecItemAdd(add as CFDictionary, nil)
        guard status == errSecSuccess else { throw Failure.keychain(status) }
    }

    static func signNonce(_ nonce: String) throws -> String {
        guard let key = try storedKey() else { throw Failure.keyImport }
        var error: Unmanaged<CFError>?
        guard let signature = SecKeyCreateSignature(
            key, .rsaSignatureMessagePKCS1v15SHA512, Data(nonce.utf8) as CFData, &error
        ) else {
            if let error { throw error.takeRetainedValue() }
            throw Failure.signing
        }
        return (signature as Data).base64EncodedString()
    }
}

Call importIfNeeded before the first signed request. The iOS quickstart shows the provider and DeveloperId loading. Use a new tag for a rotated key. The helper reports Keychain errors instead of silently continuing after a failed import.

.rsaSignatureMessagePKCS1v15SHA512 hashes the message before signing. Pass the nonce's UTF-8 bytes directly; do not pre-hash them.

5. Verify the signer

Before shipping, use a throwaway key to check:

  • Two provider calls return different UUIDs and signatures.
  • Each signature verifies over the exact nonce bytes using the matching public key.
  • A 3072-bit key produces 384 signature bytes; a 4096-bit key produces 512. The SDK accepts decoded lengths from 384 through 512 inclusive.
  • A clean install imports and signs without debug provisioning.
  • Android works on API 24/25 and current Android; iOS works on a device after install and relaunch.

The SDK validates proof shape; the server verifies the signature. A wrong but well-formed signature can pass local validation and still fail at the API.

Clean up temporary material

Delete temporary key files from writable build staging or app storage when no longer needed. This does not remove the copy in the app package. clear and device-compromise cleanup do not delete the developer key; remove old Keystore/Keychain entries through your app's key-rotation procedure.

Provisioned keys in an existing app

The new minimal repository apps import approved development keys through the system picker and use their installed alias/tag; they do not bundle keys. The original complete starter apps above use the earlier supplied build-asset/bundle setup for local testing. The copyable components instead consume an installed Keystore alias or Keychain tag from your approved provisioner. Their import helpers take supplied bytes; they do not deliver keys to a device.

PlatformLocal import inputSigning helper reads
AndroidPKCS#8 DER private key and matching X.509 DER certificateInstalled private-key alias
iOSRSA PKCS#1 DER private keyInstalled private-key application tag

The iOS local signer/importer needs the private key, with no certificate or bundled public key. Production provisioning still requires Wollette approval. Keep server enrolment encoding separate from local private-key import formats.

Use the component's DeveloperKeyImport only in your approved provisioning path. Check for an already installed key, preserve it on duplicate/import failure, and verify that the Android certificate matches. Do not overwrite aliases/tags on every startup. Remove temporary files after successful provisioning; secure-store import does not remove copies in an application package.

Confirm production delivery, rotation/revocation, overlapping-key support and old-app behaviour before shipping a changed key. Keep the same alias/tag in the provisioner and signer.