Zum Inhalt springen

Android Setup & Backend-Verifizierung

GitHub

Bei Android wird dieser Plugin verwendet Google Play Integrity Standard API:

  • prepareIntegrityToken während prepare()
  • requestStandardIntegrityToken für createAttestation() und createAssertion()
  • Android-Anwendung, die über das Google Play-Ökosystem verteilt wird
  • Google Play-Dienste stehen auf dem Gerät zur Verfügung
  • Play Integrity API ist für Ihre App aktiviert
  • Google Cloud-Projekt-ID ist konfiguriert
  1. Aktivieren Play Integrity API in Ihrem Google Cloud-Projekt.
  2. Öffnen Sie das Play-Konsolen-Tool und konfigurieren Sie den Zugriff auf Play Integrity für Ihre App.
  3. Bereitstellen cloudProjectNumber für das Plugin.
capacitor.config.ts
plugins: {
AppAttest: {
cloudProjectNumber: '123456789012',
},
}

Sie können auch cloudProjectNumber pro Aufruf in den Optionen der Methode.

import { AppAttest } from '@capgo/capacitor-app-attest';
const { keyId } = await AppAttest.prepare({
cloudProjectNumber: '123456789012',
});
const attestation = await AppAttest.createAttestation({
keyId,
challenge: 'backend-registration-challenge',
});
const assertion = await AppAttest.createAssertion({
keyId,
payload: 'backend-request-payload',
});

token is ein Play-Integritätstoken und muss serverseitig entschlüsselt werden.

Hintergrundworkflow (Android)

Abschnitt: Hintergrundworkflow (Android)

Registrierung (createAttestation)

Abschnitt: Registrierung (createAttestation)
  1. Hintergrund erstellt eine einmalige challenge.
  2. Die App ruft createAttestation({ keyId, challenge }).
  3. Hintergrund ruft Google decodeIntegrityToken API.
  4. Hintergrund überprüft mindestens:
    • requestDetails.requestHash === base64url(SHA256(challenge))
    • appIntegrity.packageName entspricht Ihrem Android-Anwendungs-ID
    • appIntegrity.certificateSha256Digest enthält Ihren Release-Signierungszertifikats-Digest
    • Integritätsurteile entsprechen Ihrer Sicherheitspolitik
  1. Hintergrund erstellt eine einmalige payload.
  2. App ruft createAssertion({ keyId, payload }).
  3. Hintergrund entschlüsselt Token und überprüft requestHash === base64url(SHA256(payload)).
  4. Zwingen Sie die Wiederholungsverhinderung (einezeitig + TTL) und die Integritätsurteilsrichtlinie.
sequenceDiagram
participant App as Android App
participant Plugin as AppAttest plugin
participant PlaySDK as Play Integrity SDK
participant BE as Backend
participant Google as decodeIntegrityToken API
App->>Plugin: prepare(cloudProjectNumber)
Plugin->>PlaySDK: prepareIntegrityToken()
PlaySDK-->>Plugin: provider handle (keyId)
BE->>App: one-time challenge
App->>Plugin: createAttestation(keyId, challenge)
Plugin->>PlaySDK: requestStandardIntegrityToken(requestHash)
PlaySDK-->>Plugin: integrity token
Plugin-->>App: token + platform + format + keyId
App->>BE: token + challenge + keyId
BE->>Google: decodeIntegrityToken(token)
Google-->>BE: decoded payload
BE->>BE: verify requestHash + app identity + verdicts
BE->>App: one-time payload
App->>Plugin: createAssertion(keyId, payload)
Plugin->>PlaySDK: requestStandardIntegrityToken(requestHash)
PlaySDK-->>Plugin: integrity token
App->>BE: token + payload + keyId
BE->>Google: decodeIntegrityToken(token)
Google-->>BE: decoded payload
BE->>BE: verify requestHash + replay policy

Registrierung:

{
"platform": "android",
"format": "google-play-integrity-standard",
"keyId": "string",
"challenge": "string",
"token": "string"
}

Aussage:

{
"platform": "android",
"format": "google-play-integrity-standard",
"keyId": "string",
"payload": "string",
"token": "string"
}

Wenn Sie " Android Setup & Backend-Verifizierung zum Planen von Sicherheit und Compliance verwenden, verbinden Sie es mit Mit @capgo/capacitor-app-attest zur nativen Fähigkeit in Mit @capgo/capacitor-app-attest, Verschlüsselung für die Implementierungsdetails in Verschlüsselung, Kongruenz für die Implementierungsdetails in Kongruenz, Capgo Sicherheits-Scanner für den Produktworkflow in Capgo Sicherheits-Scanner, und Capgo Sicherheit für den Produktworkflow in Capgo Sicherheit.