コード例 #1
0
ファイル: client_tca.go プロジェクト: masterDev1985/obc-peer
func (client *clientImpl) loadTCertOwnerKDFKey(pwd []byte) error {
	// Load TCertOwnerKDFKey
	client.node.log.Debug("Loading TCertOwnerKDFKey at [%s]...", client.node.conf.getTCertOwnerKDFKeyPath())

	missing, _ := utils.FilePathMissing(client.node.conf.getTCertOwnerKDFKeyPath())
	if missing {
		client.node.log.Debug("Failed loading TCertOwnerKDFKey. File is missing.")

		return nil
	}

	pem, err := ioutil.ReadFile(client.node.conf.getTCertOwnerKDFKeyPath())
	if err != nil {
		client.node.log.Error("Failed loading TCertOwnerKDFKey [%s].", err.Error())

		return err
	}

	tCertOwnerKDFKey, err := utils.PEMtoAES(pem, pwd)
	if err != nil {
		client.node.log.Error("Failed parsing TCertOwnerKDFKey [%s].", err.Error())

		return err
	}
	client.tCertOwnerKDFKey = tCertOwnerKDFKey

	client.node.log.Debug("Loading TCertOwnerKDFKey...done!")

	return nil
}
コード例 #2
0
ファイル: node_ks.go プロジェクト: butine/research
func (ks *keyStore) isAliasSet(alias string) bool {
	missing, _ := utils.FilePathMissing(ks.conf.getPathForAlias(alias))
	if missing {
		return false
	}

	return true
}