Thursday, September 18, 2014

Secure file copy to Amazon Elastic Compute Cloud (Amazon EC2)

1. First connect to the instance using ssh command, make sure .pem (private key) is available in your ssh directory in ~/.ssh with permission chmod 400 <<my-key-pair.pem>>

ssh -i my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com

2.  After successfully connected, Execute the following command

scp -ir my-key-pair.pem <<Source path>> ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com:<<destination path>>


Friday, September 12, 2014

Rails Routing

Understanding Rails routing. Notes taken from the source (http://guides.rubyonrails.org/routing.html)
 
resources :photos
Creates seven different routes in your application, all mapping to the Photos controller:

HTTP Verb Path Controller#Action Used for
GET /photos photos#index display a list of all photos
GET /photos/new photos#new return an HTML form for creating a new photo
POST /photos photos#create create a new photo
GET /photos/:id photos#show display a specific photo
GET /photos/:id/edit photos#edit return an HTML form for editing a photo
PATCH/PUT /photos/:id photos#update update a specific photo
DELETE /photos/:id photos#destroy delete a specific photo

Thursday, September 4, 2014

gpg: public key decryption failed: Bad passphrase

When I  try to decrypt a file using GPG, for which I use "Starksoft.Cryptography.OpenPGP". I got the following error
Starksoft.Cryptography.OpenPGP.GnuPGException: An error occurred while trying to execute command --list-secret-keys.
But when I execute the command through command prompt ">gpg --list-secret-keys", it does list the keys. I could not get "Starksoft.Cryptography.OpenPGP" to work correctly.
Next I tried to get a solution by running the process directly using cmd.exe, which worked perfectly.

>echo Mypasspharse|gpg.exe --passphrase-fd 0 -o "C:\successtest.txt" --decrypt "C:\testfile.txt.gpg"
Note:
If Mypassphare contain a character ">" which will get interpreted as std out redirect in windows command prompt. So, passphase will not pass to the next command properly. So make sure you are not using  ">" in Passphase, if you are planning to use command prompt for gpg decryption