in reply to Crypt::OpenPGP PassphraseCallback example please
Post your code thus far. The Crypt::OpenPGP POD does have example code. What have you tried?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Crypt::OpenPGP PassphraseCallback example please
by boat73 (Scribe) on Mar 17, 2004 at 00:18 UTC | |
#### creating private/public key files, seems to work fine #### Then I encrypt the data using the private key, seems to work This is where I seem to lose it. I now want to decrypt $crypt using the secret key. I tried this this but know now that I am not understanding the passphrasecallback. I have read the documentation but can't seem to grasp it. After all the time I spent getting he modules installed and functioning on win32 I think I have brain burn. The module looks like just what I need and I would appreciate any assistance with understanding it. Thanks in advance. boat73
Edited by Chady -- fixed code tags. | [reply] [d/l] [select] |
by hv (Prior) on Mar 17, 2004 at 11:49 UTC | |
I think the examples given are a bit misleading; the key part is the definition of the PassphraseCallback argument in the docs, in particular the last part:
In either case, the callback routine should return the
passphrase, a scalar string.
The various examples sometimes leave off the final call to _prompt(), and since it is an undocumented internal routine it isn't obvious that this is doing the guts of the work: showing a prompt, setting noecho, getting the text from the user's input, and returning the resulting string. I'd suggest looking at the code for _prompt() in the module (it's in the top-level Crypt/OpenPGP.pm) to see what needs doing, and then (probably) avoid using ths undocumented interface directly by copying what you need out of there. Here's some similar code I use in a less critical situation, which copes with the possibility that Term::Readkey isn't installed by letting the password be entered unhidden:
Hugo | [reply] [d/l] [select] |
by boat73 (Scribe) on Mar 17, 2004 at 13:59 UTC | |
decryption failed: Seckey unlock failed: Bad checksum
Thanks boat73 | [reply] [d/l] |