// LoadTpmKeys loads the attestation key and the TLS key
LoadTpmKeys loads the attestation key and the TLS key
// LoadTpmKeys loads the attestation key and the TLS key
func LoadTpmKeys(akFile, tlsKeyFile string) error {
	if tpm == nil {
		return fmt.Errorf("Failed to load keys - TPM is not opened")
	}
	log.Debug("Loading TPM keys..")
	akBytes, err := ioutil.ReadFile(akFile)
	if err != nil {
		return fmt.Errorf("Load Keys failed: ReadFile %v returned %v", akFile, err)
	}
	ak, err = tpm.LoadAK(akBytes)
	if err != nil {
		return fmt.Errorf("LoadAK failed: %v", err)
	}
	log.Debug("Loaded AK")
	tlsKeyBytes, err := ioutil.ReadFile(tlsKeyFile)
	if err != nil {
		return fmt.Errorf("Load Key failed: ReadFile %v returned %v", tlsKeyFile, err)
	}
	tlsKey, err = tpm.LoadKey(tlsKeyBytes)
	if err != nil {
		return fmt.Errorf("LoadKey failed: %v", err)
	}
	log.Debug("Loaded TLS Key")
	return nil
}
func LoadTpmKeys ( akFile , tlsKeyFile string ) error { if tpm == nil { return fmt . Errorf ( " " ) } log . Debug ( " " ) akBytes , err := ioutil . ReadFile ( akFile ) if err != nil { return fmt . Errorf ( " " , akFile , err ) } ak , err = tpm . LoadAK ( akBytes ) if err != nil { return fmt . Errorf ( " " , err ) } log . Debug ( " " ) tlsKeyBytes , err := ioutil . ReadFile ( tlsKeyFile ) if err != nil { return fmt . Errorf ( " " , tlsKeyFile , err ) } tlsKey , err = tpm . LoadKey ( tlsKeyBytes ) if err != nil { return fmt . Errorf ( " " , err ) } log . Debug ( " " ) return nil }
LoadTpmKeys loads the attestation key and the TLS key
LoadTpmKeys loads the attestation key and the TLS key