Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/22/2025 in all areas

  1. @kroman82 I have uploaded a new version of CryptoNG. The new version includes a function (_CryptoNG_RSA_CreateKeyPairEx) that will export both types of blob files (RSA and MS/Legacy). The RSA blob files are needed by Microsoft's CryptoNG API's (which are what my UDF creates wrappers for). The MS blob files can be used to generate PEM or DER files that can be used with OpenSSL or any other crypto library that has RSA functions. Here is an updated CryptoNG example that uses the new function: Func rsa_public_private_key_encrypt_decrypt_data_example() Const $ALG_ID = $CNG_BCRYPT_RSA_ALGORITHM, _ $MESSAGE = "This is a super-secret message.", _ $RSA_PUBLIC_KEY_FILE = "rsa_publickey.blob", _ $RSA_PRIVATE_KEY_FILE = "rsa_privatekey.blob", _ $MS_PUBLIC_KEY_FILE = "ms_publickey.blob", _ $MS_PRIVATE_KEY_FILE = "ms_privatekey.blob" Local $sDecryptedMessage = "" Local $xEncryptedMessage = Binary("") ;Create RSA Public/Private Key Pair _CryptoNG_RSA_CreateKeyPairEx(1024, $RSA_PUBLIC_KEY_FILE, $RSA_PRIVATE_KEY_FILE, $MS_PUBLIC_KEY_FILE, $MS_PRIVATE_KEY_FILE) If @error Then write_to_log("ERROR: " & _CryptoNG_LastErrorMessage() & @CRLF) Return False EndIf ;Encrypt plain text message $xEncryptedMessage = _CryptoNG_RSA_EncryptData($MESSAGE, $RSA_PUBLIC_KEY_FILE) If @error Then write_to_log("ERROR: " & _CryptoNG_LastErrorMessage() & @CRLF) Return False EndIf ;Decrypt encrypted message $sDecryptedMessage = _CryptoNG_RSA_DecryptData($xEncryptedMessage, $RSA_PRIVATE_KEY_FILE) If @error Then write_to_log("ERROR: " & _CryptoNG_LastErrorMessage() & @CRLF) Return False EndIf ;Display results write_to_log(@CRLF) write_to_log("CryptoNG Asymmetric Public/Private Key Encrypt/Decrypt Example" & @CRLF) write_to_log(StringFormat("%s Public key file = %s", $ALG_ID, $RSA_PUBLIC_KEY_FILE) & @CRLF) write_to_log(StringFormat("%s Private key file = %s", $ALG_ID, $RSA_PRIVATE_KEY_FILE) & @CRLF) write_to_log(StringFormat("%s Plain text message = %s", $ALG_ID, $MESSAGE) & @CRLF) write_to_log(StringFormat("%s Encrypted Message = %s", $ALG_ID, $xEncryptedMessage) & @CRLF) write_to_log(StringFormat("%s Decrypted Message = %s", $ALG_ID, $sDecryptedMessage) & @CRLF) EndFunc Result: CryptoNG UDF v2.3.0 CryptoNG Asymmetric Public/Private Key Encrypt/Decrypt Example RSA Public key file = rsa_publickey.blob RSA Private key file = rsa_privatekey.blob RSA Plain text message = This is a super-secret message. RSA Encrypted Message = 0x09240F7929B217338E10B94C6B481027C61B1C41080A806C02019A724B06991190BEFF5A27FBF17E0E6550067FAEAAB504936B2F4A55C0C2CC37F788B18C276CC31DCD339A5084FFF66A12E9598EF79432975EEE7A347F899AA38661B2FF3330418882F29A8B52012D8B57B85CF4DBD9924D7C606BE3A056FD66295B2D139B32 RSA Decrypted Message = This is a super-secret message. Done Upon successful execution of _CryptoNG_RSA_CreateKeyPairEx(), you should see the 4 blob files. To create PEM public/private key files for use by your server or other RSA crypto library functions, you can use OpenSSL to create PEM files like this. You can also create DER files by changing the -outform parameter. OpenSSL commands to convert MS KEYBLOB files to PEM files ---------------------------------------------------------- openssl rsa -pubin -inform "MS PUBLICKEYBLOB" -in ms_publickey.blob -outform PEM -out ms_publickey.pem openssl rsa -inform "MS PRIVATEKEYBLOB" -in ms_privatekey.blob -outform PEM -out ms_privatekey.pem
    2 points
  2. Version v2.4.0

    1,538 downloads

    Encryption / Decryption / Hashing / Signing Purpose Cryptography API: Next Generation (CNG) is Microsoft's long-term replacement for their CryptoAPI. Microsoft's CNG is designed to be extensible at many levels and cryptography agnostic in behavior. Although the Crypt.au3 UDF lib that is installed with AutoIt3 still works well, the advapi32.dll functions that it uses have been deprecated. In addition the Crypt.au3 UDF lib, as it is currently written, has a very limited ability to decrypt AES data that was not encrypted using Crypt.au3 functions. That is because Crypt.au3 functions do not allow you to specify an actual key or initialization vector (IV). It only lets you specify data to be used to derive a key and uses a static IV. This UDF was created to offer a replacement for the deprecated functions used by Crypt.au3. According to Microsoft, deprecated functions may be removed in future release. It was also created to allow more flexibility and functionality in encryption/decryption/hashing/signing and to expand the ability for users to implement cryptography in their scripts. Description This UDF implements some of Microsoft's Cryptography API: Next Generation (CNG) Win32 API functions. It implements functions to encrypt/decrypt text and files, generate hashes, derive keys using Password-Based Key Derivation Function 2 (PBKDF2), create and verify signatures, and has several cryptography-related helper functions. The UDF can implement any encryption/decryption algorithms and hashing algorithms that are supported by the installed cryptography providers on the PC in which it is running. Most, if not all, of the "magic number" values that you would commonly use to specify that desired algorithms, key bit lengths, and other magic number type values, are already defined as constants or enums in the UDF file. To flatten the learning curve, there is an example file that shows examples of all of the major functionality. This example file is not created to be an exhaustive set of how to implement each feature and parameter. It is designed to give you a template or guide to help you hit the ground running in terms of using the functions. I have tried to fully document the headers of all of the functions as well as the code within the functions themselves. As of v1.4.0, there is also a Help file that includes all of the functions, with examples. Current UDF Functions Algorithm-Specific Symmetric Encryption/Decryption Functions _CryptoNG_AES_CBC_EncryptData _CryptoNG_AES_CBC_DecryptData _CryptoNG_AES_CBC_EncryptFile _CryptoNG_AES_CBC_DecryptFile _CryptoNG_AES_ECB_EncryptData _CryptoNG_AES_ECB_DecryptData _CryptoNG_AES_GCM_EncryptData _CryptoNG_AES_GCM_DecryptData _CryptoNG_3DES_CBC_EncryptData _CryptoNG_3DES_CBC_DecryptData _CryptoNG_3DES_CBC_EncryptFile _CryptoNG_3DES_CBC_DecryptFile Generic Symmetric Encryption/Decryption Functions _CryptoNG_EncryptData _CryptoNG_DecryptData _CryptoNG_EncryptFile _CryptoNG_DecryptFile Hashing Functions _CryptoNG_HashData _CryptoNG_HashFile _CryptoNG_PBKDF2 Asymmetric (Public/Private Key) Cryptography Functions _CryptoNG_ECDSA_CreateKeyPair _CryptoNG_ECDSA_SignHash _CryptoNG_ECDSA_VerifySignature _CryptoNG_RSA_CreateKeyPair _CryptoNG_RSA_CreateKeyPairEx _CryptoNG_RSA_EncryptData _CryptoNG_RSA_DecryptData _CryptoNG_RSA_SignHash _CryptoNG_RSA_VerifySignature Misc / Helper Functions _CryptoNG_CryptBinaryToString _CryptoNG_CryptStringToBinary _CryptoNG_GenerateRandom _CryptoNG_EnumAlgorithms _CryptoNG_EnumRegisteredProviders _CryptoNG_EnumKeyStorageProviders _CryptoNG_LastErrorMessage _CryptoNG_Version Related Links Cryptography API: Next Generation - Main Page Cryptography API: Next Generation - Reference Cryptography API: Next Generation - Primitives Cryptography API: Next Generation - Cryptographic Algorithm Providers
    1 point
  3. Moi

    Playlist Maker [v2] (.m3u)

    Hello, a little add : Dir (scan directory) #include <GUIConstantsEx.au3> #include <ListboxConstants.au3> #Include <GuiListBox.au3> #include <WindowsConstants.au3> #include <String.au3> ;HotKeySet("!o", "_ArDisplay") Opt('MustDeclareVars', 1) Global $guictrl[9] Global $files[1] Global $arraypos = 0 Global $last_selected Global $name = "playlist.m3u" _main() Func _main() Local $msg Local $title = "M3U Creator" GUICreate($title, 700, 250) GUISetFont(7.5) GUISetState(@SW_SHOW) $guictrl[0] = GUICtrlCreateButton("Import", 10, 10, 45) $guictrl[1] = GUICtrlCreateList("", 65, 10, 625, 225, BitOR($WS_HSCROLL, $WS_VSCROLL, $LBS_EXTENDEDSEL)) $guictrl[2] = GUICtrlCreateButton("Add ", 10, 40, 45) $guictrl[3] = GUICtrlCreateButton("Dir", 10, 70, 45) $guictrl[4] = GUICtrlCreateButton("Save ", 10, 100, 45) $guictrl[5] = GUICtrlCreateButton("Delete ", 10, 130, 45) $guictrl[6] = GUICtrlCreateButton(" ^ ", 20, 160, 25) $guictrl[7] = GUICtrlCreateButton(" v ", 20, 190, 25) $guictrl[8] = GUICtrlCreateButton("Clear", 10, 220, 45) GUICtrlSetFont($guictrl[1], 8.5, "", "", "Courier New") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $guictrl[0] _Import() Case $msg = $guictrl[2] _OpenDialog() Case $msg = $guictrl[3] _FolderScan() Case $msg = $guictrl[4] _Save($title) Case $msg = $guictrl[5] _Delete() Case $msg = $guictrl[6] _MoveUp() Case $msg = $guictrl[7] _MoveDown() Case $msg = $guictrl[8] _ClearArray() EndSelect WEnd GUIDelete() EndFunc Func _Import() Local $import Local $i = 0 Local $filesize Local $k = 0 Local $skip = 0 $import = FileOpenDialog("Select M3U file.", @WorkingDir, "Playlist (*.M3U)") $i = FileGetSize($import) - 1 If @error Or $i = -1 Then MsgBox("", "Error", "File is empty") Return EndIf $filesize = StringLen(StringAddCR(FileRead($import, $i))) - $i + 1 $i = 0 Local $temp[$filesize] While $i < $filesize $skip = 0 $k = 0 $temp[$i] = FileReadLine($import, $i + 1) If StringInStr($temp[$i], "\") Then Else $temp[$i] = _StringInsert($temp[$i], @WorkingDir & "\", 0) EndIf While $k < $arraypos If $temp[$i] = $files[$k] Then MsgBox(0, "", '"' & $temp[$i] & '" is already in the library') $skip = 1 EndIf $k += 1 WEnd $k = 0 If $skip = 0 Then ; Redimensionner le tableau si nécessaire If $arraypos >= UBound($files) Then ReDim $files[$arraypos + 100] EndIf $files[$arraypos] = $temp[$i] $arraypos += 1 EndIf $i += 1 WEnd _UpdateList() EndFunc Func _OpenDialog() Local $odfile Local $pos Local $i = 1 Local $k = 0 Local $temp[200] Local $skip = 0 $odfile = FileOpenDialog("Select Files", @WorkingDir, "Music (*.MP3; *.WMA; *.ASF; *.AC3; *.FLAC; *.OGG;*.M4A; *.MKA; *.TTA; *.WV; *.WAV)", 4) If @error Then Return If StringInStr($odfile, "|") Then $temp = StringSplit($odfile, "|") While $i < $temp[0] $skip = 0 While $k < $arraypos If $temp[1] & "\" & $temp[$i + 1] = $files[$k] Then MsgBox(0, "", '"' & $temp[$i + 1] & '" is already in the library') $skip = 1 EndIf $k += 1 WEnd $k = 0 If $skip = 0 Then ; Redimensionner le tableau si nécessaire If $arraypos >= UBound($files) Then ReDim $files[$arraypos + 100] ; Augmente de 100 à chaque fois EndIf $files[$arraypos] = $temp[1] & "\" & $temp[$i + 1] $arraypos += 1 EndIf $i += 1 WEnd Else While $k < $arraypos If $odfile = $files[$k] Then MsgBox(0, "", '"' & $odfile & '" is already in the library') $skip = 1 EndIf $k += 1 WEnd $k = 0 If $skip = 0 Then ; Redimensionner le tableau si nécessaire If $arraypos >= UBound($files) Then ReDim $files[$arraypos + 100] ; Augmente de 100 à chaque fois EndIf $files[$arraypos] = $odfile $arraypos += 1 EndIf EndIf _UpdateList() EndFunc Func _UpdateList() Local $i Local $strlen Local $horiz_fit Local $max_len = 0 GUICtrlSetData($guictrl[1], "") While $i < $arraypos GUICtrlSetData($guictrl[1], $files[$i]) $strlen = StringLen($files[$i]) If $strlen > 88 Then If $strlen > $max_len Then $max_len = $strlen EndIf EndIf $i += 1 WEnd $horiz_fit = Round($max_len * 7.08) _GUICtrlListBox_SetHorizontalExtent($guictrl[1], $horiz_fit) _GUICtrlListBox_SetSel($guictrl[1], $last_selected) EndFunc Func _Save(ByRef $title) Local $i = 0 Local $saveas Local $file_name Local $overwrite Local $temp_namer[20] $saveas = FileSaveDialog("Save As", @WorkingDir, "Playlist (*.m3u)", "", $name) If @error Then Return If StringInStr($saveas, ".") Then $file_name = $saveas Else $file_name = $saveas & ".m3u" EndIf If FileExists($file_name) Then $overwrite = MsgBox(276, "Overwrite?", "Would you like to Overwrite this file?") If $overwrite = 6 Then FileDelete($file_name) Else Return EndIf EndIf While $i < $arraypos FileWriteLine($file_name, $files[$i]) $i += 1 WEnd $temp_namer = StringSplit($file_name, "\") $name = $temp_namer[$temp_namer[0]] If StringLen($title & " - " & $file_name) > 97 Then If StringLen($title & " - " & $temp_namer[1] & "\ . . . \" & $temp_namer[$temp_namer[0] - 2] & "\" & $temp_namer[$temp_namer[0] - 1] & "\" & $temp_namer[$temp_namer[0]]) > 97 Then WinSetTitle($title, "", $title & " - " & $temp_namer[1] & "\ . . . \" & $temp_namer[$temp_namer[0] - 1] & "\" & $temp_namer[$temp_namer[0]]) Else WinSetTitle($title, "", $title & " - " & $temp_namer[1] & "\ . . . \" & $temp_namer[$temp_namer[0] - 2] & "\" & $temp_namer[$temp_namer[0] - 1] & "\" & $temp_namer[$temp_namer[0]]) EndIf Else WinSetTitle($title, "", $title & " - " & $file_name) EndIf EndFunc Func _ClearArray() Local $i Local $clear $clear = MsgBox(276, "Clear playlist?", "Are you sure you want to clear your playlist?") If $clear = 6 Then Else Return EndIf GUICtrlSetData($guictrl[1], "") While $i < $arraypos $files[$i] = "" $i += 1 WEnd $last_selected = "" $arraypos = 0 EndFunc Func _Delete() Local $i = 0 Local $k = 0 Local $temp $temp = GUICtrlRead($guictrl[1]) While $i < $arraypos If $temp = $files[$i] Then $files[$i] = "" $k = $i While $k < $arraypos $files[$k] = $files[$k + 1] $k += 1 WEnd $arraypos -= 1 $last_selected = $i _UpdateList() Return EndIf $i += 1 WEnd EndFunc Func _MoveUp() Local $i Local $temp $temp = GUICtrlRead($guictrl[1]) While $i < $arraypos If $temp = $files[$i] Then If $i = 0 Then MsgBox(0,"Error", "Sorry, This file is allready at the top of the list.") Return EndIf _Swap($i, $i - 1) Return EndIf $i += 1 WEnd EndFunc Func _MoveDown() Local $i Local $temp $temp = GUICtrlRead($guictrl[1]) While $i < $arraypos If $temp = $files[$i] Then If $i = $arraypos - 1 Then MsgBox(0,"Error", "Sorry, This file is allready at the bottom of the list.") Return EndIf _Swap($i, $i + 1) Return EndIf $i += 1 WEnd EndFunc Func _Swap($pos1, $pos2) Local $temp If $pos1 > $pos2 Then $last_selected = $pos1 - 1 Else $last_selected = $pos1 + 1 EndIf $temp = $files[$pos1] $files[$pos1] = $files[$pos2] $files[$pos2] = $temp _UpdateList() EndFunc Func _FolderScan() Local $folder = FileSelectFolder("Sélectionnez un répertoire à scanner", "") If @error Then Return Local $fileExt = "(*.MP3;*.WMA;*.ASF;*.AC3;*.FLAC;*.OGG;*.M4A;*.MKA;*.TTA;*.WV;*.WAV)" Local $searchHandle, $file, $fullPath, $skip $searchHandle = FileFindFirstFile($folder & "\*.*") If $searchHandle = -1 Then Return While 1 $file = FileFindNextFile($searchHandle) If @error Then ExitLoop $fullPath = $folder & "\" & $file If @extended Then ; Si c'est un dossier _FolderScanRecursive($fullPath) Else ; Si c'est un fichier If StringRegExp($file, "(?i)\.(mp3|wma|asf|ac3|flac|ogg|m4a|mka|tta|wv|wav)$") Then $skip = 0 For $k = 0 To $arraypos - 1 If $fullPath = $files[$k] Then $skip = 1 ExitLoop EndIf Next If $skip = 0 Then ; Redimensionner le tableau si nécessaire If $arraypos >= UBound($files) Then ReDim $files[$arraypos + 100] EndIf $files[$arraypos] = $fullPath $arraypos += 1 EndIf EndIf EndIf WEnd FileClose($searchHandle) _UpdateList() EndFunc Func _FolderScanRecursive($folderPath) Local $searchHandle, $file, $fullPath, $skip $searchHandle = FileFindFirstFile($folderPath & "\*.*") If $searchHandle = -1 Then Return While 1 $file = FileFindNextFile($searchHandle) If @error Then ExitLoop $fullPath = $folderPath & "\" & $file If @extended Then ; Si c'est un dossier _FolderScanRecursive($fullPath) Else ; Si c'est un fichier If StringRegExp($file, "(?i)\.(mp3|wma|asf|ac3|flac|ogg|m4a|mka|tta|wv|wav)$") Then $skip = 0 For $k = 0 To $arraypos - 1 If $fullPath = $files[$k] Then $skip = 1 ExitLoop EndIf Next If $skip = 0 Then ; Redimensionner le tableau si nécessaire If $arraypos >= UBound($files) Then ReDim $files[$arraypos + 100] EndIf $files[$arraypos] = $fullPath $arraypos += 1 EndIf EndIf EndIf WEnd FileClose($searchHandle) EndFunc m3u.au3
    1 point
  4. Figured it out. Need to add $sShared = $oDataTransferObject.Item("$sShared") in while loop to receive from python.
    1 point
  5. Thank you. Works great. Only thing is visual issue at last line for me. But no problem. BR funkey
    1 point
  6. Version 6.1.5.2 uploaded on February 19, 2025.
    1 point
  7. Version 6.1.5.9

    4,257 downloads

    zPlayer is a standalone, intuitive, and fully functional media player. Built to suit my purpose, it is customizable to your taste. zPlayer is powered by winmm.dll, an integral part of Windows. Features No 3rd Party Dependencies: Utilizes only Windows components and standard AutoIt UDFs. Universal Playback: Supports all digital media formats, provided proper codecs are installed. Independent Video Window: Separate video window with a minimal GUI for music. Versatile Loading Options: Load files, folders, or an audio CD for playback. Marquee Style Display: Long file names are displayed in smooth, infinite marquee style. Smart Playlists: Automatically generated playlists and easy-to-make custom playlists. Hidden Playlist: Playlist is hidden by default but available on demand in shuffled or sorted formats. Context Menus: Options include Play This File, File Properties, Search Internet, Go to This Folder, Move Playlist Item, and Remove from Playlist. Interactive Interface: Double-click any item to play it, search strings in the playlist, and use hotkeys for most functions. Playback Controls: Forward, backward, pause, and change folder. Repeat Functions: A-B repeat, current file repeat, and multiple-file repeat. Volume Control: Increase, decrease, or mute sound volume, synchronized with Windows volume mixer. Unmutes audio device on startup. Playback Environment Save: Save playback environment on session termination and resume in the next session. Resume Playback: Option to resume playback from where it was left off, with audio fade-in. Efficient Performance: Very low CPU and memory usage. Technical Information The script runs or compiles in x64 mode. To change this setting, comment out #AutoIt3Wrapper_UseX64=Y. The attached zPlayer.exe was compiled in x64 mode and is not flagged by Windows Defender as malicious. Compiling to x86 may result in false positive flags by Windows Defender. Feedback If you find an error, please download the latest version, as it may already be corrected. Otherwise, I would appreciate it if you could kindly let me know. zPlayer-NoUI.au3 The download section includes zPlayer-NoUI.au3. This is an abbreviated version of zPlayer, which is a music player controlled by hotkeys only, without a GUI. Note: zPlayer was tested to work in Windows 10 and 11. It should work in Windows 7, too. I would like to know if there is any compatibility problem.
    1 point
  8. UEZ

    GDI Plus Image Save to File

    PNG are implemented! Just use _GDIPlus_ImageSaveToFile($hBackbuffer, @MyDocumentsDir & "GDIPlus_Export.png") and the bitmap will be saved as a PNG. Br, UEZ
    1 point
×
×
  • Create New...