Documentation ¶
Overview ¶
Package client makes it possible to encrypt and decrypt messages using a monolithic cryptographic protocol.
CLIENT MESSAGE PROTOCOL Protocol participants: A - sender, B - receiver. Steps of participant A: 1. K = G( N ), R = G( N ), where G - generator pseudo random bytes, N - count of bytes for generator, K - encryption session key, R - pseudo random bytes (salt). 2. HP = H( R || P || PubKA || PubKB ), where HP - message hash, H - hash function, P - plaintext, PubKX - public key of X participant. 3. CP = [ E( PubKB, K ), E( K, PubKA ), E( K, R ), E( K, P ), E( K, HP ), E( K, S( PrivKA, HP ) ) ], where CP - encrypted message, E - encryption function, S - sign function, PrivKX - private key of X participant. Steps of participant B: 4. K = D( PrivKB, E( PubKB, K ) ), where D - decryption function. IF ≠, than protocol is interrupted. 5. PubKA = D( K, E( K, PubKA ) ). IF ≠, than protocol is interrupted. 6. HP = V( PubKA, D( K, E( K, S( PrivKA, D( K, E( K, HP) ) ) ) ) ), where V - signature verification function. IF ≠, than protocol is interrupted. 7. HP = H( D( K, E( K, R ) ) || D( K, E( K, P ) ) || PubKA || PubKB ), IF ≠, than protocol is interrupted. More information in article: https://github.com/number571/go-peer/blob/master/docs/monolithic_cryptographic_protocol.pdf Scheme: https://github.com/number571/go-peer/blob/master/images/go-peer_layer2_message.jpg
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLimitMessageSize = &SClientError{"limit message size"} ErrInitCheckMessage = &SClientError{"init check message"} ErrDecryptCipherKey = &SClientError{"decrypt cipher key"} ErrDecryptPublicKey = &SClientError{"decrypt public key"} ErrInvalidPublicKeySize = &SClientError{"invalid public key size"} ErrDecodePayloadWrapper = &SClientError{"decode payload wrapper"} ErrInvalidDataHash = &SClientError{"invalid data hash"} ErrInvalidHashSign = &SClientError{"invalid hash sign"} ErrInvalidPayloadSize = &SClientError{"invalid payload size"} ErrDecodePayload = &SClientError{"decode payload"} ErrEncryptSymmetricKey = &SClientError{"encrypt symmetric key"} )
Functions ¶
This section is empty.
Types ¶
type IClient ¶
type IClient interface { GetSettings() message.ISettings GetPubKey() asymmetric.IPubKey GetPrivKey() asymmetric.IPrivKey GetMessageLimit() uint64 EncryptPayload(asymmetric.IPubKey, payload.IPayload) (message.IMessage, error) DecryptMessage(message.IMessage) (asymmetric.IPubKey, payload.IPayload, error) }
type SClientError ¶ added in v1.6.8
type SClientError struct {
// contains filtered or unexported fields
}
func (*SClientError) Error ¶ added in v1.6.8
func (err *SClientError) Error() string
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
Package message used as a storage and loading of encrypted messages.
|
Package message used as a storage and loading of encrypted messages. |
Click to show internal directories.
Click to hide internal directories.