Update: There is a more secure version available. Details
<?php
$plaintext = 'My secret message 1234';
// you need this in your cargo.toml | |
// reqwest = { version = "0.11.3", features = ["stream"] } | |
// futures-util = "0.3.14" | |
// indicatif = "0.15.0" | |
use std::cmp::min; | |
use std::fs::File; | |
use std::io::Write; | |
use reqwest::Client; | |
use indicatif::{ProgressBar, ProgressStyle}; |
using Org.BouncyCastle.Crypto; | |
using Org.BouncyCastle.Crypto.Parameters; | |
using Org.BouncyCastle.OpenSsl; | |
using Org.BouncyCastle.Security; | |
using System; | |
using System.IO; | |
using System.Security.Cryptography; | |
namespace MyProject.Data.Encryption | |
{ |
@echo off | |
fltmc >nul 2>&1 || ( | |
echo This batch script requires administrator privileges. Right-click on | |
echo the script and select "Run as administrator". | |
goto :die | |
) | |
rem Change this path if you are using Community or Professional editions | |
set "VS_INSTALL_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise" |
Update: There is a more secure version available. Details
<?php
$plaintext = 'My secret message 1234';
<?php | |
// DEFINE our cipher | |
define('AES_256_CBC', 'aes-256-cbc'); | |
// Generate a 256-bit encryption key | |
// This should be stored somewhere instead of recreating it each time | |
$encryption_key = openssl_random_pseudo_bytes(32); | |
// Generate an initialization vector | |
// This *MUST* be available for decryption as well |
using System; | |
using System.IO; | |
using System.Security.Cryptography; | |
using System.Text; | |
class AES | |
{ | |
public static string Encrypt(string plainText, string keyString) | |
{ | |
byte[] cipherData; |