Skip to main content

pySafetyNet-Attestation

A package for verifying JWS-attestations from Google's SafetyNet.

Introduction

This package verifies SafetyNet attestations by following the steps described on the page. It allows you to specify what parts of the JWS-body you wish to verify, but will always atleast verify the certificate and validity of the JWS.

Usage

Online verification

from safetynet_attestation import Attestation

jws_token = "..."
api_key = "..."

attestation = Attestation(jws_token)
attestation.verify_online(api_key)

verify_online takes the following optional parameters:

  • url="<standard url>"
    • If you for some reason wish to validate against some other url.

<standard url> can be found at Google's SafetyNet documentation.

Offline verification

from safetynet_attestation import Attestation


jws_token = "..."

attestation = Attestation(jws_token)
attestation.verify_offline()

verify_offline takes the following optional parameters:

  • apkPackageName=None

  • nonce=None

  • apkDigestSha256=None

    • str of hex-values.
  • apkCertificateDigestSha256=None

    • Can be list of str or str.
  • check_basicIntegrity=True

  • check_ctsProfileMatch=True

  • hostname="attest.android.com"

    • Used for TLS validation of the certificate. Only modify if you know what you are doing.

A full explanation of the parameters above can be found at Google's SafetyNet documentation

Once a token has been verified, the following fields can be used:

  • header

    • A dictof the token's header.
  • body

    • A dict of the token's body.
  • certificates

    • A listof base64-decoded certificates present in the header.
  • public_key_pem

    • The public key of the certificate.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pySafetyNet-Attestation-0.0.5.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pySafetyNet_Attestation-0.0.5-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file pySafetyNet-Attestation-0.0.5.tar.gz.

File metadata

  • Download URL: pySafetyNet-Attestation-0.0.5.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.4.4

File hashes

Hashes for pySafetyNet-Attestation-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ce9e9da79f4d9e58b2e0fbe929d44df01ac5417562f4fe59beb65b16c286a066
MD5 f8ab1585c840dde8874a1ac5ee844ae6
BLAKE2b-256 ca421fa921784ae67db70a54e295ef0e137ffa57bd634b9a7dec5b5cde860b78

See more details on using hashes here.

File details

Details for the file pySafetyNet_Attestation-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pySafetyNet_Attestation-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.4.4

File hashes

Hashes for pySafetyNet_Attestation-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d40a28ecd0ce30cc376b0a2a088a4f8445ec2e7bf6b07d665d6c901e18723602
MD5 3b8d126a3ef61aa591d6beff771b2a07
BLAKE2b-256 c07b87d8b8abcd5ebd8ca664101ee115c915b2b063602cd7e864065373328c62

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page