Step 1: Generate API Key
Code Block |
---|
gpg --full-generate-key |
OR
Code Block |
---|
gpg --default-new-key-algo rsa4096rsa2048 --gen-key && gpg --full-generate-key |
a. Select (1) RSA and RSA
- hit enter key
b. Select 2048 as keysize
- hit enter key
c. Specify how long the key should be valid
d. Is this correct? (y/N):
- type y
e. Real Name:
- type firstname lastname
f. Email address:
- type email address
g. Comment:
- type any comment
h. Enter passphrase:
- enter a phrase with non related words and remember it
i. Repeat passphrase
j. Wait for the result by operating computer in various ways.
k. On finish, you can see the user-id(uid) like “firstname lastname (comment) < email address >”
You can also check “uid” with the command “gpg --list-key”
Note: It will take some time to get the uid. Please be patient.
Step 2: Create public key
Code Block |
---|
gpg --list-keys --keyid-format=long # view the key we just created |
then
Code Block |
---|
gpg --export -a "<user-name>" > public.key # where uid is <user-name> / first name used |
Step 3: Create private key
Code Block |
---|
gpg --export-secret-key -a "james" > private.key # where uid is <user-name> / first name used |
Step 4: Encrypt a file
Code Block |
---|
gpg --recipient <user-name> --output <output-file>.pgp --encrypt <input-file>.txt # where uid is <user-name> |
Note: Generally, the file will be encrypted by Konnektive.
Step 5: Decrypt a file
Code Block |
---|
gpg --output <output-file> --decrypt <input-file> # then enter passphrase |
...