Documentation ¶
Index ¶
- func DecryptFile(cipherKey string, contentLenEnc int64, reader io.Reader, w io.WriteCloser)
- func DecryptString(cipherKey string, message string, useRandomInitializationVector bool) (retVal interface{}, err error)
- func EncodeJSONAsPathComponent(jsonBytes string) string
- func EncryptCipherKey(cipherKey string) []byte
- func EncryptFile(cipherKey string, iv []byte, filePart io.Writer, file *os.File)
- func EncryptString(cipherKey string, message string, useRandomInitializationVector bool) string
- func GetHmacSha256(secretKey string, input string) string
- func JoinChannels(channels []string) []byte
- func PamEncode(value string) string
- func PreparePamParams(params *url.Values) string
- func Serialize(msg interface{}) ([]byte, error)
- func SerializeAndEncrypt(msg interface{}, cipherKey string, serialize bool, ...) (string, error)
- func SerializeEncryptAndSerialize(msg interface{}, cipherKey string, serialize bool, ...) (string, error)
- func TestComplexClassDecryption(t *testing.T)
- func TestComplexClassEncryption(t *testing.T)
- func URLEncode(s string) string
- func UUID() string
- func ValueAsString(value interface{}) ([]byte, error)
- type A
- type B
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptFile ¶
func DecryptString ¶
func DecryptString(cipherKey string, message string, useRandomInitializationVector bool) ( retVal interface{}, err error)
DecryptString decodes encrypted string using the cipherKey
It accepts the following parameters: cipherKey: cipher key to use to decrypt. message: to encrypted. useRandomInitializationVector: if true the IV is random and is prepended to the text. The IV is extracted and then the cipher is decoded.
returns the unencoded encrypted string, error if any.
func EncodeJSONAsPathComponent ¶
encodeJSONAsPathComponent properly encodes serialized JSON for placement within a URI path
func EncryptCipherKey ¶
EncryptCipherKey creates the 256 bit hex of the cipher key
It accepts the following parameters: cipherKey: cipher key to use to decrypt.
returns the 256 bit hex of the cipher key.
func EncryptString ¶
EncryptString creates the base64 encoded encrypted string using the cipherKey. It accepts the following parameters: cipherKey: cipher key to use to encrypt. message: to encrypted. useRandomInitializationVector: if true the IV is random and is sent along with the message
returns the base64 encoded encrypted string.
func GetHmacSha256 ¶
getHmacSha256 creates the cipher key hashed against SHA256. It accepts the following parameters: secretKey: the secret key. input: input to hash.
returns the hash.
func JoinChannels ¶
JoinChannels encodes and joins channels
func PreparePamParams ¶
func SerializeAndEncrypt ¶
func TestComplexClassDecryption ¶
TestComplexClassDecryption tests the complex struct decryption. Decrypted string should match Bc846Ri5HK1ixqP/dzAyZq23Z/NBlcPn2UX8h38xTGINs72yF5gtU0t9fFEMxjY+DmezWt0nG7eN7RABrj697tK1nooVHYIxgDLMsjMTw5N0K+rUM823n7LcHfEoXaX8oH2E6zkg6iK5pmT8nlh6LF6Bw1G5zkluT8oTjnbFJcpEvTyT2ZKzcqptgYsE9XZiqgBMEfYqwphDzmOv+TjHkJai+paV0rzFxIfVK8KHCA14z+1kKDMPghlmzx2tUmmbQb04hjhvgDvvi3tknytYVqJo1L5jZkAZTVXRfed7wq+L+1V824c9AwVsG9iCv15/Jemjjfzk07MXawk+hjmQvjQDWLS/ww3vwkNXiuJITbVCPOBADwJhBnFqkkb/Hd8LaKwyFhWeXwoZWbqugDoYufUzJApf4Nl/4RthYoisqJIokmxiWvYeD1TuH+C457kDaEu3aJd+KdLf8k9QkmaDNqkZo9Z/BRkZ63oMna1aEBy7bSE3l/lw40dnhsMaYfYk
func TestComplexClassEncryption ¶
TestComplexClassEncryption tests the complex struct encryption. Encrypted string should match Bc846Ri5HK1ixqP/dzAyZq23Z/NBlcPn2UX8h38xTGINs72yF5gtU0t9fFEMxjY+DmezWt0nG7eN7RABrj697tK1nooVHYIxgDLMsjMTw5N0K+rUM823n7LcHfEoXaX8oH2E6zkg6iK5pmT8nlh6LF6Bw1G5zkluT8oTjnbFJcpEvTyT2ZKzcqptgYsE9XZiqgBMEfYqwphDzmOv+TjHkJai+paV0rzFxIfVK8KHCA14z+1kKDMPghlmzx2tUmmbQb04hjhvgDvvi3tknytYVqJo1L5jZkAZTVXRfed7wq+L+1V824c9AwVsG9iCv15/Jemjjfzk07MXawk+hjmQvjQDWLS/ww3vwkNXiuJITbVCPOBADwJhBnFqkkb/Hd8LaKwyFhWeXwoZWbqugDoYufUzJApf4Nl/4RthYoisqJIokmxiWvYeD1TuH+C457kDaEu3aJd+KdLf8k9QkmaDNqkZo9Z/BRkZ63oMna1aEBy7bSE3l/lw40dnhsMaYfYk
func ValueAsString ¶
PubNub - specific serializer