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

Topic: How to sign and verified RSA key 1024 in Rust? #30

Open
EloiStree opened this issue Jun 22, 2024 · 3 comments
Open

Topic: How to sign and verified RSA key 1024 in Rust? #30

EloiStree opened this issue Jun 22, 2024 · 3 comments

Comments

@EloiStree
Copy link
Owner

EloiStree commented Jun 22, 2024

Fail 1: https://github.com/EloiStree/HelloRustBending/tree/main/RustEveryDay/2024_06_17_D8_SignRSA
Fail 2: https://github.com/EloiStree/HelloRustBending/tree/main/RustEveryDay/2024_06_21_D12_SignVerifiedFailed

I am blocked... I just try to do this in C#

public static byte[] SignData(byte[] data, RSAParameters privateKey)
{

    using (RSA rsa = RSA.Create())
    {
        rsa.ImportParameters(privateKey);
         return rsa.SignData(data, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
    }
}
public static bool VerifySignature(byte[] data, byte[] signature, RSAParameters publicKey)
{
    using (RSA rsa = RSA.Create())
    {
        rsa.ImportParameters(publicKey);
        return rsa.VerifyData(data, signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
    }
}

But RSA on Crate is ... tricky.

@EloiStree
Copy link
Owner Author

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 22, 2024

Maybe call C# or Java code

image

https://youtu.be/1H9FHhRntAk

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 22, 2024

Or... Maybe do a Websocket server with all the RSA tools in usable from Rust.

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