How do you generate an .asc file from pgp public key?
Usually, a .asc
file is an ASCII-armored representation of key material (or a signature). Your shirish-public-key.txt
looks like it’s just that, so if you’re sure it contains the right information you could simply rename it, as you suggest. (I doubt it contains your public key though — that should start with -----BEGIN PGP PUBLIC KEY BLOCK-----
.) If a file contains “binary” data (which I’m guessing is what you mean when you say it looks like an archive), it’s not an ASCII file and wouldn’t usually be named with a .asc
extension.
To export your key in this format, from your keyring rather than an existing file (thus ensuring it contains the correct data), run
gpg --armor --export YOUR_FINGERPRINT > pubkey.asc
To make things easier, files are often named by their key id; in my case:
gpg --armor --export "79D9 C58C 50D6 B5AA 65D5 30C1 7597 78A9 A36B 494F" > 0x759778A9A36B494F.asc
There are various options you can use to tweak the exported data; for example, --export-options export-minimal
will strip most signatures from the key, greatly reducing its size (but also its utility for people who care about the web of trust).