Keyset as registered is invalid exception when Importing a RSA Key Container using aspnet_regiis - rsa

I have been trying to import a RSA key container from aspnet_regiis. Steps are as follows.
Run the command prompt as administrator
cd C:\windows\Microsoft.NET\Framework\v2.0.50727
aspnet_regiis -pi myrsakey E:\keyfile.xml
When followed the above steps I get the error as follows
**
Importing RSA Keys from file.. Keyset as registered is invalid.
<Exception from HRESULT: 0x8009001A> Failed!
**
For this "Keyset as registered is invalid" error almost every web result says to try renaming RSA file in the path C:\Users\myuser\AppData\Roaming\Microsoft\Crypto to RSA.old and reboot. If that does not work try renaming Crypto folder as Crypto.old. Eventhough I tried these steps it did not resolve the above issue. I am even running the cmd as administrator. So I was not sure what I am missing in here. Would you be help me to find a solution or a workaround for this issue.
Thanks in advance

Okay I found the answer.
As I was installing this RSA as a machine level key I should have renamed the RSA to RSA.old in the path C:\ProgramData\Microsoft\Crypto
After rename and I reboot the system. And then did the above mentioned steps again in the cmd. This time it succeded.
Previously I was renaming the RSA folder in the wrong place which is in my personal area (C:\Users\myuser\AppData\Roaming\Microsoft\Crypto).

Related

Connecting a Google Cloud SQL Postgres Database to Google Data Studio

I am going through the exact same process as the answered question found here (Connect a Google CloudSQL Postgres database to Data Studio), but I am not as advanced a user as most. I am encountering a similar problem to what was mentioned in the above question, and then some:
I have created a client certificate and downloaded the
client-cert.pem, client-key.pem and the server-ca.pem files to my
local machine.
I received the same error when attempting to link
Data Studio to our Google Cloud SQL Postgres Database as a data
source. " Can't reach the host. Please double check your connection parameters. Learn more about database connectors here. "
I tried running the following command " openssl pkcs8 -topk8 -inform PEM -outform DER -in client-key.pem -out client-key.pkcs8 -nocrypt " to change the format of the
client key in our Cloud Shell Project, but I received this error "
pkcs8: Cannot open input file client-key.pem, No such file or
directory ".
I would assume that I should not be running this command from the Cloud Shell Project terminal then. Would anybody know where I should be running this command instead? I can provide any extra material if needed. Thank you in advance - much appreciated.
It sounds like the file doesn't exist location where you are running the command. Did you upload the client-key.pem into Cloud Shell?

How to encrypt files in Heroku?

I would like to find a way to store encrypted file in my github repository that Heroku can decrypt on-the-fly (it's not env var but plain old .csv files).
I used git-crypt successfully on my machine but it seems that I cannot add a gpg key to heroku.
When I connect to heroku-cli and I try to create a gpg key usingheroku run gpg --gen-key I got the following error:
gpg: signing failed: Inappropriate ioctl for device
Anyhow, I'm not even sure git-crypt is the right way to go, so feel free to gave me any other alternative solution.

ctl_dir /root/.libnet-openssh-perl/ is not secure at /usr/local/share/perl/5.18.2/Net/OpenSSH/Compat/Perl.pm line 123

I installed Net::OpenSSH::Compat::Perl recently. All the dependencies were installed without any errors. But when I try to login using the following code
$linux_ses= Net::OpenSSH::Compat::Perl->new($host);
$linux_ses->login($linux_uname,$linux_pass);
I get the following error message:
"ctl_dir /root/.libnet-openssh-perl/ is not secure at /usr/local/share/perl/5.18.2/Net/OpenSSH/Compat/Perl.pm line 123."
I am running the script as root and the file permission of /root/.libnet-openssh-perl/ is 700.
The permissions on /root/ could be too loose. Group writeable could mean able to delete a .libnet-openssh-perl/ by someone other than root, which is not a secure situation.
Please check.

Oracle ILOM CLI access

I am trying to access an Oracle ILOM interface via command line to read the event log.
As far as I know there are several ways to do this, but none work for me and my environment:
IPMItools: seems to be available only for Linux or on the CD/DVD that originally came with the server, which of course was lost;
SSH access (via putty) works fine, but I could not figure a way to automate logging in, running a command on the remote server and reading the result (still looking into it);
command line SSH access via plink works fine, but as soon as I try adding a command to run on the server (e.g. plink.exe -l root -pw password FQDN help) I get the error message "shell: Invalid credentials". adding the -t option did not change anything;
the SSH.NET library for powershell fails with the following exception "Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication". Documentation suggests adding a generated public RSA key to the server to allow for possword-less login. That cannot be done on Sun ILOMs;
Connecting via a serial port as detailed here does not work for me. I must be missing something from the posted code, but I simply cannot open a connection.
Has anyone ever tried to access an ILOM from command line? Could anyone offer a pointer as to what might work?
Ideally I'd like to automate this in a powershell script to be run from a Windows machine, but I'm open to any suggestions that do not require Visual Studio to implement.
Any help would be greatly appreciated!
ipmi and ssh remote command only supports in ilom3.0+.
if you are using alom, ilom2.0, or sxcf, you won't be able to use these tools.
I'd recommand to use python with pexpect https://pexpect.readthedocs.io/en/stable/.
check my snippet https://gist.github.com/happlebao/ca143cf3feaf60ca8ef75f7a66cf8a8a

Unable to use key file Eclipse

I setup public key access to my server via ssh. I have a .ssh folder on my local windows computer. I configured ssh to add the private key using the ssh-add <directory> command. I am able to successfully connect to my server using windowspowershell. The chmod and Chown of the .ssh directory and authorized file are configured correctly on my server. sshd_config is configured correctly and points to the correct key.
The connection works perfectly with shell so there is no problem on my server. But with Eclipse, and its plugin in particular, Egit, I keep getting a Unable to use key file <directory of the key file I loaded into eclipse the same one used by ssh error every time I try to push my revision commits to my git repository on the server. I went to Pref > General > Network > SSH2 and added the right private key, the ssh2 home directory is set correctly too, in fact the public an private key were both generated using the key management tab and loaded into my server.
My windows permissions on that folder and those keys is set to allow all users to do everything just for good measure.
Now one clue is, the known hosts tab has a host fingerprint that does not match the fingerprint of my key. My key is something like f1:19: etc and the hosts fingerprint is different. I hope I can fix this soon. Any suggestions would be great.
ssh-add -l = two private keys that I am using. So its not this.
Another clue is, after going into my putty program and changes the private key that it ses suddenly is i try to connect to ssh with a key acces in eclipse the error it throws shows reflects the same key that I just changed in putty!! Somehow eclipse seems to be using putty for public key access. How do I stop this?!
Okay here's the solution. For whatever reason Egit uses putty to connect to ssh using the configuration putty is set to use to access a server with a public key. The way you fix this is to make sure putty is able to connect to the server using a public key. If it can't then try this:
Download puttygen
Generate a rsa key using either ssh shell or the key management tab on eclipse. Do not generate a key using puttygen. For whatever reason it never worked for me.
Load the private key you generated (not generated with puttygen) into puttygen and then save as a putty private key (.ppk)
Go to eclipses key management tab and set it to recognize the new .ppk private key file
Finally go to putty, and create your servers profile by assigning the address and then go to auth and load the .ppk file. DISABLE pageant.
Save and attempt to connect to server using the key and if successful then congratulations Egit and Eclipse will now be able to make connections using keys.