problem with Ssh key ssh-ed25519 on Vectura macOs & C# - c#

I have a problem with the generation of a ssh-ed25519 key on my macOS vectura 13, I tried a lot of solutions on internet
ssh-keygen -t ed25519 -comment
and the modification of the ssh-config file
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1
my code is still stuck on this exception of the class PrivateKeyFile.cs line 324
Exception
Because he finds that his type is a ssh-rsa
Has anyone had this problem before?

Related

USB serial communication with C#, Linux permission question

I am having a serial communication problem on Linux. I am trying to send and receive information between an arduino and the Unity3D engine which uses C# (mono) to open the serial communication. But I suspect that this is an issue with Linux permissions, which is why I post this here.
I already added the user to the dialout group and serial communication is actually working when I compile and run the following C# using mono:
using System.IO.Ports;
sp = new SerialPort("/dev/ttyACM0", 9600);
sp.Open();
However, the same code in Unity3D at runtime tells me:
IOException: No such file or directory
The frustrating thing is that this is actually working on another Linux machine and I am having trouble understanding what the difference could be that is causing it not to work on the other.
Here are some differences on both systems:
The working Linux is Lubuntu 19 with the Unity3D installation inside of /home, which is on the same partition as root. The Unity3D version is 2019.2.
The non-working system is Linux Mint 19.3 with the Unity3D installation also in /home, but this is a different partition from root. The Unity3D version is 2019.3.
The permissions look slightly different too:
crw-rw----+ 1 root dialout 166, 0 mei 1 05:08 /dev/ttyACM0 --> Lubuntu
crw-rw---- 1 root dialout 166, 0 May 1 15:03 /dev/ttyACM0 --> Mint
Also:
getfacl /dev/ttyACM0
gives me the following on Lubuntu:
# file: dev/ttyACM0
# owner: root
# group: dialout
user::rw-
user:myname:rw-
group::rw-
mask::rw-
other::---
and the following on Linux Mint:
# file: dev/ttyACM0
# owner: root
# group: dialout
user::rw-
group::rw-
other::---
Does anyone have any insight into why in one scenario Unity3D can't access /dev/ttyACM0, while in the other one it can? Or any idea's how I might find out?
EDIT:
I played around a bit with the following to check what the program is allowed to read:
string[] fileArray = Directory.GetFiles(#"/dev");
foreach(string s in fileArray)
{
Console.WriteLine(s);
}
And when run inside of Unity3D only a handful of files are recognized, only those with "other" read permissions.
In contrast, when I compile it outside of unity with mono, all the files in /dev are printed.
This confuses me, shouldn't Unity3D also be run with my user ID, and in turn have access to the dialout group permissions?
Unity3D is launched through a launcher application, could this cause it to not be run as my user?
I would double check that the ACM device isnt reconnecting and being given ACM1/2/3 etc instead of 0. I've had the issue that it has timed out, reconnected and the number has incremented, because they are virtual this can happen very quickly and the system doesn't remove the previous devicefile before creating the new one. If you type dmesg into terminal it will show any re connections and what port they got assigned, running sudo dmesg -c will clear the output as it can be quite verbose.
Hope this helps. Hardware can be painful to work with sometimes.
I finally found the culprit. Apparently Unity3D recently changed their launcher (Unity Hub) to a sandbox version using flatpak, and for some reason /dev is blacklisted by default.
To get around this Unity Hub should be launched with the parameter:
--device=all
The entire command to get this to work for me is:
/usr/bin/flatpak run --branch=stable --arch=x86_64 --device=all --command=start-unityhub com.unity.UnityHub

c# ssh.net PrivateKeyFile Access to Path Denied

When trying to create a PrivateKeyFile object I get the following error:
Access to the path is denied.
Here is the code:
PrivateKeyFile pk = new PrivateKeyFile(keyfile);
I have tried to tweak the Windows security settings (to the point where I set Full Access to Everyone) and that still hasn't solved my issue.
There is no pass phrase for the key.
Anyone run into this? If so do you have a solution?
Thanks.
I appear to have found my problem. The original key was generated on an AIX server. I did check it with PuttyGen, which acknowledged it as an OpenSSL private key.
However, I decided to run the Conversion to OpenSSL anyway. Once I did that and tried again, it worked and allowed me to connect to the server.
So that seems to be the problem.

Bitbucket default repository not configured [duplicate]

This question already has an answer here:
Mercurial "no username supplied" error on Mac
(1 answer)
Closed 7 years ago.
I am totally lost here as i have been trying to create a repository and push my existing Unity3D C# project to it.
The current output is:
realm: Bitbucket.org HTTP
user:
password:
warning: bitbucket.org certificate with fingerprint 46:de:34:e7:9b:18:cd:7f:ae:fd:8b:e3:bc:f4:1a:5e:38:d7:ac:24 not verified (check hostfingerprints or web.cacerts config setting)
warning: bitbucket.org certificate with fingerprint 46:de:34:e7:9b:18:cd:7f:ae:fd:8b:e3:bc:f4:1a:5e:38:d7:ac:24 not verified (check hostfingerprints or web.cacerts config setting)
searching for changes
warning: bitbucket.org certificate with fingerprint 46:de:34:e7:9b:18:cd:7f:ae:fd:8b:e3:bc:f4:1a:5e:38:d7:ac:24 not verified (check hostfingerprints or web.cacerts config setting)
warning: bitbucket.org certificate with fingerprint 46:de:34:e7:9b:18:cd:7f:ae:fd:8b:e3:bc:f4:1a:5e:38:d7:ac:24 not verified (check hostfingerprints or web.cacerts config setting)
abort: error: ''
Peters-iMac:myProject Peter$ hp puch -v --debug
-bash: hp: command not found
Peters-iMac:myProject Peter$ hg push -v --debug
pushing to default-push
abort: default repository not configured!
(see the "path" section in "hg help config")
Peters-iMac:myProject Peter$
I have been trying to understand what i need to do to fix this but have not succeeded, i did check the "hg help config" but did not fully understand anyhow.
Anyone that can lead the blind (me)?
You need to tell mercurial where to push to. You can do that in two ways:
Command line: hg push URL where URL is the pathwhere to push to, e.g. hg push https://bitbucket.org/YOURLOGIN/YOURREPOSITORY (it then will ask for login and pw on the command line)
In your repository's configuration file found in .hg/hgrc:
[paths]
default = https://bitbucket.org/YOURLOGIN/YOURREPOSITORY
See also hg help config.paths
You can also use the hgrc to store the login information in order to remove the need to enter them each time you push, but that is unsecure. Better use ssh authentication which doesn't require storing any credentials.

C# PInvoke CryptImportKey Fails with "Invalid type specified"

I'm trying to use the CryptImportKey function to import a PFX into a Gemalto .NET IDPrime smart cart, but I'm getting a "Invalid Type Specified" (2148073482) error. I suspect that the RSACryptoServiceProvider.ExportCspBlob(true) call is returning the keys in the wrong format. I'm using sample code from http://www.idrix.fr/Root/Samples/PfxImporter.cs. NOTE: I've already set the AllowPrivateExchangeKeyImport & AllowPrivateSignatureKeyImport to 0x1 for the Microsoft Base Smart Card Crypto Provider, but still no change. I'm running Windows Server 2012, but don't think that is the issue.
Can someone please tell me what is wrong with this code sample?
Your issue is certainly caused by the fact that your application is 32-bit running on a 64-bit Windows and you didn't change the Microsoft Base CSP 32-bit registry key located under Wow6432Node.
To solve your issue, change AllowPrivateExchangeKeyImport & AllowPrivateSignatureKeyImport also under "HKLM\SOFTWARE\Wow6432Node\Microsoft\Cryptography\Defaults\Provider\Microsoft Base Smart Card Crypto Provider".
I have update the comment in PfxImporter.cs header to include this remark.

Using SSH Keys with IP*Works

I try to connect to an SSH server with nsoftware's IP*Works components without password. The only information about the components' capability is described in the following document:
http://www.nsoftware.com/kb/help/BWN1-A/Type_Certificate.rst
I have created keys with Putty, which is a PPK file as:
PuTTY-User-Key-File-2: ssh-rsa
Encryption: aes256-cbc
Comment: rsa-key-20130329
Public-Lines: 4
...
Private-Lines: 8
...
Private-MAC: ...
However any tries to open this file with nsoftware.IPWorksSSH.Certificate fails. Does anybody have an experience with the Certificate object of Ip*works?
Indeed, IP*Works does not use the same key format as PuTTY. You will need to convert the key. This is documented here:
Are .ppk files supported?

Categories

Resources