{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package gossip\n\n## Functions\n\n```go\nfunc NewSecurityAdvisor(deserializer mgmt.DeserializersManager) api.SecurityAdvisor\n```\nNewSecurityAdvisor creates a new instance of mspSecurityAdvisor that implements MessageCryptoService\n\n## Types\n\n```go\ntype MSPMessageCryptoService struct {\n\t// contains filtered or unexported fields\n}\n```\nMSPMessageCryptoService implements the MessageCryptoService interface using the peer MSPs (local and channel-related)\n\nIn order for the system to be secure it is vital to have the MSPs to be up-to-date. Channels' MSPs are updated via configuration transactions distributed by the ordering service.\n\nA similar mechanism needs to be in place to update the local MSP, as well. This implementation assumes that these mechanisms are all in place and working.\n\n```go\nfunc NewMCS(channelPolicyManagerGetter policies.ChannelPolicyManagerGetter, localSigner crypto.LocalSigner, deserializer mgmt.DeserializersManager) *MSPMessageCryptoService\n```\nNewMCS creates a new instance of MSPMessageCryptoService that implements MessageCryptoService. The method takes in input: 1. a policies.ChannelPolicyManagerGetter that gives access to the policy manager of a given channel via the Manager method. 2. an instance of crypto.LocalSigner 3. an identity deserializer manager\n\n```go\nfunc (s *MSPMessageCryptoService) Expiration(peerIdentity api.PeerIdentityType) (time.Time, error)\n```\n\n```go\nfunc (s *MSPMessageCryptoService) GetPKIidOfCert(peerIdentity api.PeerIdentityType) common.PKIidType\n```\nGetPKIidOfCert returns the PKI-ID of a peer's identity If any error occurs, the method return nil The PKid of a peer is computed as the SHA2-256 of peerIdentity which is supposed to be the serialized version of MSP identity. This method does not validate peerIdentity. This validation is supposed to be done appropriately during the execution flow.\n\n```go\nfunc (s *MSPMessageCryptoService) Sign(msg []byte) ([]byte, error)\n```\nSign signs msg with this peer's signing key and outputs the signature if no error occurred.\n\n```go\nfunc (s *MSPMessageCryptoService) ValidateIdentity(peerIdentity api.PeerIdentityType) error\n```\nValidateIdentity validates the identity of a remote peer. If the identity is invalid, revoked, expired it returns an error. Else, returns nil\n\n```go\nfunc (s *MSPMessageCryptoService) Verify(peerIdentity api.PeerIdentityType, signature, message []byte) error\n```\nVerify checks that signature is a valid signature of message under a peer's verification key. If the verification succeeded, Verify returns nil meaning no error occurred. If peerIdentity is nil, then the verification fails.\n\n```go\nfunc (s *MSPMessageCryptoService) VerifyBlock(chainID common.ChainID, seqNum uint64, signedBlock []byte) error\n```\nVerifyBlock returns nil if the block is properly signed, and the claimed seqNum is the sequence number that the block's header contains. else returns error\n\n```go\nfunc (s *MSPMessageCryptoService) VerifyByChannel(chainID common.ChainID, peerIdentity api.PeerIdentityType, signature, message []byte) error\n```\nVerifyByChannel checks that signature is a valid signature of message under a peer's verification key, but also in the context of a specific channel. If the verification succeeded, Verify returns nil meaning no error occurred. If peerIdentity is nil, then the verification fails.\n\n","path":"github.com/eric-erki/https-hyperledger.org/peer/gossip","name":"gossip","synopsis":"","isRedistributable":true}
