Example #1
0
        /// <summary>
        /// Encrypt array of bytes
        /// </summary>
        /// <param name="ToEncrypt">Data to encrypt</param>
        /// <returns></returns>
        public byte[] EncryptBytes(byte[] ToEncrypt)
        {
            byte[] arr = null;
            try
            {
                arr = Provider.Encrypt(ToEncrypt, false);
            }
            catch (Exception e)
            {
                EncryptError?.Invoke(this, new EncryptEventArgs($"Cannot encrypt. Message: {e.Message}"));
            }
            finally
            {
                if (arr == null)
                {
                    arr = new byte[0];
                }
            }

            return(arr);
        }
			public void onError(EncryptError.ErrorCode code, String message) {
				Fail("consume error " + code + ": " + message);
			}