# RSA Algorithm

Go to solution Solved by guinness,

## Recommended Posts

so i found this >old post with the RSA Algorithm.

Can it be included in the Crypt.au3 or if someone can help me make a new include file

I dont know where to start

##### Share on other sites

I have v3.3.8.1

But i am not seeing it

##### Share on other sites

Open the Crypt include and you will see it.

Edit: Note that the RSA algorithm is a cryptographic provider.

Edited by FireFox
##### Share on other sites

does it have another name ? i only have this in crypt.au3

\$CALG_MD2, \$CALG_MD4, \$CALG_MD5, \$CALG_SHA1, \$CALG_3DES, \$CALG_AES_128, \$CALG_AES_192, \$CALG_AES_256,
\$CALG_DES, \$CALG_RC2, \$CALG_RC4

sorry for being noob

##### Share on other sites

In my Crypt file of the 3.3.8.1 AutoIt version I have the RSA constants lines 36, 37.

Two options:
-You have an older version.
-You altered the include.

I suggest you to reinstall the setup.

Br, FireFox.

Edited by FireFox

##### Share on other sites

haaaa, I see now  . My apologies.

##### Share on other sites

No, my fault I thought I added it.Good job I re-read my post.

I think the OP  is using v3.3.8.1 and as you said \$PROV_RSA_FULL is a provider used for Windows 2000 below and \$PROV_RSA_AES for Windows XP above.

##### Share on other sites

so how do i call it ?

```    If GUICtrlRead(\$Combo1) = "RC 4" Then
\$algorithm = \$CALG_RC4
ElseIf GUICtrlRead(\$Combo1) = "3 DES" Then
\$algorithm = \$CALG_3DES
ElseIf GUICtrlRead(\$Combo1) = "AES 128" Then
\$algorithm = \$CALG_AES_128
ElseIf GUICtrlRead(\$Combo1) = "AES 192" Then
\$algorithm = \$CALG_AES_192
ElseIf GUICtrlRead(\$Combo1) = "AES 256" Then
\$algorithm = \$CALG_AES_256
\$algorithm = \$CALG_DES
ElseIf GUICtrlRead(\$Combo1) = "RC 2" Then
\$algorithm = \$CALG_RC2
\$algorithm = ????
EndIf```
##### Share on other sites

Add those constants to the top of your script and then call it like you would with \$CALG_RC4. Also use a Switch..EndSwitch as that If...ElseIf...EndIf is unnecessary

The constants are in the post I linked..

##### Share on other sites

```; Script Start - Add your code below here
Global Const \$CALG_RSA_KEYX = 0x0000a400 ; RSA public key exchange algorithm.
Global Const \$CALG_RSA_SIGN = 0x00002400 ; RSA public key signature algorithm.

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Crypt.au3>
#region ### START Koda GUI section ### Form=C:\Documents and Settings\Onet Mariana\Desktop\Form1.kxf
\$Form1 = GUICreate("Vega CRYpt", 627, 382, 192, 124)
\$Edit1 = GUICtrlCreateEdit("", 8, 8, 609, 233)
\$Button1 = GUICtrlCreateButton("Encrypt", 8, 296, 611, 25)
\$Button2 = GUICtrlCreateButton("Decrypt", 8, 328, 611, 25)
\$Combo1 = GUICtrlCreateCombo("", 8, 272, 121, 25, BitOR(\$CBS_DROPDOWN, \$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "RC 2|RC 4|AES 128|AES 192|AES 256|RSA", "RC 2")
\$Input1 = GUICtrlCreateInput("Input1", 8, 248, 121, 21, BitOR(\$GUI_SS_DEFAULT_INPUT, \$ES_CENTER, \$ES_PASSWORD))
\$Label1 = GUICtrlCreateLabel("Algorithm KEY", 136, 248, 71, 17)
\$Label2 = GUICtrlCreateLabel("Algorithm", 136, 272, 47, 17)
\$Label3 = GUICtrlCreateLabel("Status : Ready !!!", 472, 248, 150, 17)
GUISetAccelerators(\$Form1_AccelTable)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
Opt("TrayIconHide", 1)

main()
enc()
decr()
s_file()
update()

Func main()
While 1
\$nMsg = GUIGetMsg()
Switch \$nMsg
Case \$GUI_EVENT_CLOSE
Exit
Case \$Button1
Call("enc")
Case \$Button2
Call("decr")
Call("update")
MsgBox(64, "Help", "Vega CRYpt" & @CRLF & @CRLF & "A simple crypt/decrypt program" & _
@CRLF & "Usefull for small peaces of text")
Call("s_file")

EndSwitch
WEnd
EndFunc   ;==>main

Func enc()
Local \$key
Local \$dpath = @ScriptDir & "\Decrypt.dat"
Local \$epath = @ScriptDir & "\Encrypt.dat"
GUICtrlSetData(\$Label3, "Status : Encrypting")
_Crypt_DestroyKey(\$key)
_Crypt_Startup()

Case "RC 4"
\$algorithm = \$CALG_RC4
Case "RC 2"
\$algorithm = \$CALG_RC2
Case "3 DES"
\$algorithm = \$CALG_3DES
Case "DES"
\$algorithm = \$CALG_DES
Case "AES 128"
\$algorithm = \$CALG_AES_128
Case "AES 192"
\$algorithm = \$CALG_AES_192
Case "AES 256"
\$algorithm = \$CALG_AES_256
Case "RSA"
\$algorithm = \$CALG_RSA_SIGN
EndSwitch

If FileExists(\$epath) Then FileMove(\$epath, @ScriptDir & "\Backup Data\Encrypt    " & @MDAY & "." & @MON & _
"." & @YEAR & "    " & @HOUR & ";" & @MIN & ";" & @SEC & ".dat")

FileWrite(\$epath, \$enc)
MsgBox(0, "DONE", "Done Encrypting")

EndFunc   ;==>enc

Func decr()
Local \$key
Local \$dpath = @ScriptDir & "\Decrypt.dat"
Local \$epath = @ScriptDir & "\Encrypt.dat"
GUICtrlSetData(\$Label3, "Status : Decripting")
_Crypt_DestroyKey(\$key)
_Crypt_Startup()
Case "RC 4"
\$algorithm = \$CALG_RC4
Case "RC 2"
\$algorithm = \$CALG_RC2
Case "3 DES"
\$algorithm = \$CALG_3DES
Case "DES"
\$algorithm = \$CALG_DES
Case "AES 128"
\$algorithm = \$CALG_AES_128
Case "AES 192"
\$algorithm = \$CALG_AES_192
Case "AES 256"
\$algorithm = \$CALG_AES_256
Case "RSA"
\$algorithm = \$CALG_RSA_SIGN
EndSwitch

If FileExists(\$dpath) Then FileMove(\$dpath, @ScriptDir & "\Backup Data\Decrypy    " & @MDAY & "." & @MON & _
"." & @YEAR & "    " & @HOUR & ";" & @MIN & ";" & @SEC & ".dat")

FileWrite(\$dpath, BinaryToString(\$enc))
MsgBox(0, "DONE", "Done Decrypting")
EndFunc   ;==>decr```

like this ?

##### Share on other sites

ok

i placed the globals below includes

i get -1

am i calling them rigth ?

Case "RSA"
\$algorithm = \$CALG_RSA_KEYX or \$CALG_RSA_SIGN

edit: eather way i get -1

Edited by HeavenlyDemon
##### Share on other sites

No.Do you understand the basics of AutoIt? You only choose one e.g.

```\$algorithm = \$CALG_RSA_KEYX

Or you replace that with

\$algorithm =  \$CALG_RSA_SIGN```
##### Share on other sites

my bad you misunderstand do i use

`\$algorithm = \$CALG_RSA_KEYX`

or do i use

`\$algorithm = \$CALG_RSA_SIGN`
Edited by HeavenlyDemon

##### Share on other sites

As you don't know at all what you're talking about, I guessed that the user choose himself his algorithm.

So let him choose between both of them.

Br, FireFox.

##### Share on other sites

please dont make fun of me i know i am noob and dont know what questions to ask or how to ask them, and i am trying my best  *_*

i tryed with both of them and get the same resault ( -1 )

as for why i want RSA - it was a request for the person i am helping out

##### Share on other sites

It was a suggestion, I'm NOT telling that you are a noob

Yes I forgot the part where you said it did not work.

Edited by FireFox

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...