Task #2242
Updated by Yingdi Yu about 10 years ago
It would be desired to pair up a TPM with a PublicInfoBase, so that when KeyChain loads a PublicInfoBase, the corresponding TPM will be loaded as well. As a result, user does not have to explicitly specify both TPM and PublicInfoBase. Instead, user only needs to specify a PublicInfoBase, so that it is guaranteed that the corresponding TPM will be loaded, and for any key that is described in PublicInfoBase, its private part can be found in the TPM. This can avoid the "Private key does not exist" problem due to wrong configuration. To enable this feature, we need to define a TpmInfo data structure: enum TpmType TPM_TYPE { TPM_TYPE_FILE = 0, 1, TPM_TYPE_OSX = 1, 2, // we can define more TPM types when necessary, e.g., TPM_TYPE_DUMMY for dummy tpm }; struct TpmInfo { TPM_TYPE type; std::string path; // Note, this does not have to be a path, it could encode any information about how the TPM can be loaded. }; And we also need to add two more method in SecPublicInfo: void SecPublicInfo::setTpmPath(const TpmInfo& path); TpmInfo SecPublicInfo::getTpmPath(); The first method is used to associate a TPM to the PublicInfoBase. The second method can be used by KeyChain to get the TpmInfo from SecPublicInfo, and use that to load the corresponding TPM.