# Generating private and public keys
For this signed auth process we use the standard Cryptography mechanism, with private/public keys.
Below lists down simple steps to generate RSA key-pair and export private & public key in above mentioned format.
# Unix/Mac command line tools
- Generate RSA key-pair with openssl
openssl genrsa -des3 -out my_rsa_key_pair 2048 Generating RSA private key, 2048 bit long modulus
..........................................................+++
.......................................................+++
e is 65537 (0x10001)
Enter pass phrase for my_rsa_key_pair: ********
Verifying - Enter pass phrase for my_rsa_key_pair: ********
TIP
Using -des3 ensures that pem file generated in above step will be passphrase protected.
ls
my_rsa_key_pair
- Export private key in private_key.pem file
openssl pkcs8 -topk8 -inform PEM -in my_rsa_key_pair -outform PEM -out private_key.pem -nocrypt Enter pass phrase for my_rsa_key_pair: ********
ls
my_rsa_key_pair private_key.pem
- Export public key in public_key.pem file
openssl rsa -in my_rsa_key_pair -outform PEM -pubout -out public_key.pem Enter pass phrase for my_rsa_key_pair: ********
writing RSA key
ls
my_rsa_key_pair private_key.pem public_key.pem
Copy the string between -----BEGIN XXX KEY----- & -----END XXX KEY----- lines from public_key.pem file and send it to Portal B2B Venta en Verde team(soporteb2b@walmart.com)
# Windows
TIP
PuttyGen tool is not recommended as the default fomat is not PKCS8. Use either Alpine docker container to generate key, install GitBash, or use OpenSSL for Windows (opens new window).
# Using Alpine Docker container
$ docker run --name openssl -it pgarrett/openssl-alpine:latest /bin/ash ... in the container, simple executes openssl command sequence 1) - 3) described above.
/ # openssl genrsa -des3 -out my_rsa_key_pair 2048
[Enter pass phrase for my_rsa_key_pair:] ...
/ # openssl pkcs8 -topk8 -inform PEM -in my_rsa_key_pair -outform PEM -out private_key.pem -nocrypt
/ # openssl rsa -in my_rsa_key_pair -outform PEM -pubout -out public_key.pem
/ # cat public_key.pem
-----BEGIN PUBLIC KEY-----
MIIBIjA... / # exit ## Now either copy and paste or use docker COPY command to get private and public key.
$ docker cp openssl:/public_key.pem .
$ docker cp openssl:/private_key.pem .
# Using GitBash
If you have Git Bash installed on your Windows workstation, you can use the Unix/Mac commands listed above. Just make sure that you prefix the openssl commands with winpty to compensate for a feature of Git Bash.
Keep your keys safe
Save your private key in secure place and share only your public key with Portal Venta en Verde Lider.cl team soporteb2b@walmart.com in the below format. Walmart / Lider would never ask for your private key , don't share it with anyone. Make sure to deregister your account if your account keys are corrupt or lost.
Never share your private key
Never share your private key generated above with anyone , Walmart / Lider will never ask for your private key.
# Requesting for Walmart account registration for your public key generated above
Please send E-mail to soporteb2b@walmart.com from your Walmart Retail Account registered e-mail-ID with below details.
- Env : Dev or Prod
- Public key : public_key.pem
Keys are environment specific
You have to provide separate unique public_key.pem file which is environment specific (Dev / Prod). For multiple access please check with soporteb2b@walmart.com.
# Registration successful confirmation
After each successful migration you will receive a confirmation reply along with set of following Authentication headers unique and specific for each public_key_*.pem file being registered, which have to be sent as a part of request header for every request being made.