C# Public/Private Key Encryption using Visual Studio 2019 | RSA Cryptography
Vložit
- čas přidán 8. 04. 2021
- C# Public/Private Key Encryption using Visual Studio 2019 | RSA Cryptography
C# PUBLIC/PRIVATE KEY ENCRYPTION
C# and .Net provides implementations of many standard cryptographic algorithms.
RSA being a public key crypto-system has two keys, the Public key and the Private key. The Encryption is done using one and the decryption is done using the other. Normally, the encryption is done using the Public key and the decryption is done using the Private key. The RSA modulus (explained below) length is called the key length of the cipher. The currently largest factored prime number had 768 bit. As the security of RSA depends on the factoring problem, using a modulus of 1024 bits is a bare minimum. It is recommended to use at least 2048 bits for good security. 4096 bit is pretty much unbreakable, anything beyond 4096 bits is over the top and would also be painfully slow. #selfhostwcf, #p2pnetworkprogramming,#netcorecommerce - Věda a technologie
Oh man! thanks for that ! im suscribing right away!
Cheers from Mexico city!
Welcome aboard!
Excellent video! Thank you!
You are welcome
How do you specify or generate the keys though? It doesn't seem very useful if everyone uses the same keys.
dude best timing i love you
No doubt
Great stuff! Now I just need to figure out where to store my Public and Private RSA keys
No doubt
and why csp intantiated in encrypt() and not in decrypt()??
I'm trying to figure out how I would use this with an existing RSA 4096 key? Excellent video... !!
Hi Hacked :) Thanks a lot for this very clear exposé. One question though, you create an instance of csp static property initialised at creation but you do an other new() for it in the Encrypt() method. Is it necessary to do so or the new() in the property definition is enough ?
Hi bud, thanks for the comment, will have a look and get back ASAP
legend has it he never got back
I just came across this video looking how to decrypt the files.. my computer got ransome ware.. online key decryption is that possible.. please help
Thank you very much!
You are welcome
Bro I have an encrypted videos AES encryption , you have any software to decrypt then please share I need help
excellent video helped me a lot
No doubt bud
Thank you so much!
You are welcome
why false in Encrypt() and decrypt() ?
Hi Hacked :) This is the first video I saw from you, thank you! In my case, i have a Windows Service, communicating directly with a Server (without any GUI), where credentials are saved. In your example you have one single class, where both private and public key are stored. But I need a variant, where the public key is on the server, while the private key is only accessible in the Windows Service. Perhaps, the class may not store the private key, but send the key to the Windows Server? What is the most secure way to transfer the private key, without decreasing security? Btw. the communication between the Windows Service and the Server will be by gRPC.
You can make it a base class, and create both classes for public and private keys derived from the base class
Thanks a lot great explanation
You are welcome
Thanks man about it. Rarely I have found explanation about this at CZcams. Do you have course at udemy about it? Where you setup to sha256 for example? Could I use JWT and Identity Model token to generate this?
Greetings from Brazil
You are welcome, no I don't have courses on udemy
Love it. Follow-up question for me is what if I need to decrypt some data at a later date - for instance after closing and reopening the program or restarting the machine it's running on?
How does one safely store the private key for use at a later date?
You have to save the generated keys then
@@hacked101 do... do I encrypt the private key when saving it? Surely it defeats the purpose if stored in plaintext?
Hi Hacked, thank you for the videos it's really helpful, I have a question tho .. how can I load and use my public and private keys in XML format instead of the generated ones ?
I will make a video on that shortly
Hi @Hacked I just want to use my custom public key (which is string passed as parameter to my application) how do I use that
Hi @@hacked101 I just want to use my custom public key (which is string passed as parameter to my application) how do I use that
do we need write all this again to just see it wont work.
where it get those private and public keys. where i find my public key so someone can encode message for me lol
what xml. not even opened any xml lol
Do we have ECDH support in .Net ..I looked around coudnt find any library
Will look into that shortly thanks
thank you for the videos it's really helpful, but how can I load and use my public instead of generate it in order to encrypt data
You are welcome, will make a video on that shortly
how to load a saved key?
Nice video
No doubt
thanks 🙏
You are welcome
Sorry, for a stupid question. Can I adapt this to API ?
Don't really get you, but if what I'm getting is true, then yes you can
Hi Hacked.. thanks for the video
In case i want to use the keys have generated using Keystore Explorer.. How can i apply the same concept
Outputting both keys to string reveals that both are identical. Private key = public key, that therefore doesn't work as intended as you could share the public key with anyone and someone else would be able to decrypt it using the public key.
To proof that, I also changed the export parameters and encrypted and decrypted using the public key and the private key.
This should work by encrypting using the public key and decrypting using the private key ONLY.
Hello, I really need some help understading what you've written above. can you explain how the two keys are equal?
i get error for text > 58 character length
what i do to fix that ?
error :An unhandled exception of type
line error : var cypher = csp.Encrypt(data, false); // encrypt function
Please follow the video carefully
@@hacked101 sorry bro .i got it🥴
How can I create a project with a button to fetch a file and display its path in a textbox, another button to encrypt the file in disk D and calculate the encoding time for the file and put it in a textbox, and a third button to decrypt the file and calculate the decoding time for the file and put it in a textbox using RSA algorithm in C# and return The file after decoding to the same type as the original file?
Watch my video on encryption
I watched the video, but I want to encrypt any file inside the computer by specifying its path in the botton, calling the path by the RSA algorithm, who has been decrypted, and calculating the time of encryption and decryption. Can you help me?
dude i just gonna say Prefecto,
Since you "Hackd Bytes" Right, You Can make video for Self Modifying Code (Encrypt Memory At Runtime) using C# console, nice idea.
No doubt, will look into that shortly
how to do this in python
there is an error in decrypting the cipher !! why ?
i followed the steps correctly.
You are probably missing something, please have a look properly. Otherwise you can become a member for more support thanks
@@hacked101 thanks bro , I fixed it. It was the constructor
@@darklevi7 you are welcome
Hi how could i do the same but for a file??
Check out the channel I have a for that thanks
hi Hacker, why not publish the code of this example?
I make the source available to channel members
this good work but
i need encrypt my source |.cs file| Self-Crypt --how
and i need encrypt memory my program like values bytes change in memory Repeatedly and change UTF-8 String To another way -how
and Execute orders or commands and clear Memory Automatic --how
All of this in C# Language not c++ or c (JUST-ONE-WORD : HOW)
Question Remains : Is C# supported for this
I hope to give me Way to do this.
If you want to encrypt a file, check out the channel, I have a video on that in C#
bro you don't understand me
i mean i want encrypt my program memory my process ,you get.
Check this playlist: czcams.com/play/PLXLkA7FAishrJVKN82KL87Ni7WsRJ6OhX.html
Thank you very much brother. I have followed your code and it is working fine. I have written all the code by creating console application in my pc. It has worked as it is. I am so happy. But, I have a doubt. We are a spiritual organisation and asked our bank to give api to check our bank account details. they have given api and they asked for public key certificate. I have generated a certificate and give them. So, how to use that certificate to do the encryption. Please give me any your youtube link for this.
You are welcome
Can I use a private key (.key)?
Yh
@@hacked101 is the same logic? I mean, I can use this code to build it?
Please make more videos on Android xamarin
Sure
how to encrypted file ?
Check out the channel I have a video on that