ReplyGuy on wss://nostr.fmt.wiz.biz on Nostr: encrypt message platform independent. open source. Use and Share. windows only. as ...
encrypt message platform independent. open source. Use and Share. windows only. as easy as 1 2 3
1. Open the Notepad and Name the file > messageAES256.ps1> save
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
# Function to generate a 12-character strong password
function Generate-Password {
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()"
$password = -join ((65..90) + (97..122) + (48..57) + (33..47) | Get-Random -Count 12 | ForEach-Object { [char]$_ })
return $password
}
# Function to Encrypt the Message using AES-256
function Encrypt-Message {
param (
[string]$Message,
[string]$Password
)
# Ensure AES-256 by deriving a 32-byte (256-bit) key from the password
$key = [System.Text.Encoding]::UTF8.GetBytes($Password.PadRight(32).Substring(0,32))
$Aes = [System.Security.Cryptography.Aes]::Create()
$Aes.KeySize = 256 # Ensure AES-256 key size
$Aes.GenerateIV()
$Aes.Key = $key
$Encryptor = $Aes.CreateEncryptor()
$MessageBytes = [System.Text.Encoding]::UTF8.GetBytes($Message)
$EncryptedMessage = $Encryptor.TransformFinalBlock($MessageBytes, 0, $MessageBytes.Length)
# Return encrypted message as Base64 encoded string (IV + CipherText)
return [Convert]::ToBase64String($Aes.IV + $EncryptedMessage)
}
# Function to Decrypt the Message using AES-256
function Decrypt-Message {
param (
[string]$EncryptedMessage,
[string]$Password
)
# Ensure AES-256 by deriving a 32-byte (256-bit) key from the password
$key = [System.Text.Encoding]::UTF8.GetBytes($Password.PadRight(32).Substring(0,32))
$Aes = [System.Security.Cryptography.Aes]::Create()
$Aes.KeySize = 256 # Ensure AES-256 key size
$EncryptedBytes = [Convert]::FromBase64String($EncryptedMessage)
$IV = $EncryptedBytes[0..15] # Extract the IV (first 16 bytes)
$CipherText = $EncryptedBytes[16..($EncryptedBytes.Length - 1)]
$Aes.IV = $IV
$Aes.Key = $key
$Decryptor = $Aes.CreateDecryptor()
# Decrypt the message
$DecryptedMessage = $Decryptor.TransformFinalBlock($CipherText, 0, $CipherText.Length)
return [System.Text.Encoding]::UTF8.GetString($DecryptedMessage)
}
# Generate a password when the program opens
$generatedPassword = Generate-Password
# Create a Form
$form = New-Object system.Windows.Forms.Form
$form.Text = "AES-256 Encrypt/Decrypt"
$form.Size = New-Object System.Drawing.Size(450, 430) # Increased window size
$form.StartPosition = "CenterScreen"
# Add a warning label above the password field
$warningLabel = New-Object System.Windows.Forms.Label
$warningLabel.Text = "Share this password and this program > separated < with the message destination with caution."
$warningLabel.Location = New-Object System.Drawing.Point(10, 5)
$warningLabel.Size = New-Object System.Drawing.Size(420, 40)
$form.Controls.Add($warningLabel)
# Add an additional custom text if needed
$additionalTextLabel = New-Object System.Windows.Forms.Label
$additionalTextLabel.Text = "You can use the passord you already have or this new one."
$additionalTextLabel.Location = New-Object System.Drawing.Point(10, 40)
$additionalTextLabel.Size = New-Object System.Drawing.Size(420, 20)
$form.Controls.Add($additionalTextLabel)
# Create a Label for Password
$passwordLabel = New-Object System.Windows.Forms.Label
$passwordLabel.Text = "Password (Auto-Generated):"
$passwordLabel.Location = New-Object System.Drawing.Point(10, 70)
$passwordLabel.Size = New-Object System.Drawing.Size(150, 20)
$form.Controls.Add($passwordLabel)
# Create a TextBox for Password (pre-filled with the generated password, unmasked)
$passwordTextBox = New-Object System.Windows.Forms.TextBox
$passwordTextBox.Location = New-Object System.Drawing.Point(170, 70)
$passwordTextBox.Size = New-Object System.Drawing.Size(250, 20)
$passwordTextBox.Text = $generatedPassword
$form.Controls.Add($passwordTextBox)
# Create a Label for Message
$messageLabel = New-Object System.Windows.Forms.Label
$messageLabel.Text = "Message:"
$messageLabel.Location = New-Object System.Drawing.Point(10, 110)
$messageLabel.Size = New-Object System.Drawing.Size(100, 20)
$form.Controls.Add($messageLabel)
# Create a TextBox for Message
$messageTextBox = New-Object System.Windows.Forms.TextBox
$messageTextBox.Location = New-Object System.Drawing.Point(120, 110)
$messageTextBox.Size = New-Object System.Drawing.Size(300, 100)
$messageTextBox.Multiline = $true
$form.Controls.Add($messageTextBox)
# Create a Label for Result
$resultLabel = New-Object System.Windows.Forms.Label
$resultLabel.Text = "Result:"
$resultLabel.Location = New-Object System.Drawing.Point(10, 230)
$resultLabel.Size = New-Object System.Drawing.Size(100, 20)
$form.Controls.Add($resultLabel)
# Create a TextBox for Result (matching size and style to the message field)
$resultTextBox = New-Object System.Windows.Forms.TextBox
$resultTextBox.Location = New-Object System.Drawing.Point(120, 230)
$resultTextBox.Size = New-Object System.Drawing.Size(300, 100)
$resultTextBox.Multiline = $true
$form.Controls.Add($resultTextBox)
# Create an Encrypt Button
$encryptButton = New-Object System.Windows.Forms.Button
$encryptButton.Text = "Encrypt"
$encryptButton.Location = New-Object System.Drawing.Point(80, 350) # Adjusted location
$encryptButton.Size = New-Object System.Drawing.Size(100, 30)
$form.Controls.Add($encryptButton)
# Create a Decrypt Button
$decryptButton = New-Object System.Windows.Forms.Button
$decryptButton.Text = "Decrypt"
$decryptButton.Location = New-Object System.Drawing.Point(240, 350) # Adjusted location
$decryptButton.Size = New-Object System.Drawing.Size(100, 30)
$form.Controls.Add($decryptButton)
# Event Handler for Encrypt Button
$encryptButton.Add_Click({
$message = $messageTextBox.Text
$password = $passwordTextBox.Text
if (-not [string]::IsNullOrEmpty($message) -and -not [string]::IsNullOrEmpty($password)) {
$encryptedMessage = Encrypt-Message -Message $message -Password $password
$resultTextBox.Text = $encryptedMessage
} else {
[System.Windows.Forms.MessageBox]::Show("Please provide both a message and a password.", "Error")
}
})
# Event Handler for Decrypt Button
$decryptButton.Add_Click({
$encryptedMessage = $messageTextBox.Text
$password = $passwordTextBox.Text
if (-not [string]::IsNullOrEmpty($encryptedMessage) -and -not [string]::IsNullOrEmpty($password)) {
try {
$decryptedMessage = Decrypt-Message -EncryptedMessage $encryptedMessage -Password $password
$resultTextBox.Text = $decryptedMessage
} catch {
[System.Windows.Forms.MessageBox]::Show("Decryption failed. Check the message or password.", "Error")
}
} else {
[System.Windows.Forms.MessageBox]::Show("Please provide both an encrypted message and a password.", "Error")
}
})
# Show the Form
$form.ShowDialog()
2. Open the Notepad and Name the file > messageAES256.bat > save
@echo off
PowerShell -ExecutionPolicy Bypass -File .\messageAES256.ps1
pause
3. Double click on messageAES256.bat > ❤️ nostr.fmt.wiz.biz
Published at
2024-09-14 21:57:52Event JSON
{
"id": "6f677ccd4362538ac5a1adf5a1d6a3c68768894daba271df532875ff27b10163",
"pubkey": "12e76b724610cabba7d2db5f58266dab9be290e77f9e32fa2bc87304edb98265",
"created_at": 1726351072,
"kind": 1,
"tags": [
[
"e",
"05fc01cc92dcca8578918ae103fc70211fd65bcb4236b8a90e0ce99bb777a79e",
"wss://nostr.fmt.wiz.biz",
"root",
"4bbedfd26e39cb096063bfc635659bc9c6788627e8a3d2d23545c927041f9b5e"
],
[
"p",
"4bbedfd26e39cb096063bfc635659bc9c6788627e8a3d2d23545c927041f9b5e"
]
],
"content": "encrypt message platform independent. open source. Use and Share. windows only. as easy as 1 2 3\n\n1. Open the Notepad and Name the file \u003e messageAES256.ps1\u003e save\n\nAdd-Type -AssemblyName System.Windows.Forms\nAdd-Type -AssemblyName System.Drawing\n\n# Function to generate a 12-character strong password\nfunction Generate-Password {\n $chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^\u0026*()\"\n $password = -join ((65..90) + (97..122) + (48..57) + (33..47) | Get-Random -Count 12 | ForEach-Object { [char]$_ })\n return $password\n}\n\n# Function to Encrypt the Message using AES-256\nfunction Encrypt-Message {\n param (\n [string]$Message,\n [string]$Password\n )\n\n # Ensure AES-256 by deriving a 32-byte (256-bit) key from the password\n $key = [System.Text.Encoding]::UTF8.GetBytes($Password.PadRight(32).Substring(0,32))\n $Aes = [System.Security.Cryptography.Aes]::Create()\n $Aes.KeySize = 256 # Ensure AES-256 key size\n $Aes.GenerateIV()\n\n $Aes.Key = $key\n $Encryptor = $Aes.CreateEncryptor()\n $MessageBytes = [System.Text.Encoding]::UTF8.GetBytes($Message)\n $EncryptedMessage = $Encryptor.TransformFinalBlock($MessageBytes, 0, $MessageBytes.Length)\n\n # Return encrypted message as Base64 encoded string (IV + CipherText)\n return [Convert]::ToBase64String($Aes.IV + $EncryptedMessage)\n}\n\n# Function to Decrypt the Message using AES-256\nfunction Decrypt-Message {\n param (\n [string]$EncryptedMessage,\n [string]$Password\n )\n\n # Ensure AES-256 by deriving a 32-byte (256-bit) key from the password\n $key = [System.Text.Encoding]::UTF8.GetBytes($Password.PadRight(32).Substring(0,32))\n $Aes = [System.Security.Cryptography.Aes]::Create()\n $Aes.KeySize = 256 # Ensure AES-256 key size\n\n $EncryptedBytes = [Convert]::FromBase64String($EncryptedMessage)\n $IV = $EncryptedBytes[0..15] # Extract the IV (first 16 bytes)\n $CipherText = $EncryptedBytes[16..($EncryptedBytes.Length - 1)]\n\n $Aes.IV = $IV\n $Aes.Key = $key\n $Decryptor = $Aes.CreateDecryptor()\n\n # Decrypt the message\n $DecryptedMessage = $Decryptor.TransformFinalBlock($CipherText, 0, $CipherText.Length)\n return [System.Text.Encoding]::UTF8.GetString($DecryptedMessage)\n}\n\n# Generate a password when the program opens\n$generatedPassword = Generate-Password\n\n# Create a Form\n$form = New-Object system.Windows.Forms.Form\n$form.Text = \"AES-256 Encrypt/Decrypt\"\n$form.Size = New-Object System.Drawing.Size(450, 430) # Increased window size\n$form.StartPosition = \"CenterScreen\"\n\n# Add a warning label above the password field\n$warningLabel = New-Object System.Windows.Forms.Label\n$warningLabel.Text = \"Share this password and this program \u003e separated \u003c with the message destination with caution.\"\n$warningLabel.Location = New-Object System.Drawing.Point(10, 5)\n$warningLabel.Size = New-Object System.Drawing.Size(420, 40)\n$form.Controls.Add($warningLabel) \n\n# Add an additional custom text if needed\n$additionalTextLabel = New-Object System.Windows.Forms.Label\n$additionalTextLabel.Text = \"You can use the passord you already have or this new one.\"\n$additionalTextLabel.Location = New-Object System.Drawing.Point(10, 40)\n$additionalTextLabel.Size = New-Object System.Drawing.Size(420, 20)\n$form.Controls.Add($additionalTextLabel)\n\n# Create a Label for Password\n$passwordLabel = New-Object System.Windows.Forms.Label\n$passwordLabel.Text = \"Password (Auto-Generated):\"\n$passwordLabel.Location = New-Object System.Drawing.Point(10, 70)\n$passwordLabel.Size = New-Object System.Drawing.Size(150, 20)\n$form.Controls.Add($passwordLabel)\n\n# Create a TextBox for Password (pre-filled with the generated password, unmasked)\n$passwordTextBox = New-Object System.Windows.Forms.TextBox\n$passwordTextBox.Location = New-Object System.Drawing.Point(170, 70)\n$passwordTextBox.Size = New-Object System.Drawing.Size(250, 20)\n$passwordTextBox.Text = $generatedPassword\n$form.Controls.Add($passwordTextBox)\n\n# Create a Label for Message\n$messageLabel = New-Object System.Windows.Forms.Label\n$messageLabel.Text = \"Message:\"\n$messageLabel.Location = New-Object System.Drawing.Point(10, 110)\n$messageLabel.Size = New-Object System.Drawing.Size(100, 20)\n$form.Controls.Add($messageLabel)\n\n# Create a TextBox for Message\n$messageTextBox = New-Object System.Windows.Forms.TextBox\n$messageTextBox.Location = New-Object System.Drawing.Point(120, 110)\n$messageTextBox.Size = New-Object System.Drawing.Size(300, 100)\n$messageTextBox.Multiline = $true\n$form.Controls.Add($messageTextBox)\n\n# Create a Label for Result\n$resultLabel = New-Object System.Windows.Forms.Label\n$resultLabel.Text = \"Result:\"\n$resultLabel.Location = New-Object System.Drawing.Point(10, 230)\n$resultLabel.Size = New-Object System.Drawing.Size(100, 20)\n$form.Controls.Add($resultLabel)\n\n# Create a TextBox for Result (matching size and style to the message field)\n$resultTextBox = New-Object System.Windows.Forms.TextBox\n$resultTextBox.Location = New-Object System.Drawing.Point(120, 230)\n$resultTextBox.Size = New-Object System.Drawing.Size(300, 100)\n$resultTextBox.Multiline = $true\n$form.Controls.Add($resultTextBox)\n\n# Create an Encrypt Button\n$encryptButton = New-Object System.Windows.Forms.Button\n$encryptButton.Text = \"Encrypt\"\n$encryptButton.Location = New-Object System.Drawing.Point(80, 350) # Adjusted location\n$encryptButton.Size = New-Object System.Drawing.Size(100, 30)\n$form.Controls.Add($encryptButton)\n\n# Create a Decrypt Button\n$decryptButton = New-Object System.Windows.Forms.Button\n$decryptButton.Text = \"Decrypt\"\n$decryptButton.Location = New-Object System.Drawing.Point(240, 350) # Adjusted location\n$decryptButton.Size = New-Object System.Drawing.Size(100, 30)\n$form.Controls.Add($decryptButton)\n\n# Event Handler for Encrypt Button\n$encryptButton.Add_Click({\n $message = $messageTextBox.Text\n $password = $passwordTextBox.Text\n\n if (-not [string]::IsNullOrEmpty($message) -and -not [string]::IsNullOrEmpty($password)) {\n $encryptedMessage = Encrypt-Message -Message $message -Password $password\n $resultTextBox.Text = $encryptedMessage\n } else {\n [System.Windows.Forms.MessageBox]::Show(\"Please provide both a message and a password.\", \"Error\")\n }\n})\n\n# Event Handler for Decrypt Button\n$decryptButton.Add_Click({\n $encryptedMessage = $messageTextBox.Text\n $password = $passwordTextBox.Text\n\n if (-not [string]::IsNullOrEmpty($encryptedMessage) -and -not [string]::IsNullOrEmpty($password)) {\n try {\n $decryptedMessage = Decrypt-Message -EncryptedMessage $encryptedMessage -Password $password\n $resultTextBox.Text = $decryptedMessage\n } catch {\n [System.Windows.Forms.MessageBox]::Show(\"Decryption failed. Check the message or password.\", \"Error\")\n }\n } else {\n [System.Windows.Forms.MessageBox]::Show(\"Please provide both an encrypted message and a password.\", \"Error\")\n }\n})\n\n# Show the Form\n$form.ShowDialog()\n\n2. Open the Notepad and Name the file \u003e messageAES256.bat \u003e save\n\n@echo off\nPowerShell -ExecutionPolicy Bypass -File .\\messageAES256.ps1\npause\n\n3. Double click on messageAES256.bat \u003e ❤️ nostr.fmt.wiz.biz",
"sig": "6e145117373be4ebc1c831e68629c80ab62165c81c3dcdc7038ec614bfbeeff64d8d6a12c1d704976bebae344a036645898b8e2552148bea2b691efb9e5c7673"
}