Encrypting / decrypting without importing keys?

Eric B. ebenze at hotmail.com
Wed Oct 6 19:32:37 CEST 2004


> > I'm new to GnuPG and was wondering if it was possible to encrypt and/or
> > decrypt without needing to first import the keys into gpg.  I'm looking
> > to use gpg to encrypt data from a web page, where the user specifies the
> > public key to encrypt data, and then eventually a private key to decrypt
> > it.
> >
> > Additionally, is there anyway I can specify the keys to use as coming
> > from standard in or standard out instead of being file based?
> ====================
>
> you can save a key into a file and use something like:
>
>    gpg --no-default-keyring --keyring key-file --trust-model always -ear
user
>
> this hack allows an encryption key to be used without importing it. how to
> convert an ascii key into a binary key is an exercise i leave to the
> reader; it isn't that hard to do but an ascii key won't work.
>
> also, see if <http://business-php.com/opensource/gpg_encrypt/> does most
> of what you need. it sounds like you'd have to tweak this, but the major
> work is done.


Thanks!  That was just what I needed.  However, have a followup question
though.  I now need to programatically convert the ascii key to a binary
key.  Doing a quick export of a key in binary format and in armoured format,
I noticed that I can base64 encode the binary key and get an almost exact
match to the armoured format.   However, there seem to be five characters on
a newline (=oge7) that appear in the armoured key which are not my base64
conversion of the binary key.   I can only assume them to be some form of a
CRC check, but am not sure.  Is there armoured version of the key always
followed by a CRC check?  If so, is it a CRC32 check?  CRC24? etc?  How can
I tell when/where the key ends and the CRC checks starts?   Does a armoured
key always end with a specific character?  Is there a doc which specifies
the format of the armoured key somewhere?

Thanks!

Eric






More information about the Gnupg-users mailing list