Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Latest commit

 

History

History
117 lines (60 loc) · 3.79 KB

README.rst

File metadata and controls

117 lines (60 loc) · 3.79 KB

Google Cloud Key Management Service Python Samples

image

This directory contains samples for Google Cloud Key Management Service. The Cloud Key Management Service allows you to create, import, and manage cryptographic keys and perform cryptographic operations in a single centralized cloud service.

Setup

Install Dependencies

  1. Clone python-docs-samples and change directory to the sample directory you want to use.

    $ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
  2. Install pip and virtualenv if you do not already have them. You may want to refer to the Python Development Environment Setup Guide for Google Cloud Platform for instructions.

  3. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.

    $ virtualenv env
    $ source env/bin/activate

Samples

Verify attestations and certificate chains for keys generated by Cloud HSM

image

To run this sample:

$ python verify_attestation_chains.py

usage: verify_attestation_chains.py [-h] [--certificates CERTIFICATES]
                                    [--attestation ATTESTATION]

This application verifies HSM attestations using certificate chains
obtained from Cloud HSM and the HSM manufacturer.

For more information, visit https://cloud.google.com/kms/docs/attest-key.

optional arguments:
  -h, --help            show this help message and exit
  --certificates CERTIFICATES
                        The certificate chains filename.
  --attestation ATTESTATION
                        The attestation filename.

Verify attestations for keys generated by Cloud HSM

image

To run this sample:

$ python verify_attestation.py

usage: verify_attestation.py [-h] attestation_file bundle_file

This application verifies HSM attestations using certificate bundles obtained
from Cloud HSM. For more information, visit https://cloud.google.com/kms/docs
/attest-key.

positional arguments:
  attestation_file  Name of attestation file.
  bundle_file       Name of certificate bundle file.

optional arguments:
  -h, --help        show this help message and exit