Hi Michael,

From where did you get openpgp.min.js? I have build it from master and
it works with the changes noted above (on Firefox 26.0 btw.)

I changed your html to

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script src="http://code.jquery.com/jquery-1.11.0.min.js";></script>
<script src="openpgp.min.js"></script>

</head>
<body>
<script langue="text/javascript">
$(document).ready(function() {
  var publicKey = openpgp.key.readArmored($("#myPublicKey").val());
  alert(openpgp.encryptMessage(publicKey.keys,'MyTextToEncrypt'));
});
</script>

<form>
<textarea id=myPublicKey>-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: BCPG C# v1.6.1.0

mQENBFL41IABCADMN0zTLKanfWWltxN2adJhfPd+ycDLoLKMgda77jbMhzHS1Fee
NtzAzzy0UoQ7xmIBS31LvtE7cb4UvDGj5nWAzgeqhVSULnRpQQN20oFwaGewedzk
TV0jdwHianTgWdli0+UmP9zJRPaG2OBGp8FgG5uWDfRuLqOO6zH7jvQtRWCVXu5D
o7RL7hSjwASr4Ye6KlLWjyaPmE+VeEGkJYZO4loXs0tO5HIBRPIRelBCku0gzoKS
LH07SjbpqlcgS4PuhpfoUiYoxKFGbSJKWhLj2k/K4uYaz8LjmbWQVc5eY+i0TEo7
xUuQqvYQCduhhlHmwSbVTcw9hWgS3urdFT3rABEBAAG0DHRlc3RAdGVzdC5kZYkB
HAQQAQIABgUCUvjUgAAKCRDX3VE5PWbY7JxFB/9YwJp8WcZAUIXocWU0sl73UPEy
KGb9y2qomN7JvC9HEGEx1RkvgEEZDqo1CaIuq7/M3dFTkb1eiPfSO52SOT9X22cj
KhPVwcXempCl5qKn993Bp4bfRe/4G7uJGPx2Ou3hB+seaMjr1y6wjlGf5HQiazSM
oET8yR1rXlGgI07PpjrSVxaCFOnBmzoom+Gaxs4dAJ/CX30c+g1RrKqaHUo0VCjp
d16vouO+OD/djrkbNunzmLEYFV4L9Y7n9eDzkuT9rZUa0uZ7UM5s2XrYcTZoShKP
0vpoWoJLp5FGDccDXn4vGVHH3MCsb/At/VsgNx0i3KeB/o8Ac7W46J9ctrSS
=sx+3
-----END PGP PUBLIC KEY BLOCK-----</textarea>
</form>
</body>
</html>

2014-02-10 15:25 GMT+01:00 Michael Kreuzer <[email protected]>:
> Hi Johannes,
>
> no I still get the same error:
> a.forEach is not a function.
>
> I also read the readme.md file before. Problem with the readme is, that it 
> doesn't describe how to use openpgp in the minified version.
> It’s only about the "source code“ version. And I just want to get the 
> minified version running.
>
> Best regards,
> Michael
>
> Am 10.02.2014 um 14:59 schrieb Johannes Jörg Schmidt <[email protected]>:
>
>> Yes, I have just tried it and got the same error. You also have to
>> read the key via `openpgp.key.readArmored` as documented in the
>> README:
>>
>> $(document).ready(function() {
>>  var publicKey = openpgp.key.readArmored($("#myPublicKey").val());
>>  alert(openpgp.encryptMessage(publicKey.keys,'MyTextToEncrypt'));
>> });
>>
>> Greetings
>> Johannes
>>
>> 2014-02-10 15:10 GMT+01:00 Michael Kreuzer <[email protected]>:
>>> Hi Johannes,
>>>
>>> I also tried that, but what I’m getting then is this error message:
>>>
>>> TypeError: a.forEach is not a function
>>>
>>> Best regards,
>>> Michael
>>>
>>> Am 10.02.2014 um 14:48 schrieb Johannes Jörg Schmidt <[email protected]>:
>>>
>>>> I am not very familar with OpenPGP.js yet and haven't tested it so
>>>> excuse me if I am totally wrong, but shouldn't `encryptMessage` be
>>>> called on the `openpgp` namespace?
>>>>
>>>> Eg:
>>>>
>>>> openpgp.encryptMessage($("#myPublicKey").val(),'MyTextToEncrypt')
>>>>
>>>> Greetings
>>>> Johannes
>>>>
>>>> 2014-02-10 14:50 GMT+01:00 Michael Kreuzer <[email protected]>:
>>>>> Hey Christian,
>>>>>
>>>>> that sounds great, but how did you do it exactly?
>>>>>
>>>>> They aren’t in the minified version, but for the test-files in the test
>>>>> directory the require() function is mandatory.
>>>>> I only wanted let Daniel know that I can’t run the tests by simply 
>>>>> including
>>>>> the minified version in the header.
>>>>>
>>>>> I’m not using firebug, but the network tab in my Firefox console (which 
>>>>> does
>>>>> basically the same) says that the openpgp.min.js file is loaded.
>>>>>
>>>>> Yes I’m waiting for document.ready.
>>>>> I only do this:
>>>>>
>>>>> <!DOCTYPE html>
>>>>> <html>
>>>>> <head>
>>>>> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
>>>>> <script src="../jQuery/jquery-1.9.1.js"></script>
>>>>> <script src="./openpgp.min.js"></script>
>>>>>
>>>>> </head>
>>>>> <body>
>>>>> <script langue="text/javascript">
>>>>> $(document).ready(function() {
>>>>>
>>>>>      alert(encryptMessage($("#myPublicKey").val(),'MyTextToEncrypt'));
>>>>> });
>>>>> </script>
>>>>>
>>>>> <form>
>>>>> <textarea id=myPublicKey>-----BEGIN PGP PUBLIC KEY BLOCK-----
>>>>> Version: BCPG C# v1.6.1.0
>>>>>
>>>>> mQENBFL41IABCADMN0zTLKanfWWltxN2adJhfPd+ycDLoLKMgda77jbMhzHS1Fee
>>>>> NtzAzzy0UoQ7xmIBS31LvtE7cb4UvDGj5nWAzgeqhVSULnRpQQN20oFwaGewedzk
>>>>> TV0jdwHianTgWdli0+UmP9zJRPaG2OBGp8FgG5uWDfRuLqOO6zH7jvQtRWCVXu5D
>>>>> o7RL7hSjwASr4Ye6KlLWjyaPmE+VeEGkJYZO4loXs0tO5HIBRPIRelBCku0gzoKS
>>>>> LH07SjbpqlcgS4PuhpfoUiYoxKFGbSJKWhLj2k/K4uYaz8LjmbWQVc5eY+i0TEo7
>>>>> xUuQqvYQCduhhlHmwSbVTcw9hWgS3urdFT3rABEBAAG0DHRlc3RAdGVzdC5kZYkB
>>>>> HAQQAQIABgUCUvjUgAAKCRDX3VE5PWbY7JxFB/9YwJp8WcZAUIXocWU0sl73UPEy
>>>>> KGb9y2qomN7JvC9HEGEx1RkvgEEZDqo1CaIuq7/M3dFTkb1eiPfSO52SOT9X22cj
>>>>> KhPVwcXempCl5qKn993Bp4bfRe/4G7uJGPx2Ou3hB+seaMjr1y6wjlGf5HQiazSM
>>>>> oET8yR1rXlGgI07PpjrSVxaCFOnBmzoom+Gaxs4dAJ/CX30c+g1RrKqaHUo0VCjp
>>>>> d16vouO+OD/djrkbNunzmLEYFV4L9Y7n9eDzkuT9rZUa0uZ7UM5s2XrYcTZoShKP
>>>>> 0vpoWoJLp5FGDccDXn4vGVHH3MCsb/At/VsgNx0i3KeB/o8Ac7W46J9ctrSS
>>>>> =sx+3
>>>>> -----END PGP PUBLIC KEY BLOCK-----</textarea>
>>>>> </form>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>>
>>>>> #######End of Code####
>>>>>
>>>>> Result:
>>>>> ReferenceError: encryptMessage is not defined
>>>>>
>>>>> And by the way: thanks again for the help!
>>>>>
>>>>> Best regards,
>>>>> Michael
>>>>>
>>>>>
>>>>> Am 10.02.2014 um 13:08 schrieb Christian Hoffmann 
>>>>> <[email protected]>:
>>>>>
>>>>> Hi Michael.
>>>>>
>>>>> I got that exact same version minified and running.
>>>>>
>>>>> does firebug display in the network tab if it has the file loaded?
>>>>>
>>>>> the require instructions should actually not be in the minified version.
>>>>>
>>>>> are you waiting for all files to be loaded before using tge lib?
>>>>>
>>>>> Greetings,
>>>>> Christian
>>>>>
>>>>> On Feb 10, 2014 1:02 PM, "Michael Kreuzer" <[email protected]> wrote:
>>>>>>
>>>>>> Hi Daniel,
>>>>>>
>>>>>> I already had a look at the examples, but the problem is that they aren’t
>>>>>> working with the minified version.
>>>>>> The reason is for example grunts' require() function which isn’t part of
>>>>>> the minified file.
>>>>>>
>>>>>> In basic.js they do this:
>>>>>> var openpgp = typeof window != 'undefined' && window.openpgp ?
>>>>>> window.openpgp : require('../../src/index‘);
>>>>>>
>>>>>> Before calling:
>>>>>> openpgp.encryptMessage();
>>>>>>
>>>>>> Therefore the example isn’t working for me.
>>>>>> As you got 0.3.2 running..may I ask how you did this with the minified
>>>>>> file?
>>>>>> Because I only have 2 more weeks for my bachelors thesis to be finished,
>>>>>> this is starting to get a little bit urgent :P
>>>>>> So if you - or someone else - could solve my problem I would be really
>>>>>> thankful.
>>>>>>
>>>>>> Best regards,
>>>>>> Michael
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Am 10.02.2014 um 06:41 schrieb Daniel <[email protected]>:
>>>>>>
>>>>>> Michael,
>>>>>>
>>>>>> For some easy examples on how to use the current version of openpgpjs,
>>>>>> check out the file at openpgpjs/test/general/basic.js. Feel free to ask
>>>>>> questions if you run into problems after looking at the examples in that
>>>>>> file.
>>>>>>
>>>>>> You no longer need to call openpgp.init.  All of the libraries you need
>>>>>> are contained in the min file.
>>>>>>
>>>>>> I am developing a privly application [0][1] to enable users to send
>>>>>> encrypted messages.  Because of the existing privly framework I get the
>>>>>> local trust that comes with using an extension. What is really great is 
>>>>>> the
>>>>>> application can be used on any website.  In the near future I should have
>>>>>> some code to share.
>>>>>>
>>>>>> Best,
>>>>>> Daniel
>>>>>>
>>>>>> [0] http://vimeo.com/83258935
>>>>>> [1] https://priv.ly/
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Feb 9, 2014 at 2:15 PM, Michael Kreuzer <[email protected]>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hey Daniel,
>>>>>>>
>>>>>>> thank you again for the help. Now things are a little bit clearer :)
>>>>>>> At the moment I just want to get the latest minified version running.
>>>>>>>
>>>>>>> So I included this file:
>>>>>>> <script src="./openpgp.min.js"></script>
>>>>>>>
>>>>>>> and called the function:
>>>>>>> encryptMessage()
>>>>>>>
>>>>>>> When I now trigger the function, the debugger tells me „ReferenceError:
>>>>>>> encryptMessage is not defined“.
>>>>>>>
>>>>>>> -May it be possible that I have to instantiate an openpgp object or
>>>>>>> something?
>>>>>>> Because in Version 0.1.0 I had to call
>>>>>>> openpgp.init();
>>>>>>> -I didn’t manually include any libraries, are they automatically 
>>>>>>> included
>>>>>>> in openpgp.min.js?
>>>>>>>
>>>>>>> BTW: What kind of PGP app are you developing?
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Michael
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Am 09.02.2014 um 19:41 schrieb Daniel <[email protected]>:
>>>>>>>
>>>>>>> Michael,
>>>>>>>
>>>>>>> Let me first clarify my previous email.  Following the previous commands
>>>>>>> will bring you to a place where you can run the tests.  After running 
>>>>>>> the
>>>>>>> grunt command you will notice the lib folder with the files you 
>>>>>>> mentioned
>>>>>>> exist.  So then you can run the tests while in the root of the repo 
>>>>>>> with the
>>>>>>> command 'mocha'.  If the command mocha is not found, you can use:
>>>>>>>
>>>>>>> npm install -g mocha
>>>>>>>
>>>>>>> to install mocha globally on your machine.
>>>>>>>
>>>>>>> I have been able to use the minified version of openpgpjs in browser
>>>>>>> extensions without any issue.  The reason all of those are required is 
>>>>>>> the
>>>>>>> testing framework that openpgpjs uses, mocha, requires them.  So you do 
>>>>>>> not
>>>>>>> need to install them if you do not want to run the tests.
>>>>>>>
>>>>>>> Best,
>>>>>>> Daniel
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Feb 9, 2014 at 4:28 AM, Michael Kreuzer <[email protected]>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi Daniel,
>>>>>>>>
>>>>>>>> thank you very much for your guide!
>>>>>>>> Are grunt, npm and node.js also mandatory if you only want to use the
>>>>>>>> minified version?
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Michael
>>>>>>>>
>>>>>>>> Am 08.02.2014 um 19:57 schrieb Daniel <[email protected]>:
>>>>>>>>
>>>>>>>> Hey Michael,
>>>>>>>>
>>>>>>>> I was able to get the unit tests running by installing grunt with the
>>>>>>>> command:
>>>>>>>>
>>>>>>>> npm install -g grunt-cli
>>>>>>>>
>>>>>>>> This assumes that node.js and npm are installed on your machine.  This
>>>>>>>> will install the grunt-cli in a global context, so that it is 
>>>>>>>> available to
>>>>>>>> you regardless of what directory you are in.
>>>>>>>>
>>>>>>>> Then make sure you are in the root of the openpgp.js repo and type:
>>>>>>>>
>>>>>>>> npm install
>>>>>>>>
>>>>>>>> and then:
>>>>>>>>
>>>>>>>> grunt
>>>>>>>>
>>>>>>>> to run the tests.  For more details check out the docs.
>>>>>>>>
>>>>>>>> I too am working on a pgp based web app.  It's not in a place where it
>>>>>>>> would be useful to share right now, but I'll be sure to share the repo 
>>>>>>>> with
>>>>>>>> the list when it does anything useful.
>>>>>>>>
>>>>>>>> Best,
>>>>>>>> Daniel
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Feb 6, 2014 at 8:47 AM, Michael Kreuzer 
>>>>>>>> <[email protected]>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hello Payk,
>>>>>>>>>
>>>>>>>>> thanks for the quick reponse!
>>>>>>>>> I had a look into the unit tests but there was a dead link to
>>>>>>>>> openpgp.js. So I changed it. Next problem was that it refers to:
>>>>>>>>>   <script src="lib/chai.js"></script>
>>>>>>>>>   <script src="lib/mocha.js"></script>
>>>>>>>>>
>>>>>>>>> But there is no „lib" folder at all. So I tried to download mocha, but
>>>>>>>>> you would have node.js installed.
>>>>>>>>> And there are also some NPM commands. This seems to be a packet 
>>>>>>>>> manager
>>>>>>>>> or something.
>>>>>>>>>
>>>>>>>>> I don’t have any experience with node.js, mocha, chai, npm…so this is 
>>>>>>>>> a
>>>>>>>>> little bit confusing me, because node.js e.g. seems to be server side
>>>>>>>>> javascript (if I got that right).
>>>>>>>>> But why would one need server side actions for a javascript openpgp
>>>>>>>>> program?
>>>>>>>>> (Despite I want to get to know these techniques, I unfortunately don’t
>>>>>>>>> have the time to learn all these at the moment).
>>>>>>>>>
>>>>>>>>> Is there no simple way to just get this thing running with pure JS 
>>>>>>>>> like
>>>>>>>>> in version 0.1.0?
>>>>>>>>> I just included the libraries, called the functions and it worked.
>>>>>>>>>
>>>>>>>>> Yes of course, and I would also have nothing against working together.
>>>>>>>>> May I ask where you are from? Because your name looks pretty german :)
>>>>>>>>> So what is the topic you are working on Payk?
>>>>>>>>>
>>>>>>>>> Michael
>>>>>>>>>
>>>>>>>>> Am 06.02.2014 um 15:11 schrieb Christian Hoffmann
>>>>>>>>> <[email protected]>:
>>>>>>>>>
>>>>>>>>> Hello Herr Kreuzer.
>>>>>>>>>
>>>>>>>>> I would have a look into the unit tests.
>>>>>>>>> they helped me a lot!
>>>>>>>>>
>>>>>>>>> The require function is for the grunt build proccess afaik.
>>>>>>>>> In the minified versions they dont exist.
>>>>>>>>>
>>>>>>>>> Also have a look into the web worker unit tests.
>>>>>>>>> If you don't want the browser to freeze for seconds when generating 
>>>>>>>>> big
>>>>>>>>> keys,
>>>>>>>>> this will help you.
>>>>>>>>>
>>>>>>>>> Another note:
>>>>>>>>> You seem to have allmost the same project as i am doing right now xD
>>>>>>>>> more or less.
>>>>>>>>>
>>>>>>>>> We could exchange ideas or something.
>>>>>>>>>
>>>>>>>>> Greetings,
>>>>>>>>> Payk
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Thu, Feb 6, 2014 at 3:15 PM, Michael Kreuzer
>>>>>>>>> <[email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi @all,
>>>>>>>>>>
>>>>>>>>>> at the moment I’m writing my Bachelor’s Thesis and my topic is to
>>>>>>>>>> integrate the OpenPGP functionality in Facebook chat.
>>>>>>>>>> So you could use my web site to chat encrypted with other FB friends
>>>>>>>>>> (The chat part is done with XMPP using Strophe.js).
>>>>>>>>>> Therefore I’m using openPGP js and I think you guys did a really 
>>>>>>>>>> great
>>>>>>>>>> job. So thanks for the hard work.
>>>>>>>>>> Till now I’ve made it to automatically send and receive encrypted
>>>>>>>>>> messages, to decrypt them, sign (and partly to verify them).
>>>>>>>>>>
>>>>>>>>>> But I did this only in openPGP 0.1.0 and the current version is 
>>>>>>>>>> 0.3.2.
>>>>>>>>>> Now I wanted to migrate, but basicially the whole structure of 
>>>>>>>>>> openpgp
>>>>>>>>>> js has changed.
>>>>>>>>>>
>>>>>>>>>> So here’s my problem:
>>>>>>>>>> a) When I’m using the source code version javascript can’t find the
>>>>>>>>>> „require()“ function.
>>>>>>>>>> I assume this part of node.js / browserify / …
>>>>>>>>>> I don’t have any experience with these plugins, so maybe someone 
>>>>>>>>>> could
>>>>>>>>>> tell me what to do.
>>>>>>>>>>
>>>>>>>>>> b) When I’m using the minified version it simply can’t find the
>>>>>>>>>> functions e.g. „signAndEncryptMessage()".
>>>>>>>>>>
>>>>>>>>>> In Version 0.1.0 the examples helped me a lot.
>>>>>>>>>> Would be nice if someone could give me some help. Thanks in advance!
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Michael
>>>>>>>>>> _______________________________________________
>>>>>>>>>>
>>>>>>>>>> http://openpgpjs.org
>>>>>>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>>
>>>>>>>>> http://openpgpjs.org
>>>>>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>>
>>>>>>>>> http://openpgpjs.org
>>>>>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>>
>>>>>>>> http://openpgpjs.org
>>>>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>>
>>>>>>>> http://openpgpjs.org
>>>>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>>
>>>>>>> http://openpgpjs.org
>>>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>>
>>>>>>> http://openpgpjs.org
>>>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>>
>>>>>> http://openpgpjs.org
>>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>>
>>>>>> http://openpgpjs.org
>>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>
>>>>> _______________________________________________
>>>>>
>>>>> http://openpgpjs.org
>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>>
>>>>> http://openpgpjs.org
>>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>> _______________________________________________
>>>>
>>>> http://openpgpjs.org
>>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>>>
>>> _______________________________________________
>>>
>>> http://openpgpjs.org
>>> Subscribe/unsubscribe: http://list.openpgpjs.org
>> _______________________________________________
>>
>> http://openpgpjs.org
>> Subscribe/unsubscribe: http://list.openpgpjs.org
>
> _______________________________________________
>
> http://openpgpjs.org
> Subscribe/unsubscribe: http://list.openpgpjs.org
_______________________________________________

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

Reply via email to