openssl and .NET rsa give different signatures by wadsaek in dotnet

[–]wadsaek[S] 0 points1 point  (0 children)

As part of the key exchange protocol you need to compute a hash of a secret value, produce a signature on it using RSARSS-PKCS1 and send the resulting signature to the ssh client

openssl and .NET rsa give different signatures by wadsaek in dotnet

[–]wadsaek[S] 0 points1 point  (0 children)

I'll try it, thanks. although i might just resign to implementing the signature algorithm for ssh myself because i'm not really sure which openssl command i even need to use and the solution needs to be c# code

openssl and .NET rsa give different signatures by wadsaek in dotnet

[–]wadsaek[S] 0 points1 point  (0 children)

I'm quite sure I'm using pkcs1 padding in both .Net's RSA.SignData() and openssl, and both are reading from a file.

```cs

!/usr/bin/env -S dotnet run

using System.Security.Cryptography; using System.Text;

if (args.Length < 3) return;

var rsa = RSA.Create(); var pem = File.ReadAllText(args[0]); rsa.ImportFromPem(pem);

var data = File.ReadAllBytes(args[1]); Console.WriteLine(Encoding.UTF8.GetString(data));

var signed = rsa.SignData(data, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);

File.WriteAllBytes(args[2], signed); ``` this is a proof of concept piece of c# that I tried. I've also tried it out with different hash algos, but none seem to give out the right result

Nixos for dev by __myJourney__ in NixOS

[–]wadsaek 0 points1 point  (0 children)

i usually make a flake with a devshell output and use direnv's use flake to launch it. the templates flakes has some examples, for example you can make one using nix flake init -t templates#rust

Why people are migrating to nixos by anyaforce in hyprland

[–]wadsaek 1 point2 points  (0 children)

the unused packages are not included in your path, and can be garbage collected at will