当前位置: 首页>>代码示例>>Golang>>正文


Golang Point.String方法代码示例

本文整理汇总了Golang中github.com/dedis/crypto/abstract.Point.String方法的典型用法代码示例。如果您正苦于以下问题:Golang Point.String方法的具体用法?Golang Point.String怎么用?Golang Point.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/dedis/crypto/abstract.Point的用法示例。


在下文中一共展示了Point.String方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: verifyCertificate

/* Verifies that a PolicyApproveMessage has been properly constructed.
 *
 * Arguments:
 *	su         = the suite that the insurer's public key was derived from.
 *      insuredKey = the public key of the insured or the client
 *      insurerKey = the public key of the insurer or "trustee"
 *
 * Returns:
 *	whether or not the message is valid.
 */
func (msg *PolicyApprovedMessage) verifyCertificate(su abstract.Suite,
	insuredKey abstract.Point) bool {

	set := anon.Set{msg.PubKey}
	_, err := anon.Verify(su, msg.Message, set, nil, msg.Signature)
	correctMsg := msg.PubKey.String() + " insures " + insuredKey.String()
	return err == nil && correctMsg == string(msg.Message)
}
开发者ID:ineiti,项目名称:prifi,代码行数:18,代码来源:policyMessage.go

示例2: NewServerIdentity

// NewServerIdentity creates a new ServerIdentity based on a public key and with a slice
// of IP-addresses where to find that entity. The Id is based on a
// version5-UUID which can include a URL that is based on it's public key.
func NewServerIdentity(public abstract.Point, addresses ...string) *ServerIdentity {
	url := NamespaceURL + "id/" + public.String()
	return &ServerIdentity{
		Public:    public,
		Addresses: addresses,
		ID:        ServerIdentityID(uuid.NewV5(uuid.NamespaceURL, url)),
	}
}
开发者ID:nikirill,项目名称:cothority,代码行数:11,代码来源:struct.go

示例3: AddConn

/* Adds a new connection to the connection manager
 *
 * Arguments:
 * 	theirkey = the key of the peer that this server wishes to connect to
 *
 * Returns:
 * 	An error denoting whether creating the new connection was successful.
 */
func (gcm *ChanConnManager) AddConn(theirKey abstract.Point) error {
	newConn, err := coconet.NewGoConn(gcm.dir, gcm.pubKey.String(),
		theirKey.String())
	if err != nil {
		return err
	}
	gcm.peerMap[theirKey.String()] = newConn
	return nil
}
开发者ID:ineiti,项目名称:prifi,代码行数:17,代码来源:chanConnManager.go

示例4: AddClient

func (c *Coordinator) AddClient(key abstract.Point, val *net.UDPAddr) {
	// delete the client who has same ip address
	for k, v := range c.Clients {
		if v.String() == val.String() {
			delete(c.Clients, k)
			break
		}
	}
	c.Clients[key.String()] = val
}
开发者ID:anonyreputation,项目名称:anonCred,代码行数:10,代码来源:Coordinator.go

示例5: createMessage

/* Creates a new policy-approved message
 *
 * Arguments:
 *	kp       = the private/public key of the insuring server.
 *      theirKey = the public key of the server who requested the insurance
 *
 * Returns:
 *	A new policy approved message.
 *
 * NOTE:
 *	The approved certificate is a string of the form:
 *     		"My_Public_Key insures Their_Public_Key"
 *
 *	It will always be of this form for easy validation.
 */
func (msg *PolicyApprovedMessage) createMessage(kp *config.KeyPair,
	theirKey abstract.Point) *PolicyApprovedMessage {

	set := anon.Set{kp.Public}
	approveMsg := kp.Public.String() + " insures " + theirKey.String()
	msg.PubKey = kp.Public
	msg.Message = []byte(approveMsg)
	msg.Signature = anon.Sign(kp.Suite, random.Stream, msg.Message,
		set, nil, 0, kp.Secret)
	return msg
}
开发者ID:ineiti,项目名称:prifi,代码行数:26,代码来源:policyMessage.go

示例6: Get

/* Get a message from a given peer.
 *
 * Arguments:
 *	 p = the public key of the origin
 *	 bum = a buffer for receiving the message
 *
 * Returns:
 *	An error denoting whether the get to the buffer was successfull
 */
func (gcm ChanConnManager) Get(p abstract.Point, bum coconet.BinaryUnmarshaler) error {
	return gcm.peerMap[p.String()].Get(bum)
}
开发者ID:ineiti,项目名称:prifi,代码行数:12,代码来源:chanConnManager.go

示例7: Put

/* Put a message to a given peer.
 *
 * Arguments:
 * 	p = the public key of the destination
 * 	data = the message to send
 *
 * Returns:
 * 	An error denoting whether the put was successfull
 */
func (gcm *ChanConnManager) Put(p abstract.Point, data coconet.BinaryMarshaler) error {
	return gcm.peerMap[p.String()].Put(data)
}
开发者ID:ineiti,项目名称:prifi,代码行数:12,代码来源:chanConnManager.go

示例8: AddIntoRepMap

func (c *Coordinator) AddIntoRepMap(key abstract.Point, val []byte) {
	keyStr := key.String()
	c.ReputationKeyMap[keyStr] = key
	c.ReputationMap[keyStr] = val
}
开发者ID:anonyreputation,项目名称:anonCred,代码行数:5,代码来源:Coordinator.go

示例9: AddIntoDecryptedMap

func (c *Coordinator) AddIntoDecryptedMap(key abstract.Point, val int) {
	keyStr := key.String()
	c.DecryptedKeysMap[keyStr] = key
	c.DecryptedReputationMap[keyStr] = val
}
开发者ID:anonyreputation,项目名称:anonCred,代码行数:5,代码来源:Coordinator.go

示例10: GetReputation

// get reputation
func (c *Coordinator) GetReputation(key abstract.Point) int {
	return c.DecryptedReputationMap[key.String()]
}
开发者ID:anonyreputation,项目名称:anonCred,代码行数:4,代码来源:Coordinator.go


注:本文中的github.com/dedis/crypto/abstract.Point.String方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。