Documentation ¶
Index ¶
- Constants
- Variables
- func AESCBCPKCS7Decrypt(key, src []byte) ([]byte, error)
- func ArgsDecrypt(next router.ContextHandlerFunc, pos ...int) router.ContextHandlerFunc
- func ArgsDecryptExcept(exceptMethod ...string) router.ContextMiddlewareFunc
- func ArgsDecryptIfKeyProvided(next router.ContextHandlerFunc, pos ...int) router.ContextHandlerFunc
- func Decrypt(key, value []byte) ([]byte, error)
- func DecryptArgs(key []byte, args [][]byte) ([][]byte, error)
- func DecryptBytes(key, value []byte) ([]byte, error)
- func DecryptEvent(encKey []byte, event *peer.ChaincodeEvent) (decrypted *peer.ChaincodeEvent, err error)
- func EncStateContext(next router.HandlerFunc, pos ...int) router.HandlerFunc
- func EncStateContextIfKeyProvided(next router.HandlerFunc, pos ...int) router.HandlerFunc
- func Encrypt(key []byte, value interface{}) ([]byte, error)
- func EncryptArgs(key []byte, args ...interface{}) ([][]byte, error)
- func EncryptArgsBytes(key []byte, argsBytes [][]byte) ([][]byte, error)
- func EncryptBytes(key, value []byte) ([]byte, error)
- func EncryptEvent(encKey []byte, event *peer.ChaincodeEvent) (encrypted *peer.ChaincodeEvent, err error)
- func EncryptInvokeResponse() router.MiddlewareFunc
- func EncryptInvokeResponseIfKeyProvided() router.MiddlewareFunc
- func EncryptWithTransientKey(c router.Context, val interface{}) (encrypted []byte, err error)
- func Event(c router.Context, key []byte) (state.Event, error)
- func EventWithTransientKey(c router.Context) (state.Event, error)
- func EventWithTransientKeyIfProvided(c router.Context) (state.Event, error)
- func FromBytesDecryptor(key []byte) state.FromBytesTransformer
- func InvokeChaincode(stub shim.ChaincodeStubInterface, encKey []byte, chaincodeName string, ...) (interface{}, error)
- func KeyDecryptor(encryptKey []byte) state.KeyTransformer
- func KeyEncryptor(encryptKey []byte) state.KeyTransformer
- func KeyFromTransient(c router.Context) ([]byte, error)
- func MustDecryptEvent(encKey []byte, event *peer.ChaincodeEvent) *peer.ChaincodeEvent
- func MustEncryptEvent(encKey []byte, event *peer.ChaincodeEvent) *peer.ChaincodeEvent
- func State(c router.Context, key []byte) (state.State, error)
- func StateWithTransientKey(c router.Context) (state.State, error)
- func StateWithTransientKeyIfProvided(c router.Context) (state.State, error)
- func StringEncryptor(key []byte) state.StringTransformer
- func ToBytesEncryptor(key []byte) state.ToBytesTransformer
- func TransientMapWithKey(key []byte) map[string][]byte
Constants ¶
const TransientMapKey = `ENCODE_KEY`
Variables ¶
var ( // ErrKeyNotDefinedInTransientMap occurs when key not defined in transient map ErrKeyNotDefinedInTransientMap = errors.New(`encryption key is not defined in transient map`) )
Functions ¶
func AESCBCPKCS7Decrypt ¶ added in v0.6.9
AESCBCPKCS7Decrypt combines CBC decryption and PKCS7 unpadding
func ArgsDecrypt ¶ added in v0.3.1
func ArgsDecrypt(next router.ContextHandlerFunc, pos ...int) router.ContextHandlerFunc
ArgsDecryptIfKeyProvided - pre middleware, decrypts chaincode method arguments, key must be provided in transient map
func ArgsDecryptExcept ¶ added in v0.4.3
func ArgsDecryptExcept(exceptMethod ...string) router.ContextMiddlewareFunc
func ArgsDecryptIfKeyProvided ¶
func ArgsDecryptIfKeyProvided(next router.ContextHandlerFunc, pos ...int) router.ContextHandlerFunc
ArgsDecryptIfKeyProvided - pre middleware, decrypts chaincode method arguments if key provided in transient map
func DecryptArgs ¶
DecryptArgs decrypt args
func DecryptBytes ¶ added in v0.6.9
func DecryptEvent ¶ added in v0.4.5
func DecryptEvent(encKey []byte, event *peer.ChaincodeEvent) (decrypted *peer.ChaincodeEvent, err error)
DecryptEvent
func EncStateContext ¶ added in v0.4.1
func EncStateContext(next router.HandlerFunc, pos ...int) router.HandlerFunc
EncStateContext replaces default state with encrypted state
func EncStateContextIfKeyProvided ¶ added in v0.4.3
func EncStateContextIfKeyProvided(next router.HandlerFunc, pos ...int) router.HandlerFunc
EncStateContext replaces default state with encrypted state
func EncryptArgs ¶
EncryptArgs convert args to [][]byte and encrypt args with key
func EncryptArgsBytes ¶ added in v0.4.5
EncryptArgsBytes encrypt args with key
func EncryptBytes ¶ added in v0.6.9
func EncryptEvent ¶ added in v0.4.1
func EncryptEvent(encKey []byte, event *peer.ChaincodeEvent) (encrypted *peer.ChaincodeEvent, err error)
EncryptEvent encrypts event payload and event name. Event name also base64 encoded. ChaincodeId and TxId remains unencrypted
func EncryptInvokeResponse ¶ added in v0.5.3
func EncryptInvokeResponse() router.MiddlewareFunc
EncryptInvokeResponse returns middleware function for encrypt chaincode invocation response
func EncryptInvokeResponseIfKeyProvided ¶ added in v0.10.3
func EncryptInvokeResponseIfKeyProvided() router.MiddlewareFunc
EncryptInvokeResponseIfKeyProvided returns middleware function for encrypt chaincode invocation response if encryption key provided in transient map
func EncryptWithTransientKey ¶ added in v0.4.1
EncryptWithTransientKey encrypts val with key from transient map
func EventWithTransientKey ¶ added in v0.4.1
EventWithTransientKey creates encrypted event wrapper with provided key for symmetric encryption/decryption
func EventWithTransientKeyIfProvided ¶ added in v0.4.5
EventWithTransientKeyIfProvided returns encrypted event wrapper if key for symmetric encryption/decryption is provided, otherwise return default event wrapper
func FromBytesDecryptor ¶ added in v0.4.1
func FromBytesDecryptor(key []byte) state.FromBytesTransformer
FromBytesDecryptor returns state.FromBytesTransformer - used for decrypting data after reading from state
func InvokeChaincode ¶ added in v0.4.3
func InvokeChaincode( stub shim.ChaincodeStubInterface, encKey []byte, chaincodeName string, args []interface{}, channel string, target interface{}) (interface{}, error)
InvokeChaincode decrypts received payload
func KeyDecryptor ¶ added in v0.7.3
func KeyDecryptor(encryptKey []byte) state.KeyTransformer
KeyDecryptor decrypts state key
func KeyEncryptor ¶ added in v0.7.3
func KeyEncryptor(encryptKey []byte) state.KeyTransformer
KeyEncryptor encrypts state key
func KeyFromTransient ¶
KeyFromTransient gets key for encrypting/decrypting from transient map
func MustDecryptEvent ¶ added in v0.4.5
func MustDecryptEvent(encKey []byte, event *peer.ChaincodeEvent) *peer.ChaincodeEvent
MustDecryptEvent helper for DecryptEvent. Panics in case of error.
func MustEncryptEvent ¶ added in v0.4.1
func MustEncryptEvent(encKey []byte, event *peer.ChaincodeEvent) *peer.ChaincodeEvent
MustEncryptEvent helper for EncryptEvent. Panics in case of error.
func State ¶
State wrapper, encrypts the data before putting to state and decrypts the data after getting from state
func StateWithTransientKey ¶
StateWithTransientKey creates encrypted state state with provided key for symmetric encryption/decryption
func StateWithTransientKeyIfProvided ¶ added in v0.3.1
StateWithTransientKeyIfProvided creates encrypted state wrapper with provided key for symmetric encryption/decryption if key provided, otherwise - standard state wrapper without encryption
func StringEncryptor ¶ added in v0.4.1
func StringEncryptor(key []byte) state.StringTransformer
EncryptStringWith returns state.StringTransformer encrypting string with provided key
func ToBytesEncryptor ¶ added in v0.4.1
func ToBytesEncryptor(key []byte) state.ToBytesTransformer
ToBytesEncryptor returns state.ToBytesTransformer - used for encrypting data for state
func TransientMapWithKey ¶
TransientMapWithKey creates transient map with encrypting/decrypting key
Types ¶
This section is empty.