public void Decrypt(SecretKeyEncryption ske, byte[] key) { KpCommon.ThrowIfNull(this.InnerMessageEnc); var bytes = ToBytes(this.InnerMessageEnc); bytes = ske.Decrypt(bytes !, key); this.InnerMessage = GrpcMsgPack.DynDes <Types.Inner>(bytes !); this.InnerMessageEnc = ByteString.Empty; }
public void Encrypt(SecretKeyEncryption ske, byte[] key) { KpCommon.ThrowIfNull(this.InnerMessage); var bytes = GrpcMsgPack.DynSer(this.InnerMessage); bytes = ske.Encrypt(bytes, key); this.InnerMessageEnc = FromBytes(bytes); this.InnerMessage = null; }