> function decryptMessage(message_armored, priv_key_armored) {
>   private_key = openpgp.key.readArmored(priv_key_armored);

is {keys: Array<module:key~Key>, err: (Array<Error>|null)}
therefore private_key.keys[0] is the key
call private_key.keys[0].decrypt

>   encrypted_message = openpgp.message.readArmored(message_armored);
>  return decrypted_message = openpgp.decryptMessage(private_key, 
> encrypted_message);

openpgp.decryptMessage(private_key.keys[0], encrypted_message);

> }

On Tue, Jun 3, 2014 at 4:33 PM, Fernando Schuindt
<[email protected]> wrote:
> Well there's must be something wrong in what I am doing...
> I have tried to decrypt, the response was 'true' but still the same error...
>
>> decrypted_message = decryptMessage(encrypted_message,
>> joey.privateKeyArmored);
> TypeError: Object #<Object> has no method 'getPrivateKeyPacket'
>     at Message.decrypt
> (/Users/fschuindt/node_modules/openpgp/src/message.js:95:37)
>     at /Users/fschuindt/node_modules/openpgp/src/openpgp.js:117:15
>     at execute (/Users/fschuindt/node_modules/openpgp/src/openpgp.js:253:14)
>     at Object.decryptMessage
> (/Users/fschuindt/node_modules/openpgp/src/openpgp.js:116:10)
>     at decryptMessage (repl:4:36)
>     at repl:1:21
>     at REPLServer.self.eval (repl.js:110:21)
>     at repl.js:249:20
>     at REPLServer.self.eval (repl.js:122:7)
>     at Interface.<anonymous> (repl.js:239:12)
>
>
> Check this complete node output:
> https://gist.github.com/fschuindt/7056f2d3ca2b6539294d
>
>
>
>
> 2014-06-03 5:29 GMT-03:00 Thomas Oberndörfer <[email protected]>:
>
>> > joey = generateKeyPair("Joey D. Adams");
>>
>> So joey will be: {key: module:key~Key, privateKeyArmored: String,
>> publicKeyArmored: String}
>>
>> joey.key has the decrypt methods and you can use it for
>> openpgp.decryptMessage
>>
>> Thomas
>>
>> On Tue, Jun 3, 2014 at 12:31 AM, Fernando Schuindt
>> <[email protected]> wrote:
>> > I am still stuck in this problem. :(
>> >
>> >
>> > 2014-05-31 20:00 GMT-03:00 Fernando Schuindt <[email protected]>:
>> >
>> >> I have tried to decrypt the private key with no success. Here is a
>> >> example
>> >> of my full context with OpenPGP.js:
>> >> https://gist.github.com/anonymous/373b604c48e1269df5e8
>> >>
>> >> For private_key in line 5 there's no .decrypt or .decryptKeyPacket
>> >> method.
>> >>
>> >> Any tip of what I am doing wrong?
>> >>
>> >>
>> >>
>> >> 2014-05-30 11:51 GMT-03:00 Sean Colyer <[email protected]>:
>> >>
>> >>> I'm guessing you need to decrypt your private key. look at using
>> >>> `my_private_key.decrypt` (or `decryptKeyPacket`).
>> >>>
>> >>> If that doesn't help, can you give us more context of where the
>> >>> exception
>> >>> is coming from in the openpgp.js library?
>> >>>
>> >>>
>> >>> On Thu, May 29, 2014 at 9:13 PM, Fernando Schuindt
>> >>> <[email protected]> wrote:
>> >>>>
>> >>>> Thank you very much, Sean, I did not know that to use callbacks I
>> >>>> need
>> >>>> to setup the worker.
>> >>>> So I removed the callback but seems that I am getting a error because
>> >>>> openpgp.decryptMessage is missing a callback(?) (I know that's
>> >>>> optional,
>> >>>> that's why it's weird to me). The error is: "Uncaught TypeError:
>> >>>> undefined
>> >>>> is not a function".
>> >>>>
>> >>>> I am running a web environment btw, It's a Ruby on Rails app.
>> >>>>
>> >>>> Here is a small part of my code:
>> >>>> https://gist.github.com/anonymous/e35708ecd93c3f13062f
>> >>>>
>> >>>> Any tip?
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> 2014-05-29 21:34 GMT-03:00 Sean Colyer <[email protected]>:
>> >>>>
>> >>>>> Are you trying to use callbacks and seeing this error? You should
>> >>>>> make
>> >>>>> sure you're not passing in callback arguments if you don't want to
>> >>>>> use web
>> >>>>> workers.
>> >>>>>
>> >>>>> Also, is this in the browser or what environment are you running
>> >>>>> against?
>> >>>>>
>> >>>>> Sean
>> >>>>>
>> >>>>>
>> >>>>> On Thu, May 29, 2014 at 7:55 PM, Fernando Schuindt
>> >>>>> <[email protected]> wrote:
>> >>>>>>
>> >>>>>> Really sorry for the topic subject, I forgot to change.
>> >>>>>>
>> >>>>>>
>> >>>>>> 2014-05-29 20:53 GMT-03:00 Fernando Schuindt
>> >>>>>> <[email protected]>:
>> >>>>>>
>> >>>>>>> Hello guys,
>> >>>>>>>
>> >>>>>>> I am starting to develop a webapp that uses OpenPGP.js to encrypt
>> >>>>>>> a
>> >>>>>>> chat. Recently I've decided to update my OpenPGP.js version from
>> >>>>>>> 0.4.1 to
>> >>>>>>> 0.6.0, so far some things have changed. After adapted my code to
>> >>>>>>> the new
>> >>>>>>> version I started to get an error: "Uncaught Error: You need to
>> >>>>>>> set the
>> >>>>>>> worker path!".
>> >>>>>>>
>> >>>>>>> It seems that's because I have missed to add the
>> >>>>>>> openpgp.worker.min.js, right?
>> >>>>>>> I have tried to add it but nothing.
>> >>>>>>>
>> >>>>>>> I thought that use the worker was optional, I can't pretty much
>> >>>>>>> understand what's happening. I am needing some help. :(
>> >>>>>>>
>> >>>>>>> (It was working good before the update)
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> --
>> >>>>>> Atenciosamente,
>> >>>>>> Fernando Schuindt
>> >>>>>>
>> >>>>>> _______________________________________________
>> >>>>>>
>> >>>>>> http://openpgpjs.org
>> >>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> _______________________________________________
>> >>>>>
>> >>>>> http://openpgpjs.org
>> >>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> Atenciosamente,
>> >>>> Fernando Schuindt
>> >>>>
>> >>>> _______________________________________________
>> >>>>
>> >>>> http://openpgpjs.org
>> >>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>> >>>
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>>
>> >>> http://openpgpjs.org
>> >>> Subscribe/unsubscribe: http://list.openpgpjs.org
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Atenciosamente,
>> >> Fernando Schuindt
>> >
>> >
>> >
>> >
>> > --
>> > Atenciosamente,
>> > Fernando Schuindt
>> >
>> > _______________________________________________
>> >
>> > http://openpgpjs.org
>> > Subscribe/unsubscribe: http://list.openpgpjs.org
>> _______________________________________________
>>
>> http://openpgpjs.org
>> Subscribe/unsubscribe: http://list.openpgpjs.org
>
>
>
>
> --
> Atenciosamente,
> Fernando Schuindt
>
> _______________________________________________
>
> http://openpgpjs.org
> Subscribe/unsubscribe: http://list.openpgpjs.org
_______________________________________________

http://openpgpjs.org
Subscribe/unsubscribe: http://list.openpgpjs.org

Reply via email to