Verify JWS-attestations from Google's SafetyNet.
Project description
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
apkCertificateDigestSha256=None
check_basicIntegrity=True
check_ctsProfileMatch=True
hostname="attest.android.com"
: Used for TLS validation of the certificate.
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
: Adict
of the token's header.body
: Adict
of the token's body.certificates
: Alist
of base64-decoded certificates present in theheader
.public_key_pem
: The public key of the certificate.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pySafetyNet-Attestation-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50889c410339571fe8611803a91c4c5a7037730f61316c7e7faeac41b156d3b0 |
|
MD5 | 50b00b3a14556bd1162f4f4c715a5f1a |
|
BLAKE2b-256 | 8e8cfcd42b7b10971f4128e76dcc01004306eda7be2d1e62ef5695ca36041cab |
Hashes for pySafetyNet_Attestation-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 689e80f05674635e38042e7976486e46c983b47f213ae68d6e4b92dcb99d8faf |
|
MD5 | 60d66e2ea3925b9e3842db199d1ae76b |
|
BLAKE2b-256 | 7a7c316131e7d5760b2c9cb78d360b277d8fb61b6db19b337f08fbee48287ccc |