Skip to content

Commit

Permalink
Add main function to attestation verification script [(#3705)](#3705)
Browse files Browse the repository at this point in the history
* Add main function to attestation verification script.

fixes #3704

* Add newline to end of file

* remove a blank line at the end

Co-authored-by: Benson Kuang <benkuang@google.com>
Co-authored-by: Takashi Matsuo <tmatsuo@google.com>
  • Loading branch information
3 people authored and rsamborski committed Nov 11, 2022
1 parent 7258954 commit 5646b13
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions kms/attestations/verify_attestation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

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

# [START verify_attestations]
import argparse
import gzip

from cryptography import exceptions
Expand Down Expand Up @@ -69,3 +70,17 @@ def verify(attestation_file, bundle_file):
continue
return False
# [END verify_attestations]


if __name__ == '__main__':
parser = argparse.ArgumentParser(
description=__doc__)
parser.add_argument('attestation_file', help="Name of attestation file.")
parser.add_argument('bundle_file', help="Name of certificate bundle file.")

args = parser.parse_args()

if verify(args.attestation_file, args.bundle_file):
print('Signature verified.')
else:
print('Signature verification failed.')

0 comments on commit 5646b13

Please sign in to comment.