github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/go/tpm2/tpm2_apps/PolicyKey/MakePolicyKey.go (about) 1 // Copyright (c) 2014, Google, Inc. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 16 package main 17 18 import ( 19 "flag" 20 "log" 21 22 "github.com/jlmucb/cloudproxy/go/tao" 23 ) 24 25 var ( 26 // TODO(jlm): Policy key is always ECDSA for now but the key type should be 27 // specified and we should support other types. 28 keySize = flag.Int("modulus size", 2048, "Modulus size for keys") 29 // TODO(jlm): The default value here is probably wrong. 30 policyKeyFile = flag.String("Policy save file", "policy.go.bin", 31 "policy save file") 32 // TODO(jlm): Should this be "xxx" to be consistent with other examples? 33 policyKeyPassword = flag.String("Policy key password", "xxx", 34 "policy key password") 35 // TODO(jlm): The default value here is probably wrong. 36 policyCertFile = flag.String("Policy cert save file", "policy.cert.go.der", 37 "policy cert save file") 38 ) 39 40 // This program creates a key hierarchy consisting of a 41 // primary key, and quoting key for cloudproxy 42 // and makes their handles permanent. 43 func main() { 44 flag.Parse() 45 err := tao.HandlePolicyKey(*keySize, *policyKeyFile, *policyKeyPassword, *policyCertFile) 46 if err != nil { 47 log.Fatal(err) 48 } 49 }