Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should I encrypt a base64 key? #5

Open
bbhxwl opened this issue Jan 26, 2024 · 0 comments
Open

How should I encrypt a base64 key? #5

bbhxwl opened this issue Jan 26, 2024 · 0 comments

Comments

@bbhxwl
Copy link

bbhxwl commented Jan 26, 2024

The following code is incorrect

string publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9t16RqQWUE/J1IyOfoNHc4r/h6RPnXcWTJ4IbhQVUsEqMMm65F0hiytAgozXmVw68yPJywbpblDrx9zl1wdRcdHCoUvmPdr9/oCQtpQyVc7BXZIN6wJlD6MTeMeni+N0toNPxfXjiAawjNHGZZuT8wQpNEMwsVyJ/lonXaVdGZwIDAQAB";
var rsa=RSA.Create();
rsa.ImportPublicKey(RSAKeyType.Pkcs1, publicKey,true);
var asd=rsa.Encrypt(Encoding.UTF8.GetBytes("Hdsmzj9@2@"), RSAEncryptionPadding.OaepSHA256);
var vv=Convert.ToBase64String(asd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant