How to generate gpg signing keys in bintray for jcenter in windows - repository

I am unable to get GPG signing keys. Please any one tell me. Thanks
How to generate gps signing keys in windows for jcenter

For Linux/Mac you can use gpg. I learned how to do this here. I needed to prefix the following commands with sudo.
Generate the keys
gpg --gen-key
Follow the defaults but enter your name and email and optionally a password.
List the keys.
gpg --list-keys
which should show something like this:
pub 2038R/91E83BF2 2017-05-13
uid Bob <name#example.com>
sub 2038R/E3872671 2017-05-13
Upload the public key to a keyserver
gpg --keyserver hkp://pool.sks-keyservers.net --send-keys PUBLIC_KEY_ID
replacing PUBLIC_KEY_ID with your id (91E83BF2 in the example above).
Export your public and private keys to a text file
gpg -a --export name#example.com > public_key_sender.asc
gpg -a --export-secret-key name#example.com > private_key_sender.asc
Copy the contents of these files to Bintray at Edit Profile > GPG signing.

Windows users can generate GPG keys using GPG4Win.
There are many tutorials available, for example this one.

Here is a nice tutorial for gen gpg-key https://help.github.com/articles/generating-a-new-gpg-key/
Some note
-For Ubuntu 14.04 we need to use gpg --gen-key instead of gpg --full-generate-key https://askubuntu.com/questions/1019793/how-to-solve-gpg-invalid-option-full-generate-key.
-For gen private key
gpg --armor --export-secret-keys {sec_value}
eg: gpg --armor --export-secret-keys 3AA5C34371567BD2
-When copy public key or private key, remember copy ALL (including -----BEGIN ...----- and -----END ...-----)

I found solution, I needed it configure gpg signing in bintray. If you not created gpg keys follow this tutorial: https://help.github.com/articles/generating-a-new-gpg-key/
After you created gpg keys if you do not know how to copy private key in armored form follow this steps on git bash:
list private keys: gpg --list-secret-keys
copy long string after(or below) [SC]
export armored private key: gpg --export-secret-keys --armor string you have copied > private_key.asc
open private_key.asc with some editor(i used sublime text), and copy your private key
Hope it helps

Related

Git saves SSH in local project repository not in C:\Users\user-name/.ssh/id_rsa

I added a ssh key.
ssh-keygen -t rsa -b 4096 -C "my email"
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\user-name/.ssh/id_rsa):testkey
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in testkey.
Your public key has been saved in testkey.pub.
I tried commands like ls -al ~/.ssh and cat ~/.ssh/id_rsa.pub to find it. Didn't help.
Than i created a .ssh folder in my user directory using mkdir ${HOME}/.ssh and tied to create another SSH key. I did it in VS Code so it told me
testkey already exists.
Overwrite (y/n)?
Then i decided to cat testkey.pub and it returned me a key. Than i checked my local repo and found 2 files testkey and testkey.pub
So why it can't save in C:\Users\user-name/.ssh/id_rsa ?
I obviously don't want to store it my local project repo
I am still learning. Was watching Course about Git but got stuck on 22:00 with this problem
Enter file in which to save the key (C:\Users\user-name/.ssh/id_rsa):testkey
You entered filename without full path so ssh-keygen saves the keypair in the current directory. The answer should be
Enter file in which to save the key (C:\Users\user-name/.ssh/id_rsa):C:\Users\user-name/.ssh/testkey
Or
C:
cd \Users\user-name\.ssh
ssh-keygen
Enter file in which to save the key (C:\Users\user-name/.ssh/id_rsa):testkey

How to add ssh key in git bash?

To add key in Gitbash Make sure to use to enable ssh agent first.
eval $(ssh-agent -s)
[enter image description here][1]
Now you can add ssh key in git bash using below command.
if you are doing it in windows Git Bash.
ssh-add /c/keyname
How to check if the key is added.
ssh-add -L
you should see the ssh key added here .
Below are the steps:
Open Git Bash and run below command on command prompt to generate public-private key pair ssh-keygen -t rsa -b 4096 -C "your_email#gmail.com"
When you are prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
Enter a file in which to save the key (/c/Users/username/.ssh/id_rsa):[Press enter]
At the prompt, type a secure passphrase. You can press enter if you want to leave it blank but its not recommended.
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
Go to /c/Users/username/.ssh/ folder and open id_rsa.pub file and copy entire contents of it.
Finally, go to Github -> Settings -> SSH And GPG keys -> Click New RSA (Green Button). Give some meaningful title to the key and paste the public key copied in step 4 above. Now click on Add SSH Key button.
Congrats, you have added public key to github successfully and now you can use gitbash to access github repositories.
Usually, I take a look from git GUI (in Windows). There is a menu about SSL (or SSH) and you can view the imported key.

Get key signature/fingerprint for GPG Public Key

How can I get the key signature from a GPG Public Key? For example, I need a signature for Spotify's public key here:
https://download.spotify.com/debian/pubkey.gpg
Something like this, but for GPG Keys.
This is as far as I've got:
$ gpg pubkey.gpg
pub 4096R/130D1D45 2019-07-15 Spotify Public Repository Signing Key <tux#spotify.com>
Download the key, import it, extract the email and run gpg --fingerprint.
cd ~
curl -O https://download.spotify.com/debian/pubkey.gpg
gpg --import ~/pubkey.gpg
gpg --fingerprint tux#spotify.com
# 2EBF 997C 15BD A244 B6EB F5D8 4773 BD5E 130D 1D45

Why does importing the GPG key for the mono repo fail?

When following the steps to setup mono on the following site it is failing to import the GPG key for the repo.
https://www.mono-project.com/download/stable/#download-lin-centos
This is happening on CentOS machines running both 6.x and 7.x.
rpm --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
error: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF: key 1 not an armored public key.
This appears to be due to a missing newline at the end of the key file. If you open the key with vi and save it, without making any changes (this is one way to ensure there is a newline at the end of the file), the import works.
curl -v "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -okey
vi key
# don't modify, just save it with ":wq"
rpm --import key
Another way to add the newline to the end of the file: https://unix.stackexchange.com/a/31955
sed -i -e '$a\' key
see https://github.com/mono/mono/issues/15955
I used this workaround to then download. See https://github.com/mono/mono/issues/16025
rpm --import https://download.mono-project.com/repo/xamarin.gpg
su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo’

ssh-copy-id installed through Homebrew errors when trying to copy an SSH key

I installed ssh-copy-id through Homebrew.
When I type ssh-copy-id -i mykey.pub [path to remote] I get the following error:
/usr/local/bin/ssh-copy-id: ERROR: failed to open ID file './mykey': No such file or directory
It appears that it's not finding the key because the regex is cutting off the .pub. What am I doing wrong?
It turns out that ssh-copy-id checks whether there is a valid private key in the same directory as the public key it's uploading.
I was uploading someone else's SSH key so they could access a server. I don't have their private key on my machine, which is why the error occurred.
One option is to just manually remove that check from the script, but it's hacking the Homebrew code.
My solution was to run touch mykey to create a blank file using the filename syntax of the corresponding private key to the public key I was uploading (mykey.pub).
Thanks for your explanation. I have resolved the issue by following these simple steps
[ceph#monitor ~]$ ssh-keygen -t rsa
[ceph#monitor ~]$ ssh-copy-id ceph#osd-0