About Peculiar problem i encountered.
One of my colleagues wanted to send a pgp public key to the client. I thought it was for encrypting mails and created a key pair in Openpgp(Thunderbird) and sent the public key. But at last it turned out that the key was used to encrypt files and not mails.
We have to use gpg command in linux for encrypting/decypting files. I tried importing the public key(that i sent) to the gpg keyring in the machine that had encrypted files.
$gpg --import <public-key-file
and tried decrypting the file:
gpg -o output-file --decrypt encrypted_file
But it did not work. By no way i could decrypt the files. Then a thought stuck me that "Shouldn't i import the private key to decrypt the file rather than the public key". So, i tried the key management tool in
Openpgp(Thunderbird). In that i selected my key and exported it to a file. I compared that key file with my public key. I noticed that the file that i exported from Thunderbird had both private and public key
info. I copied the key file to the system having all the encrypted files. Then i imported the copied key
to the keyring with:
#gpg --import keyfile eg: gpg --import my.key.asc
This imported both the public key and secret key(private key). I could see the keys with:
#gpg --list-keys
#gpg --list-secret-keys
Then i used gpg to decrypt the files:
gpg gpg -o output-file --decrypt encrypted_file
This did the trick and i was able to decrypt all the files one by one.
Adsense 1
Saturday, August 26, 2006
PGP - Encryption, mails and files
Wednesday, August 23, 2006
Converting Mysql table to CSV
Trying to export the data from mysql to csv will end up in creating the csv file in the mysql data directory (/var/lib/mysql). Use this method to covert the individual tables from mysql to CSV format
$mysql -u <username> -h <hostname> <databasename> -p -B -e "select * from table;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > test.csv
Note: The whole command above must essentially be in a single line
$mysql -u <username> -h <hostname> <databasename> -p -B -e "select * from table;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > test.csv
Note: The whole command above must essentially be in a single line
Thursday, August 17, 2006
My New Tech Blog
I had a tech blog at livejournal and making new post there was time consuming(had to login to livejournal to post new entries). Mails to journal id was allowed only for paid customers.
I have a different blog for my personal events here which allowed me to post the from anywhere by just sending a mail. I like this feature very much in blogger and am posting all the blogs i had in liverjournal to blogger(this blog). I will be using this new blog to post all my further findings/experiments in Linux and other technologies that interests me.
I am posting the blogs here from livejournal with the same date i posted there so as to remember things and days. So you will see back dated posts here.
Thanks! for reading this.
I have a different blog for my personal events
I am posting the blogs here from livejournal with the same date i posted there so as to remember things and days. So you will see back dated posts here.
Thanks! for reading this.
Subscribe to:
Posts (Atom)