private string JsonEncodePublishMsg(object originalMessage) { string message = jsonLib.SerializeToJsonString(originalMessage); if (pubnubConfig.CipherKey.Length > 0) { PubnubCrypto aes = new PubnubCrypto(pubnubConfig.CipherKey, pubnubConfig, pubnubLog); string encryptMessage = aes.Encrypt(message); message = jsonLib.SerializeToJsonString(encryptMessage); } return(message); }
public byte[] EncryptFile(byte[] inputBytes) { if (inputBytes == null) { throw new ArgumentException("inputBytes is not valid"); } if (pubnubConfig == null || string.IsNullOrEmpty(pubnubConfig.CipherKey)) { throw new MissingMemberException("CipherKey missing"); } PubnubCrypto pc = new PubnubCrypto(pubnubConfig.CipherKey); return(pc.Encrypt(inputBytes, true)); }
public string Encrypt(string inputString) { if (string.IsNullOrEmpty(inputString)) { throw new ArgumentException("inputString is not valid"); } if (pubnubConfig == null || string.IsNullOrEmpty(pubnubConfig.CipherKey)) { throw new Exception("CipherKey missing"); } PubnubCrypto pc = new PubnubCrypto(pubnubConfig.CipherKey); return(pc.Encrypt(inputString)); }
public byte[] EncryptFile(byte[] inputBytes, string cipherKey) { if (inputBytes == null) { throw new ArgumentException("inputBytes is not valid"); } if (pubnubConfig != null && !string.IsNullOrEmpty(pubnubConfig.CipherKey)) { //Ignore this. Added this condition to pass Codacy recommendation of making this as static method } PubnubCrypto pc = new PubnubCrypto(cipherKey); return(pc.Encrypt(inputBytes, true)); }