Skip to content

Commit a411ed9

Browse files
bkuangBenson KuangTakashi Matsuo
authored
Add main function to attestation verification script (#3705)
* 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 <[email protected]> Co-authored-by: Takashi Matsuo <[email protected]>
1 parent bf73da5 commit a411ed9

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

kms/attestations/verify_attestation.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

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

2323
# [START verify_attestations]
24+
import argparse
2425
import gzip
2526

2627
from cryptography import exceptions
@@ -69,3 +70,17 @@ def verify(attestation_file, bundle_file):
6970
continue
7071
return False
7172
# [END verify_attestations]
73+
74+
75+
if __name__ == '__main__':
76+
parser = argparse.ArgumentParser(
77+
description=__doc__)
78+
parser.add_argument('attestation_file', help="Name of attestation file.")
79+
parser.add_argument('bundle_file', help="Name of certificate bundle file.")
80+
81+
args = parser.parse_args()
82+
83+
if verify(args.attestation_file, args.bundle_file):
84+
print('Signature verified.')
85+
else:
86+
print('Signature verification failed.')

0 commit comments

Comments
 (0)