Take advantage of the largest STIC '12 conference discounts by registering this week

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
111 messages Options
1234 ... 6
Reply | Threaded
Open this post in threaded view
|

Take advantage of the largest STIC '12 conference discounts by registering this week

Monty Williams-3
Make sure not to miss the keynotes on Google Dart and Massive Parallelism + OOP at the 2012 STIC conference in Biloxi, MS on March 18-21. Geek out on the technical sessions and learn what's coming in GemStone/S 3.1. Stay for Camp Smalltalk on March 22-23, and afterwards catch the Doobie Brothers concert.

Register by Friday Jan 13th to get the biggest discount.

See you there!

-- Monty
Reply | Threaded
Open this post in threaded view
|

Cloudfork under Gemstone GLASS with Pharo and Seaside

Larry Kellogg
Hello,
 I am in the process of moving my application over to GLASS. I had been developing using one-click Pharo/Seaside with Cloudfork and all of my calls
to the Amazon services were working correctly.

 Now, I'm trying to do the same thing under Gemstone GLASS. I have loaded a bunch of the Cloudfork packages and
I am able to instantiate an S3 bucket in Amazon but I am running into authentication problems when I try to create something in the bucket, due to missing pieces of the
SHA1 class. Are there directions somewhere on how to set this up under GLASS? Has it been done before?

  Also, I need to login into Gemstone as SystemUser in order to add some primitives to the class SHA1 when it loads, but I am unable to
get that to work. I read somewhere that it is possible to add a CompilePrimitives to a UserProfile but I'm not sure how to do that.
I guess I would add it to DataCurator.

 Thanks for the help!

 Larry
Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

James Foster-8
Hi Larry,

Welcome to GLASS; I hope we can help get you going. Unfortunately, I'm not familiar with the SHA1 issues. As to the primitives, tell us more about what you need to add to SHA1 and what you have with it.

James

On Jan 11, 2012, at 2:07 PM, Lawrence Kellogg wrote:

> Hello,
> I am in the process of moving my application over to GLASS. I had been developing using one-click Pharo/Seaside with Cloudfork and all of my calls
> to the Amazon services were working correctly.
>
> Now, I'm trying to do the same thing under Gemstone GLASS. I have loaded a bunch of the Cloudfork packages and
> I am able to instantiate an S3 bucket in Amazon but I am running into authentication problems when I try to create something in the bucket, due to missing pieces of the
> SHA1 class. Are there directions somewhere on how to set this up under GLASS? Has it been done before?
>
>  Also, I need to login into Gemstone as SystemUser in order to add some primitives to the class SHA1 when it loads, but I am unable to
> get that to work. I read somewhere that it is possible to add a CompilePrimitives to a UserProfile but I'm not sure how to do that.
> I guess I would add it to DataCurator.
>
> Thanks for the help!
>
> Larry

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

Larry Kellogg
Hello James,
  Thanks for the reply. Your blog is excellent, by the way, very helpful. I searched in there for an answer, and in other places,
but cannot seem to find a solution.

On Jan 11, 2012, at 6:45 PM, James Foster wrote:

> Hi Larry,
>
> Welcome to GLASS; I hope we can help get you going. Unfortunately, I'm not familiar with the SHA1 issues. As to the primitives, tell us more about what you need to add to SHA1 and what you have with it.
>

  So, SHA1 is in System-Hashing, SqueakSource/Pharo.

  The first primitive that I need is:

primHasSecureHashPrimitive
        "Answer true if this platform has primitive support for the Secure Hash Algorithm."

        <primitive: 'primitiveHasSecureHashPrimitive' module: 'DSAPrims'>
        ^ false

There might be other primitive-related problems but my code crashes trying to call this non-existent method when I try to put something in a bucket.
I am able to instantiate a bucket correctly, as I mentioned.

Strangely, the Bitmap class is missing from GLASS, but it is just a subclass of ArrayedCollection and, so far,
SHA1 does not do much with it.

   I have this horrible feeling that nobody has gotten Cloudfork to run under GLASS. I hope I'm wrong and that it is
not too difficult to get it to work.

  Regards,

  Larry


> James
>
> On Jan 11, 2012, at 2:07 PM, Lawrence Kellogg wrote:
>
>> Hello,
>> I am in the process of moving my application over to GLASS. I had been developing using one-click Pharo/Seaside with Cloudfork and all of my calls
>> to the Amazon services were working correctly.
>>
>> Now, I'm trying to do the same thing under Gemstone GLASS. I have loaded a bunch of the Cloudfork packages and
>> I am able to instantiate an S3 bucket in Amazon but I am running into authentication problems when I try to create something in the bucket, due to missing pieces of the
>> SHA1 class. Are there directions somewhere on how to set this up under GLASS? Has it been done before?
>>
>> Also, I need to login into Gemstone as SystemUser in order to add some primitives to the class SHA1 when it loads, but I am unable to
>> get that to work. I read somewhere that it is possible to add a CompilePrimitives to a UserProfile but I'm not sure how to do that.
>> I guess I would add it to DataCurator.
>>
>> Thanks for the help!
>>
>> Larry
>

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

Larry Kellogg
In reply to this post by James Foster-8

On Jan 11, 2012, at 6:45 PM, James Foster wrote:

> Hi Larry,
>
> Welcome to GLASS; I hope we can help get you going. Unfortunately, I'm not familiar with the SHA1 issues. As to the primitives, tell us more about what you need to add to SHA1 and what you have with it.
>

  Here is another SHA1 primitive that fails upon load:

Compile error in Class: #'SHA1' method:    primExpandBlock: aByteArray into: wordBitmap
           "Expand the given 64-byte buffer into the given Bitmap of length 80."
   
           <primitive: 'primitiveExpandBlock' module: 'DSAPrims'>
 *          ^1         ^2                                             *******
           ^ self primitiveFailed
 *         ^3                                                         *******

1: [1041] Only SystemUser may compile a primitive or protected method.
2: [1021] expected an integer
3: [1014] expected a primary expression



> James
>
> On Jan 11, 2012, at 2:07 PM, Lawrence Kellogg wrote:
>
>> Hello,
>> I am in the process of moving my application over to GLASS. I had been developing using one-click Pharo/Seaside with Cloudfork and all of my calls
>> to the Amazon services were working correctly.
>>
>> Now, I'm trying to do the same thing under Gemstone GLASS. I have loaded a bunch of the Cloudfork packages and
>> I am able to instantiate an S3 bucket in Amazon but I am running into authentication problems when I try to create something in the bucket, due to missing pieces of the
>> SHA1 class. Are there directions somewhere on how to set this up under GLASS? Has it been done before?
>>
>> Also, I need to login into Gemstone as SystemUser in order to add some primitives to the class SHA1 when it loads, but I am unable to
>> get that to work. I read somewhere that it is possible to add a CompilePrimitives to a UserProfile but I'm not sure how to do that.
>> I guess I would add it to DataCurator.
>>
>> Thanks for the help!
>>
>> Larry
>

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

James Foster-8
In reply to this post by Larry Kellogg
Hi Larry,

Now I see what you are doing with primitives. It turns out that each dialect of Smalltalk has its own primitive syntax, and GemStone is different from Squeak. What you really need is the FFI feature that is new with 3.0 (and I'm working on enhancements that should be in 3.1 later this year).

Are you using GemStone/S 64 Bit version 2.4.x or 3.0.1?

-James

On Jan 11, 2012, at 4:01 PM, Lawrence Kellogg wrote:

> Hello James,
>  Thanks for the reply. Your blog is excellent, by the way, very helpful. I searched in there for an answer, and in other places,
> but cannot seem to find a solution.
>
> On Jan 11, 2012, at 6:45 PM, James Foster wrote:
>
>> Hi Larry,
>>
>> Welcome to GLASS; I hope we can help get you going. Unfortunately, I'm not familiar with the SHA1 issues. As to the primitives, tell us more about what you need to add to SHA1 and what you have with it.
>>
>
>  So, SHA1 is in System-Hashing, SqueakSource/Pharo.
>
>  The first primitive that I need is:
>
> primHasSecureHashPrimitive
> "Answer true if this platform has primitive support for the Secure Hash Algorithm."
>
> <primitive: 'primitiveHasSecureHashPrimitive' module: 'DSAPrims'>
> ^ false
>
> There might be other primitive-related problems but my code crashes trying to call this non-existent method when I try to put something in a bucket.
> I am able to instantiate a bucket correctly, as I mentioned.
>
> Strangely, the Bitmap class is missing from GLASS, but it is just a subclass of ArrayedCollection and, so far,
> SHA1 does not do much with it.
>
>   I have this horrible feeling that nobody has gotten Cloudfork to run under GLASS. I hope I'm wrong and that it is
> not too difficult to get it to work.
>
>  Regards,
>
>  Larry
>
>
>> James
>>
>> On Jan 11, 2012, at 2:07 PM, Lawrence Kellogg wrote:
>>
>>> Hello,
>>> I am in the process of moving my application over to GLASS. I had been developing using one-click Pharo/Seaside with Cloudfork and all of my calls
>>> to the Amazon services were working correctly.
>>>
>>> Now, I'm trying to do the same thing under Gemstone GLASS. I have loaded a bunch of the Cloudfork packages and
>>> I am able to instantiate an S3 bucket in Amazon but I am running into authentication problems when I try to create something in the bucket, due to missing pieces of the
>>> SHA1 class. Are there directions somewhere on how to set this up under GLASS? Has it been done before?
>>>
>>> Also, I need to login into Gemstone as SystemUser in order to add some primitives to the class SHA1 when it loads, but I am unable to
>>> get that to work. I read somewhere that it is possible to add a CompilePrimitives to a UserProfile but I'm not sure how to do that.
>>> I guess I would add it to DataCurator.
>>>
>>> Thanks for the help!
>>>
>>> Larry
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

Larry Kellogg
Hello James,
  Ah, I see why I'm having so much trouble.

On Jan 11, 2012, at 8:49 PM, James Foster wrote:

> Hi Larry,
>
> Now I see what you are doing with primitives. It turns out that each dialect of Smalltalk has its own primitive syntax, and GemStone is different from Squeak. What you really need is the FFI feature that is new with 3.0 (and I'm working on enhancements that should be in 3.1 later this year).
>
> Are you using GemStone/S 64 Bit version 2.4.x or 3.0.1?
>

I'm on this version of GemStone: GemStone64Bit2.4.4.1-x86_64.Linux, to be exact. Is it difficult to upgrade to 3.0?
Does all of the Seaside stuff work ok?

Do you think it will be a big deal to use the new FFI function to call the primitives from SHA1?

Larry


> -James
>
> On Jan 11, 2012, at 4:01 PM, Lawrence Kellogg wrote:
>
>> Hello James,
>> Thanks for the reply. Your blog is excellent, by the way, very helpful. I searched in there for an answer, and in other places,
>> but cannot seem to find a solution.
>>
>> On Jan 11, 2012, at 6:45 PM, James Foster wrote:
>>
>>> Hi Larry,
>>>
>>> Welcome to GLASS; I hope we can help get you going. Unfortunately, I'm not familiar with the SHA1 issues. As to the primitives, tell us more about what you need to add to SHA1 and what you have with it.
>>>
>>
>> So, SHA1 is in System-Hashing, SqueakSource/Pharo.
>>
>> The first primitive that I need is:
>>
>> primHasSecureHashPrimitive
>> "Answer true if this platform has primitive support for the Secure Hash Algorithm."
>>
>> <primitive: 'primitiveHasSecureHashPrimitive' module: 'DSAPrims'>
>> ^ false
>>
>> There might be other primitive-related problems but my code crashes trying to call this non-existent method when I try to put something in a bucket.
>> I am able to instantiate a bucket correctly, as I mentioned.
>>
>> Strangely, the Bitmap class is missing from GLASS, but it is just a subclass of ArrayedCollection and, so far,
>> SHA1 does not do much with it.
>>
>>  I have this horrible feeling that nobody has gotten Cloudfork to run under GLASS. I hope I'm wrong and that it is
>> not too difficult to get it to work.
>>
>> Regards,
>>
>> Larry
>>
>>
>>> James
>>>
>>> On Jan 11, 2012, at 2:07 PM, Lawrence Kellogg wrote:
>>>
>>>> Hello,
>>>> I am in the process of moving my application over to GLASS. I had been developing using one-click Pharo/Seaside with Cloudfork and all of my calls
>>>> to the Amazon services were working correctly.
>>>>
>>>> Now, I'm trying to do the same thing under Gemstone GLASS. I have loaded a bunch of the Cloudfork packages and
>>>> I am able to instantiate an S3 bucket in Amazon but I am running into authentication problems when I try to create something in the bucket, due to missing pieces of the
>>>> SHA1 class. Are there directions somewhere on how to set this up under GLASS? Has it been done before?
>>>>
>>>> Also, I need to login into Gemstone as SystemUser in order to add some primitives to the class SHA1 when it loads, but I am unable to
>>>> get that to work. I read somewhere that it is possible to add a CompilePrimitives to a UserProfile but I'm not sure how to do that.
>>>> I guess I would add it to DataCurator.
>>>>
>>>> Thanks for the help!
>>>>
>>>> Larry
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

James Foster-8
Larry,

Porting an application fromPharo to Version 3.0.1 should be similar to porting to 2.4.4.x. There are a number of new features (some, like FFI are necessary for you) and performance enhancements. On the other hand, people who have existing projects have not rushed to migrate from 2.x to 3.x so there is not as much production experience with Seaside on 3.x. I've been porting some of our tests to use FFI and have found a couple issues with the VM that should be fixed in 3.0.2 (schedule pending based on demand). I have also done a bit to improve the CHeader parsing. It is certainly our goal with FFI that it be fairly easy to use.

In the last hour I've come up with the following in 3.1, and expect that it should be similar in 3.0.1.

First, build a class that represents the library:

| header class |
header := CHeader path: '/usr/include/openssl/sha.h'.
class := header wrapperForLibraryAt: '$GEMSTONE/lib/libcrypto.so'.
class initializeFunctions.
UserGlobals at: class name put: class.


Next, use the library:

| string result bytes |
string := 'Now is the time for all good men to come to the aid of their party'.
result := Crypto new SHA1_: string _: string size _: nil.
bytes := result asArray collect: [:each | each codePoint].
result class -> bytes.
 String->anArray( 249, 92, 62, 72, 141, 165, 168, 163, 45, 23, 107, 2, 204, 233, 20, 250, 66, 180, 132, 37)

I don't know anything about SSH-1, but this seems to match the info I found (using Google) at http://linux.die.net/man/3/sha. Do you think you would need much more?

-James

On Jan 11, 2012, at 6:01 PM, Lawrence Kellogg wrote:

> Hello James,
>  Ah, I see why I'm having so much trouble.
>
> On Jan 11, 2012, at 8:49 PM, James Foster wrote:
>
>> Hi Larry,
>>
>> Now I see what you are doing with primitives. It turns out that each dialect of Smalltalk has its own primitive syntax, and GemStone is different from Squeak. What you really need is the FFI feature that is new with 3.0 (and I'm working on enhancements that should be in 3.1 later this year).
>>
>> Are you using GemStone/S 64 Bit version 2.4.x or 3.0.1?
>>
>
> I'm on this version of GemStone: GemStone64Bit2.4.4.1-x86_64.Linux, to be exact. Is it difficult to upgrade to 3.0?
> Does all of the Seaside stuff work ok?
>
> Do you think it will be a big deal to use the new FFI function to call the primitives from SHA1?
>
> Larry
>
>
>> -James
>>
>> On Jan 11, 2012, at 4:01 PM, Lawrence Kellogg wrote:
>>
>>> Hello James,
>>> Thanks for the reply. Your blog is excellent, by the way, very helpful. I searched in there for an answer, and in other places,
>>> but cannot seem to find a solution.
>>>
>>> On Jan 11, 2012, at 6:45 PM, James Foster wrote:
>>>
>>>> Hi Larry,
>>>>
>>>> Welcome to GLASS; I hope we can help get you going. Unfortunately, I'm not familiar with the SHA1 issues. As to the primitives, tell us more about what you need to add to SHA1 and what you have with it.
>>>>
>>>
>>> So, SHA1 is in System-Hashing, SqueakSource/Pharo.
>>>
>>> The first primitive that I need is:
>>>
>>> primHasSecureHashPrimitive
>>> "Answer true if this platform has primitive support for the Secure Hash Algorithm."
>>>
>>> <primitive: 'primitiveHasSecureHashPrimitive' module: 'DSAPrims'>
>>> ^ false
>>>
>>> There might be other primitive-related problems but my code crashes trying to call this non-existent method when I try to put something in a bucket.
>>> I am able to instantiate a bucket correctly, as I mentioned.
>>>
>>> Strangely, the Bitmap class is missing from GLASS, but it is just a subclass of ArrayedCollection and, so far,
>>> SHA1 does not do much with it.
>>>
>>> I have this horrible feeling that nobody has gotten Cloudfork to run under GLASS. I hope I'm wrong and that it is
>>> not too difficult to get it to work.
>>>
>>> Regards,
>>>
>>> Larry
>>>
>>>
>>>> James
>>>>
>>>> On Jan 11, 2012, at 2:07 PM, Lawrence Kellogg wrote:
>>>>
>>>>> Hello,
>>>>> I am in the process of moving my application over to GLASS. I had been developing using one-click Pharo/Seaside with Cloudfork and all of my calls
>>>>> to the Amazon services were working correctly.
>>>>>
>>>>> Now, I'm trying to do the same thing under Gemstone GLASS. I have loaded a bunch of the Cloudfork packages and
>>>>> I am able to instantiate an S3 bucket in Amazon but I am running into authentication problems when I try to create something in the bucket, due to missing pieces of the
>>>>> SHA1 class. Are there directions somewhere on how to set this up under GLASS? Has it been done before?
>>>>>
>>>>> Also, I need to login into Gemstone as SystemUser in order to add some primitives to the class SHA1 when it loads, but I am unable to
>>>>> get that to work. I read somewhere that it is possible to add a CompilePrimitives to a UserProfile but I'm not sure how to do that.
>>>>> I guess I would add it to DataCurator.
>>>>>
>>>>> Thanks for the help!
>>>>>
>>>>> Larry
>>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

NorbertHartl
James,

I'm interested in using cloudfork, too. So I'm a very interested reader.

Am 12.01.2012 um 04:07 schrieb James Foster:

> Larry,
>
> Porting an application fromPharo to Version 3.0.1 should be similar to porting to 2.4.4.x. There are a number of new features (some, like FFI are necessary for you) and performance enhancements. On the other hand, people who have existing projects have not rushed to migrate from 2.x to 3.x so there is not as much production experience with Seaside on 3.x. I've been porting some of our tests to use FFI and have found a couple issues with the VM that should be fixed in 3.0.2 (schedule pending based on demand). I have also done a bit to improve the CHeader parsing. It is certainly our goal with FFI that it be fairly easy to use.
>
> In the last hour I've come up with the following in 3.1, and expect that it should be similar in 3.0.1.
>
> First, build a class that represents the library:
>
> | header class |
> header := CHeader path: '/usr/include/openssl/sha.h'.
> class := header wrapperForLibraryAt: '$GEMSTONE/lib/libcrypto.so'.
> class initializeFunctions.
> UserGlobals at: class name put: class.
>
>
> Next, use the library:
>
> | string result bytes |
> string := 'Now is the time for all good men to come to the aid of their party'.
> result := Crypto new SHA1_: string _: string size _: nil.
> bytes := result asArray collect: [:each | each codePoint].
> result class -> bytes.
> String->anArray( 249, 92, 62, 72, 141, 165, 168, 163, 45, 23, 107, 2, 204, 233, 20, 250, 66, 180, 132, 37)
>
> I don't know anything about SSH-1, but this seems to match the info I found (using Google) at http://linux.die.net/man/3/sha. Do you think you would need much more?
>
Good question. Basically it would be sufficient but I have trouble seeing that the result is correct. If I do

echo "Now is the time for all good men to come to the aid of their party" | openssl sha1

I get

8f1850ddc782644590c4d9eb234d780b39008316

and I cannot map this to the result you've got.

Norbert

> -James
>
> On Jan 11, 2012, at 6:01 PM, Lawrence Kellogg wrote:
>
>> Hello James,
>> Ah, I see why I'm having so much trouble.
>>
>> On Jan 11, 2012, at 8:49 PM, James Foster wrote:
>>
>>> Hi Larry,
>>>
>>> Now I see what you are doing with primitives. It turns out that each dialect of Smalltalk has its own primitive syntax, and GemStone is different from Squeak. What you really need is the FFI feature that is new with 3.0 (and I'm working on enhancements that should be in 3.1 later this year).
>>>
>>> Are you using GemStone/S 64 Bit version 2.4.x or 3.0.1?
>>>
>>
>> I'm on this version of GemStone: GemStone64Bit2.4.4.1-x86_64.Linux, to be exact. Is it difficult to upgrade to 3.0?
>> Does all of the Seaside stuff work ok?
>>
>> Do you think it will be a big deal to use the new FFI function to call the primitives from SHA1?
>>
>> Larry
>>
>>
>>> -James
>>>
>>> On Jan 11, 2012, at 4:01 PM, Lawrence Kellogg wrote:
>>>
>>>> Hello James,
>>>> Thanks for the reply. Your blog is excellent, by the way, very helpful. I searched in there for an answer, and in other places,
>>>> but cannot seem to find a solution.
>>>>
>>>> On Jan 11, 2012, at 6:45 PM, James Foster wrote:
>>>>
>>>>> Hi Larry,
>>>>>
>>>>> Welcome to GLASS; I hope we can help get you going. Unfortunately, I'm not familiar with the SHA1 issues. As to the primitives, tell us more about what you need to add to SHA1 and what you have with it.
>>>>>
>>>>
>>>> So, SHA1 is in System-Hashing, SqueakSource/Pharo.
>>>>
>>>> The first primitive that I need is:
>>>>
>>>> primHasSecureHashPrimitive
>>>> "Answer true if this platform has primitive support for the Secure Hash Algorithm."
>>>>
>>>> <primitive: 'primitiveHasSecureHashPrimitive' module: 'DSAPrims'>
>>>> ^ false
>>>>
>>>> There might be other primitive-related problems but my code crashes trying to call this non-existent method when I try to put something in a bucket.
>>>> I am able to instantiate a bucket correctly, as I mentioned.
>>>>
>>>> Strangely, the Bitmap class is missing from GLASS, but it is just a subclass of ArrayedCollection and, so far,
>>>> SHA1 does not do much with it.
>>>>
>>>> I have this horrible feeling that nobody has gotten Cloudfork to run under GLASS. I hope I'm wrong and that it is
>>>> not too difficult to get it to work.
>>>>
>>>> Regards,
>>>>
>>>> Larry
>>>>
>>>>
>>>>> James
>>>>>
>>>>> On Jan 11, 2012, at 2:07 PM, Lawrence Kellogg wrote:
>>>>>
>>>>>> Hello,
>>>>>> I am in the process of moving my application over to GLASS. I had been developing using one-click Pharo/Seaside with Cloudfork and all of my calls
>>>>>> to the Amazon services were working correctly.
>>>>>>
>>>>>> Now, I'm trying to do the same thing under Gemstone GLASS. I have loaded a bunch of the Cloudfork packages and
>>>>>> I am able to instantiate an S3 bucket in Amazon but I am running into authentication problems when I try to create something in the bucket, due to missing pieces of the
>>>>>> SHA1 class. Are there directions somewhere on how to set this up under GLASS? Has it been done before?
>>>>>>
>>>>>> Also, I need to login into Gemstone as SystemUser in order to add some primitives to the class SHA1 when it loads, but I am unable to
>>>>>> get that to work. I read somewhere that it is possible to add a CompilePrimitives to a UserProfile but I'm not sure how to do that.
>>>>>> I guess I would add it to DataCurator.
>>>>>>
>>>>>> Thanks for the help!
>>>>>>
>>>>>> Larry
>>>>>
>>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

Larry Kellogg
In reply to this post by James Foster-8

On Jan 11, 2012, at 10:07 PM, James Foster wrote:

> Larry,
>
> Porting an application fromPharo to Version 3.0.1 should be similar to porting to 2.4.4.x. There are a number of new features (some, like FFI are necessary for you) and performance enhancements. On the other hand, people who have existing projects have not rushed to migrate from 2.x to 3.x so there is not as much production experience with Seaside on 3.x. I've been porting some of our tests to use FFI and have found a couple issues with the VM that should be fixed in 3.0.2 (schedule pending based on demand). I have also done a bit to improve the CHeader parsing. It is certainly our goal with FFI that it be fairly easy to use.
>
> In the last hour I've come up with the following in 3.1, and expect that it should be similar in 3.0.1.
>
> First, build a class that represents the library:
>
> | header class |
> header := CHeader path: '/usr/include/openssl/sha.h'.
> class := header wrapperForLibraryAt: '$GEMSTONE/lib/libcrypto.so'.
> class initializeFunctions.
> UserGlobals at: class name put: class.
>
>
> Next, use the library:
>
> | string result bytes |
> string := 'Now is the time for all good men to come to the aid of their party'.
> result := Crypto new SHA1_: string _: string size _: nil.
> bytes := result asArray collect: [:each | each codePoint].
> result class -> bytes.
> String->anArray( 249, 92, 62, 72, 141, 165, 168, 163, 45, 23, 107, 2, 204, 233, 20, 250, 66, 180, 132, 37)
>
> I don't know anything about SSH-1, but this seems to match the info I found (using Google) at http://linux.die.net/man/3/sha. Do you think you would need much more?
>

  Thanks, James, this helps a lot! I will try to get it working under GLASS. I hope that there isn't much needed beyond a working SHA1 class. I'l find out.
First, I have to upgrade to Gemstone 3.0.1.


  Regards,

  Larry


> -James
>
> On Jan 11, 2012, at 6:01 PM, Lawrence Kellogg wrote:
>
>> Hello James,
>> Ah, I see why I'm having so much trouble.
>>
>> On Jan 11, 2012, at 8:49 PM, James Foster wrote:
>>
>>> Hi Larry,
>>>
>>> Now I see what you are doing with primitives. It turns out that each dialect of Smalltalk has its own primitive syntax, and GemStone is different from Squeak. What you really need is the FFI feature that is new with 3.0 (and I'm working on enhancements that should be in 3.1 later this year).
>>>
>>> Are you using GemStone/S 64 Bit version 2.4.x or 3.0.1?
>>>
>>
>> I'm on this version of GemStone: GemStone64Bit2.4.4.1-x86_64.Linux, to be exact. Is it difficult to upgrade to 3.0?
>> Does all of the Seaside stuff work ok?
>>
>> Do you think it will be a big deal to use the new FFI function to call the primitives from SHA1?
>>
>> Larry
>>
>>
>>> -James
>>>
>>> On Jan 11, 2012, at 4:01 PM, Lawrence Kellogg wrote:
>>>
>>>> Hello James,
>>>> Thanks for the reply. Your blog is excellent, by the way, very helpful. I searched in there for an answer, and in other places,
>>>> but cannot seem to find a solution.
>>>>
>>>> On Jan 11, 2012, at 6:45 PM, James Foster wrote:
>>>>
>>>>> Hi Larry,
>>>>>
>>>>> Welcome to GLASS; I hope we can help get you going. Unfortunately, I'm not familiar with the SHA1 issues. As to the primitives, tell us more about what you need to add to SHA1 and what you have with it.
>>>>>
>>>>
>>>> So, SHA1 is in System-Hashing, SqueakSource/Pharo.
>>>>
>>>> The first primitive that I need is:
>>>>
>>>> primHasSecureHashPrimitive
>>>> "Answer true if this platform has primitive support for the Secure Hash Algorithm."
>>>>
>>>> <primitive: 'primitiveHasSecureHashPrimitive' module: 'DSAPrims'>
>>>> ^ false
>>>>
>>>> There might be other primitive-related problems but my code crashes trying to call this non-existent method when I try to put something in a bucket.
>>>> I am able to instantiate a bucket correctly, as I mentioned.
>>>>
>>>> Strangely, the Bitmap class is missing from GLASS, but it is just a subclass of ArrayedCollection and, so far,
>>>> SHA1 does not do much with it.
>>>>
>>>> I have this horrible feeling that nobody has gotten Cloudfork to run under GLASS. I hope I'm wrong and that it is
>>>> not too difficult to get it to work.
>>>>
>>>> Regards,
>>>>
>>>> Larry
>>>>
>>>>
>>>>> James
>>>>>
>>>>> On Jan 11, 2012, at 2:07 PM, Lawrence Kellogg wrote:
>>>>>
>>>>>> Hello,
>>>>>> I am in the process of moving my application over to GLASS. I had been developing using one-click Pharo/Seaside with Cloudfork and all of my calls
>>>>>> to the Amazon services were working correctly.
>>>>>>
>>>>>> Now, I'm trying to do the same thing under Gemstone GLASS. I have loaded a bunch of the Cloudfork packages and
>>>>>> I am able to instantiate an S3 bucket in Amazon but I am running into authentication problems when I try to create something in the bucket, due to missing pieces of the
>>>>>> SHA1 class. Are there directions somewhere on how to set this up under GLASS? Has it been done before?
>>>>>>
>>>>>> Also, I need to login into Gemstone as SystemUser in order to add some primitives to the class SHA1 when it loads, but I am unable to
>>>>>> get that to work. I read somewhere that it is possible to add a CompilePrimitives to a UserProfile but I'm not sure how to do that.
>>>>>> I guess I would add it to DataCurator.
>>>>>>
>>>>>> Thanks for the help!
>>>>>>
>>>>>> Larry
>>>>>
>>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

NorbertHartl

Am 12.01.2012 um 13:54 schrieb Lawrence Kellogg:

 Thanks, James, this helps a lot! I will try to get it working under GLASS. I hope that there isn't much needed beyond a working SHA1 class. I'l find out. 
First, I have to upgrade to Gemstone 3.0.1.

Please keep us updated,

Norbert
Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

Larry Kellogg

On Jan 12, 2012, at 8:00 AM, Norbert Hartl wrote:


Am 12.01.2012 um 13:54 schrieb Lawrence Kellogg:

 Thanks, James, this helps a lot! I will try to get it working under GLASS. I hope that there isn't much needed beyond a working SHA1 class. I'l find out. 
First, I have to upgrade to Gemstone 3.0.1.

Please keep us updated,


  I will. Feel free to jump in if you have time ;-) I think I have a workaround, without using Cloudfork under GLASS, so I might have to 
ty to get that working before seeing if I can get Cloudfork running under GLASS. 

  By the way, one of the authors of Cloudfork posted this on the Pharo list: 

"Hello Larry,

Cloudfork was developed on Pharo Smalltalk and ported to VW and VA Smalltalk. But not yet to Gemstone. We tried to isolate the platform specific code. Most of it is implemented as platform specific subclasses of CFPlatformServiceUtils.

CloudforkAWS requires an XML parser, a SHA1 or SHA256 implementation and a HTTP client. I don't know if it has been done before but I think it should be possible to create a platform class for Gemstone that offers access to these functions. I don't have experience with Gemstone. The GLASS mailing list is probably the best source to ask.

Jan.
"

Norbert

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

James Foster-8
In reply to this post by NorbertHartl
On Jan 12, 2012, at 2:32 AM, Norbert Hartl wrote:

> ...I have trouble seeing that the result is correct. If I do
>
> echo "Now is the time for all good men to come to the aid of their party" | openssl sha1
>
> I get
>
> 8f1850ddc782644590c4d9eb234d780b39008316
>
> and I cannot map this to the result you've got.
>
> Norbert

I did a search for sample code and found something for PHP at http://www.w3schools.com/php/func_string_sha1.asp. Based on that, I tried the following:

vienna:~ jfoster$ cat sha1.php
<?php
$str = 'Now is the time for all good men to come to the aid of their party';
echo sha1($str);
echo "\n";
?>
vienna:~ jfoster$ php sha1.php
f95c3e488da5a8a32d176b02cce914fa42b48425
vienna:~ jfoster$

Then I modified my Smalltalk code to return a hex string:

| string result stream |
string := 'Now is the time for all good men to come to the aid of their party'.
result := Crypto new SHA1_: string _: string size _: nil.
stream := WriteStream on: String new.
result do: [:each |
        string := each codePoint printStringRadix: 16.
        string := string copyFrom: 4 to: string size.
        string size == 1 ifTrue: [string := '0' , string].
        stream nextPutAll: string.
].
stream contents.
 'F95C3E488DA5A8A32D176B02CCE914FA42B48425'

The Smalltalk result matches the PHP result.


Further investigate reveals that echo appends a LF to the string that is sent when using the command line. If we add a LF to the Smalltalk string, we get your answer:

| string result stream |
string := 'Now is the time for all good men to come to the aid of their party' , Character lf asString.
result := Crypto new SHA1_: string _: string size _: nil.
stream := WriteStream on: String new.
result do: [:each |
        string := each codePoint printStringRadix: 16.
        string := string copyFrom: 4 to: string size.
        string size == 1 ifTrue: [string := '0' , string].
        stream nextPutAll: string.
].
stream contents.
 '8F1850DDC782644590C4D9EB234D780B39'

-James

Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

Tobias Pape
In reply to this post by NorbertHartl
Hi Norbert

Am 2012-01-12 um 11:32 schrieb Norbert Hartl:
>> […]
>>
> Good question. Basically it would be sufficient but I have trouble seeing that the result is correct. If I do
>
> echo "Now is the time for all good men to come to the aid of their party" | openssl sha1
>

do it like this:

$ echo -n "Now is the time for all good men to come to the aid of their party" | openssl sha1
f95c3e488da5a8a32d176b02cce914fa42b48425

(note the  -n )

> I get
>
> 8f1850ddc782644590c4d9eb234d780b39008316
>
> and I cannot map this to the result you've got.

Best
        -Tobias
Reply | Threaded
Open this post in threaded view
|

Re: Cloudfork under Gemstone GLASS with Pharo and Seaside

NorbertHartl
In reply to this post by James Foster-8
James,

Am 12.01.2012 um 17:40 schrieb James Foster:

> On Jan 12, 2012, at 2:32 AM, Norbert Hartl wrote:
>
>> ...I have trouble seeing that the result is correct. If I do
>>
>> echo "Now is the time for all good men to come to the aid of their party" | openssl sha1
>>
>> I get
>>
>> 8f1850ddc782644590c4d9eb234d780b39008316
>>
>> and I cannot map this to the result you've got.
>>
>> Norbert
>
> I did a search for sample code and found something for PHP at http://www.w3schools.com/php/func_string_sha1.asp. Based on that, I tried the following:
>
> vienna:~ jfoster$ cat sha1.php
> <?php
> $str = 'Now is the time for all good men to come to the aid of their party';
> echo sha1($str);
> echo "\n";
> ?>
> vienna:~ jfoster$ php sha1.php
> f95c3e488da5a8a32d176b02cce914fa42b48425
> vienna:~ jfoster$
>
> Then I modified my Smalltalk code to return a hex string:
>
> | string result stream |
> string := 'Now is the time for all good men to come to the aid of their party'.
> result := Crypto new SHA1_: string _: string size _: nil.
> stream := WriteStream on: String new.
> result do: [:each |
> string := each codePoint printStringRadix: 16.
> string := string copyFrom: 4 to: string size.
> string size == 1 ifTrue: [string := '0' , string].
> stream nextPutAll: string.
> ].
> stream contents.
> 'F95C3E488DA5A8A32D176B02CCE914FA42B48425'
>
> The Smalltalk result matches the PHP result.
>
>
> Further investigate reveals that echo appends a LF to the string that is sent when using the command line. If we add a LF to the Smalltalk string, we get your answer:

Ah, sure. I should have done better after knowing this for 20 years now :) I was tricked because first I created a file containing the string and tested this. But again I should have known that the old C reminiscent is still there and certain text editors are adding a newline as well. Sorry for not being more careful about it.

Norbert

>
> | string result stream |
> string := 'Now is the time for all good men to come to the aid of their party' , Character lf asString.
> result := Crypto new SHA1_: string _: string size _: nil.
> stream := WriteStream on: String new.
> result do: [:each |
> string := each codePoint printStringRadix: 16.
> string := string copyFrom: 4 to: string size.
> string size == 1 ifTrue: [string := '0' , string].
> stream nextPutAll: string.
> ].
> stream contents.
> '8F1850DDC782644590C4D9EB234D780B39'
>
> -James
>

Reply | Threaded
Open this post in threaded view
|

Configuring Seaside for deployment

Larry Kellogg
Hello,
  So, I have started going through the chapter on what it takes to deploy an application with Seaside. 

  I can bring up the Configuration option by clicking Configure at the bottom of the browser but if I try to 
password prptect the configure app, I get a crash in the SecureHashAlgorithm class, with the message 

"Byte objects store values from 0 to 255, not nil"

(Same issue if I try to execute: "WAConfigurationTool initialize"
initialize
(WAAdmin register: self asApplicationAt: 'config' user: 'admin' password: 'seaside') addLibrary: WAToolFiles)

  The trouble is: 

buf := aPositionableStream next: 64 which returns nil when it tries to go through the next 64 elements, 
there aren't 64 elements...

from here:

hashStream: aPositionableStream
"Hash the contents of the given stream from the current position to the end using the Secure Hash Algorithm. The SHA algorithm is defined in FIPS PUB 180-1. It is also described on p. 442 of 'Applied Cryptography: Protocols, Algorithms, and Source Code in C' by Bruce Scheier, Wiley, 1996."
"SecureHashAlgorithm new hashStream: (ReadStream on: 'foo')"
"(SecureHashAlgorithm new hashMessage: '') radix: 16
=> 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709'"
| startPosition buf bitLength |
self initializeTotals.
 
aPositionableStream atEnd ifTrue: [self processFinalBuffer: #() bitLength: 0].

startPosition := aPositionableStream position.
[aPositionableStream atEnd] whileFalse: 
[ buf := aPositionableStream next: 64. <<<<<<<<<<<<<<<<<<<<<<-----
(aPositionableStream atEnd not and: [buf size = 64])
ifTrue: [self processBuffer: buf]
ifFalse: [ bitLength := (aPositionableStream position - startPosition) * 8.
self processFinalBuffer: buf bitLength: bitLength]].
^ self finalHash

and also in SecureHashAlgorithm, which does not understand 

self primHasSecureHashPrimitive

from

processBuffer: aByteArray
"Process given 64-byte buffer, accumulating the results in totalA through totalE."

| a b c d e w tmp |
self primHasSecureHashPrimitive  <<<<<<<<<<<<<<<<<<<<<<<<<<<<
ifTrue: [^ self processBufferUsingPrimitives: aByteArray]
ifFalse: [totals := nil].

"initialize registers a through e from the current totals" 
a := totalA copy.
b := totalB copy.
c := totalC copy.
d := totalD copy.
e := totalE copy.

"expand and process the buffer"
w := self expandedBlock: aByteArray.
1 to: 80 do: [:i |
tmp := (a copy leftRotateBy: 5)
+= (self hashFunction: i of: b with: c with: d);
+= e;
+= (w at: i);
+= (self constantForStep: i).
e := d.
d := c.
c := b copy leftRotateBy: 30.
b := a.
a := tmp].

"add a through e into total accumulators"
totalA += a.
totalB += b.
totalC += c.
totalD += d.
totalE += e.


  I'm wondering if I somehow messed up my SecureHashAlgorithm class with the other troubles I had 
with Cloudfork or am I just destined to run into all kinds of security problems. ;-) 

  Any thoughts? 


  Larry

Reply | Threaded
Open this post in threaded view
|

Re: Configuring Seaside for deployment

Dale Henrichs
Lawrence,

First off, there is an implementation of SecureHashAlgorithm already ported to GemStone. To load the correct version you can try this expression:

  ConfigurationOfGsMisc currentVersion load: 'System-Digital-Signatures'.

Using the version that is already ported to GemStone will definitely address the issue you had with the #processBuffer method (MNU for #primHasSecureHashPrimitive).

>From looking at the code, I would have to guess that you must be passing in a FileStream in the #hashStream: method. FileStream>>next: returns a nil explicitly and that looks like a bug to me ... The fix would be for FileStream to return result, which should be empty on an error...

If you're not using a FileStream there, then I would be interested in a stack to understand what is wrong ...

Dale
----- Original Message -----
| From: "Lawrence Kellogg" <[hidden email]>
| To: "GemStone Seaside beta discussion" <[hidden email]>
| Sent: Thursday, January 12, 2012 8:41:44 PM
| Subject: [GS/SS Beta] Configuring Seaside for deployment
|
| Hello,
| So, I have started going through the chapter on what it takes to
| deploy an application with Seaside.
|
|
| I can bring up the Configuration option by clicking Configure at the
| bottom of the browser but if I try to
| password prptect the configure app, I get a crash in the
| SecureHashAlgorithm class, with the message
|
|
| "Byte objects store values from 0 to 255, not nil"
|
|
| (Same issue if I try to execute: "WAConfigurationTool initialize"
| initialize
| (WAAdmin register: self asApplicationAt: 'config' user: 'admin'
| password: 'seaside') addLibrary: WAToolFiles)
|
|
| The trouble is:
|
|
| buf := aPositionableStream next: 64 which returns nil when it tries
| to go through the next 64 elements,
| there aren't 64 elements...
|
|
| from here:
|
|
|
| hashStream: aPositionableStream
| "Hash the contents of the given stream from the current position to
| the end using the Secure Hash Algorithm. The SHA algorithm is
| defined in FIPS PUB 180-1. It is also described on p. 442 of
| 'Applied Cryptography: Protocols, Algorithms, and Source Code in C'
| by Bruce Scheier, Wiley, 1996."
| "SecureHashAlgorithm new hashStream: (ReadStream on: 'foo')"
| "(SecureHashAlgorithm new hashMessage: '') radix: 16
| => 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709'"
|
| | startPosition buf bitLength |
| self initializeTotals.
|
| aPositionableStream atEnd ifTrue: [self processFinalBuffer: #()
| bitLength: 0].
|
|
| startPosition := aPositionableStream position.
| [aPositionableStream atEnd] whileFalse:
| [ buf := aPositionableStream next: 64. <<<<<<<<<<<<<<<<<<<<<<-----
| (aPositionableStream atEnd not and: [buf size = 64])
| ifTrue: [self processBuffer: buf]
| ifFalse: [ bitLength := (aPositionableStream position -
| startPosition) * 8.
| self processFinalBuffer: buf bitLength: bitLength]].
| ^ self finalHash
|
|
| and also in SecureHashAlgorithm, which does not understand
|
|
| self primHasSecureHashPrimitive
|
|
| from
|
|
|
| processBuffer: aByteArray
| "Process given 64-byte buffer, accumulating the results in totalA
| through totalE."
|
|
| | a b c d e w tmp |
| self <<<<<<<<<<<<<<<<<<<<<<<<<<<<
| ifTrue: [^ self processBufferUsingPrimitives: aByteArray]
| ifFalse: [totals := nil].
|
|
| "initialize registers a through e from the current totals"
| a := totalA copy.
| b := totalB copy.
| c := totalC copy.
| d := totalD copy.
| e := totalE copy.
|
|
| "expand and process the buffer"
| w := self expandedBlock: aByteArray.
| 1 to: 80 do: [:i |
| tmp := (a copy leftRotateBy: 5)
| += (self hashFunction: i of: b with: c with: d);
| += e;
| += (w at: i);
| += (self constantForStep: i).
| e := d.
| d := c.
| c := b copy leftRotateBy: 30.
| b := a.
| a := tmp].
|
|
| "add a through e into total accumulators"
| totalA += a.
| totalB += b.
| totalC += c.
| totalD += d.
| totalE += e.
|
|
|
|
| I'm wondering if I somehow messed up my SecureHashAlgorithm class
| with the other troubles I had
| with Cloudfork or am I just destined to run into all kinds of
| security problems. ;-)
|
|
| Any thoughts?
|
|
|
|
| Larry
|
|
Reply | Threaded
Open this post in threaded view
|

Re: Configuring Seaside for deployment

Larry Kellogg

On Jan 13, 2012, at 1:38 PM, Dale Henrichs wrote:

> Lawrence,
>
> First off, there is an implementation of SecureHashAlgorithm already ported to GemStone. To load the correct version you can try this expression:
>
>  ConfigurationOfGsMisc currentVersion load: 'System-Digital-Signatures'.
>

  Thanks Dale, unfortunately, my ConfigurationOfGsMisc class does not have a current method, so it fails.
I am on GemStone64Bit2.4.4.1-x86_64.Linux.

  Did you mean:

  ConfigurationOfGsMisc project load: 'System-Digital-Signatures' ??

  but that doesn't work because it expects a version string.

  I know that I totally messed up my configuration when I loaded the System-Hashing stuff from Squeak.

  How do I restore my Gemstone configuration?

  Larry



> Using the version that is already ported to GemStone will definitely address the issue you had with the #processBuffer method (MNU for #primHasSecureHashPrimitive).
>
>> From looking at the code, I would have to guess that you must be passing in a FileStream in the #hashStream: method. FileStream>>next: returns a nil explicitly and that looks like a bug to me ... The fix would be for FileStream to return result, which should be empty on an error...
>
> If you're not using a FileStream there, then I would be interested in a stack to understand what is wrong ...
>
> Dale
> ----- Original Message -----
> | From: "Lawrence Kellogg" <[hidden email]>
> | To: "GemStone Seaside beta discussion" <[hidden email]>
> | Sent: Thursday, January 12, 2012 8:41:44 PM
> | Subject: [GS/SS Beta] Configuring Seaside for deployment
> |
> | Hello,
> | So, I have started going through the chapter on what it takes to
> | deploy an application with Seaside.
> |
> |
> | I can bring up the Configuration option by clicking Configure at the
> | bottom of the browser but if I try to
> | password prptect the configure app, I get a crash in the
> | SecureHashAlgorithm class, with the message
> |
> |
> | "Byte objects store values from 0 to 255, not nil"
> |
> |
> | (Same issue if I try to execute: "WAConfigurationTool initialize"
> | initialize
> | (WAAdmin register: self asApplicationAt: 'config' user: 'admin'
> | password: 'seaside') addLibrary: WAToolFiles)
> |
> |
> | The trouble is:
> |
> |
> | buf := aPositionableStream next: 64 which returns nil when it tries
> | to go through the next 64 elements,
> | there aren't 64 elements...
> |
> |
> | from here:
> |
> |
> |
> | hashStream: aPositionableStream
> | "Hash the contents of the given stream from the current position to
> | the end using the Secure Hash Algorithm. The SHA algorithm is
> | defined in FIPS PUB 180-1. It is also described on p. 442 of
> | 'Applied Cryptography: Protocols, Algorithms, and Source Code in C'
> | by Bruce Scheier, Wiley, 1996."
> | "SecureHashAlgorithm new hashStream: (ReadStream on: 'foo')"
> | "(SecureHashAlgorithm new hashMessage: '') radix: 16
> | => 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709'"
> |
> | | startPosition buf bitLength |
> | self initializeTotals.
> |
> | aPositionableStream atEnd ifTrue: [self processFinalBuffer: #()
> | bitLength: 0].
> |
> |
> | startPosition := aPositionableStream position.
> | [aPositionableStream atEnd] whileFalse:
> | [ buf := aPositionableStream next: 64. <<<<<<<<<<<<<<<<<<<<<<-----
> | (aPositionableStream atEnd not and: [buf size = 64])
> | ifTrue: [self processBuffer: buf]
> | ifFalse: [ bitLength := (aPositionableStream position -
> | startPosition) * 8.
> | self processFinalBuffer: buf bitLength: bitLength]].
> | ^ self finalHash
> |
> |
> | and also in SecureHashAlgorithm, which does not understand
> |
> |
> | self primHasSecureHashPrimitive
> |
> |
> | from
> |
> |
> |
> | processBuffer: aByteArray
> | "Process given 64-byte buffer, accumulating the results in totalA
> | through totalE."
> |
> |
> | | a b c d e w tmp |
> | self <<<<<<<<<<<<<<<<<<<<<<<<<<<<
> | ifTrue: [^ self processBufferUsingPrimitives: aByteArray]
> | ifFalse: [totals := nil].
> |
> |
> | "initialize registers a through e from the current totals"
> | a := totalA copy.
> | b := totalB copy.
> | c := totalC copy.
> | d := totalD copy.
> | e := totalE copy.
> |
> |
> | "expand and process the buffer"
> | w := self expandedBlock: aByteArray.
> | 1 to: 80 do: [:i |
> | tmp := (a copy leftRotateBy: 5)
> | += (self hashFunction: i of: b with: c with: d);
> | += e;
> | += (w at: i);
> | += (self constantForStep: i).
> | e := d.
> | d := c.
> | c := b copy leftRotateBy: 30.
> | b := a.
> | a := tmp].
> |
> |
> | "add a through e into total accumulators"
> | totalA += a.
> | totalB += b.
> | totalC += c.
> | totalD += d.
> | totalE += e.
> |
> |
> |
> |
> | I'm wondering if I somehow messed up my SecureHashAlgorithm class
> | with the other troubles I had
> | with Cloudfork or am I just destined to run into all kinds of
> | security problems. ;-)
> |
> |
> | Any thoughts?
> |
> |
> |
> |
> | Larry
> |
> |

Reply | Threaded
Open this post in threaded view
|

Re: Configuring Seaside for deployment

Dale Henrichs
Lawrence,

That should have been:

  ConfigurationOfGsMisc project currentVersion load: 'System-Digital-Signatures'.

I recommend that you perform a backup[1] before doing a load of software, because then it is very easy to restore[2] to a known point ... I typically keep a number of backups around for this purpose.

If SystemHashing is the only problem area (and you don't have a backup:), then you can unload the SystemHashing package using the Monticello browser[3], then load the GemStone version using the expression above ...

Let me know if you have other issues,

Dale


[1] http://code.google.com/p/glassdb/wiki/GemToolsAdmin#Backup
[2] http://code.google.com/p/glassdb/wiki/GemToolsAdmin#Restore_w/o_tranlogs
[3] http://code.google.com/p/glassdb/wiki/GemToolsTools#Monticello
----- Original Message -----
| From: "Lawrence Kellogg" <[hidden email]>
| To: "GemStone Seaside beta discussion" <[hidden email]>
| Sent: Friday, January 13, 2012 1:03:34 PM
| Subject: Re: [GS/SS Beta] Configuring Seaside for deployment
|
|
| On Jan 13, 2012, at 1:38 PM, Dale Henrichs wrote:
|
| > Lawrence,
| >
| > First off, there is an implementation of SecureHashAlgorithm
| > already ported to GemStone. To load the correct version you can
| > try this expression:
| >
| >  ConfigurationOfGsMisc currentVersion load:
| >  'System-Digital-Signatures'.
| >
|
|   Thanks Dale, unfortunately, my ConfigurationOfGsMisc class does not
|   have a current method, so it fails.
| I am on GemStone64Bit2.4.4.1-x86_64.Linux.
|
|   Did you mean:
|
|   ConfigurationOfGsMisc project load: 'System-Digital-Signatures' ??
|
|   but that doesn't work because it expects a version string.
|
|   I know that I totally messed up my configuration when I loaded the
|   System-Hashing stuff from Squeak.
|
|   How do I restore my Gemstone configuration?
|
|   Larry
|
|
|
| > Using the version that is already ported to GemStone will
| > definitely address the issue you had with the #processBuffer
| > method (MNU for #primHasSecureHashPrimitive).
| >
| >> From looking at the code, I would have to guess that you must be
| >> passing in a FileStream in the #hashStream: method.
| >> FileStream>>next: returns a nil explicitly and that looks like a
| >> bug to me ... The fix would be for FileStream to return result,
| >> which should be empty on an error...
| >
| > If you're not using a FileStream there, then I would be interested
| > in a stack to understand what is wrong ...
| >
| > Dale
| > ----- Original Message -----
| > | From: "Lawrence Kellogg" <[hidden email]>
| > | To: "GemStone Seaside beta discussion"
| > | <[hidden email]>
| > | Sent: Thursday, January 12, 2012 8:41:44 PM
| > | Subject: [GS/SS Beta] Configuring Seaside for deployment
| > |
| > | Hello,
| > | So, I have started going through the chapter on what it takes to
| > | deploy an application with Seaside.
| > |
| > |
| > | I can bring up the Configuration option by clicking Configure at
| > | the
| > | bottom of the browser but if I try to
| > | password prptect the configure app, I get a crash in the
| > | SecureHashAlgorithm class, with the message
| > |
| > |
| > | "Byte objects store values from 0 to 255, not nil"
| > |
| > |
| > | (Same issue if I try to execute: "WAConfigurationTool initialize"
| > | initialize
| > | (WAAdmin register: self asApplicationAt: 'config' user: 'admin'
| > | password: 'seaside') addLibrary: WAToolFiles)
| > |
| > |
| > | The trouble is:
| > |
| > |
| > | buf := aPositionableStream next: 64 which returns nil when it
| > | tries
| > | to go through the next 64 elements,
| > | there aren't 64 elements...
| > |
| > |
| > | from here:
| > |
| > |
| > |
| > | hashStream: aPositionableStream
| > | "Hash the contents of the given stream from the current position
| > | to
| > | the end using the Secure Hash Algorithm. The SHA algorithm is
| > | defined in FIPS PUB 180-1. It is also described on p. 442 of
| > | 'Applied Cryptography: Protocols, Algorithms, and Source Code in
| > | C'
| > | by Bruce Scheier, Wiley, 1996."
| > | "SecureHashAlgorithm new hashStream: (ReadStream on: 'foo')"
| > | "(SecureHashAlgorithm new hashMessage: '') radix: 16
| > | => 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709'"
| > |
| > | | startPosition buf bitLength |
| > | self initializeTotals.
| > |
| > | aPositionableStream atEnd ifTrue: [self processFinalBuffer: #()
| > | bitLength: 0].
| > |
| > |
| > | startPosition := aPositionableStream position.
| > | [aPositionableStream atEnd] whileFalse:
| > | [ buf := aPositionableStream next: 64.
| > | <<<<<<<<<<<<<<<<<<<<<<-----
| > | (aPositionableStream atEnd not and: [buf size = 64])
| > | ifTrue: [self processBuffer: buf]
| > | ifFalse: [ bitLength := (aPositionableStream position -
| > | startPosition) * 8.
| > | self processFinalBuffer: buf bitLength: bitLength]].
| > | ^ self finalHash
| > |
| > |
| > | and also in SecureHashAlgorithm, which does not understand
| > |
| > |
| > | self primHasSecureHashPrimitive
| > |
| > |
| > | from
| > |
| > |
| > |
| > | processBuffer: aByteArray
| > | "Process given 64-byte buffer, accumulating the results in totalA
| > | through totalE."
| > |
| > |
| > | | a b c d e w tmp |
| > | self <<<<<<<<<<<<<<<<<<<<<<<<<<<<
| > | ifTrue: [^ self processBufferUsingPrimitives: aByteArray]
| > | ifFalse: [totals := nil].
| > |
| > |
| > | "initialize registers a through e from the current totals"
| > | a := totalA copy.
| > | b := totalB copy.
| > | c := totalC copy.
| > | d := totalD copy.
| > | e := totalE copy.
| > |
| > |
| > | "expand and process the buffer"
| > | w := self expandedBlock: aByteArray.
| > | 1 to: 80 do: [:i |
| > | tmp := (a copy leftRotateBy: 5)
| > | += (self hashFunction: i of: b with: c with: d);
| > | += e;
| > | += (w at: i);
| > | += (self constantForStep: i).
| > | e := d.
| > | d := c.
| > | c := b copy leftRotateBy: 30.
| > | b := a.
| > | a := tmp].
| > |
| > |
| > | "add a through e into total accumulators"
| > | totalA += a.
| > | totalB += b.
| > | totalC += c.
| > | totalD += d.
| > | totalE += e.
| > |
| > |
| > |
| > |
| > | I'm wondering if I somehow messed up my SecureHashAlgorithm class
| > | with the other troubles I had
| > | with Cloudfork or am I just destined to run into all kinds of
| > | security problems. ;-)
| > |
| > |
| > | Any thoughts?
| > |
| > |
| > |
| > |
| > | Larry
| > |
| > |
|
|
Reply | Threaded
Open this post in threaded view
|

Re: Configuring Seaside for deployment

Larry Kellogg

On Jan 13, 2012, at 4:49 PM, Dale Henrichs wrote:

> Lawrence,
>
> That should have been:
>
>  ConfigurationOfGsMisc project currentVersion load: 'System-Digital-Signatures'.
>

  Well, this seems to work and returns this:

Loading 0.239.1 of ConfigurationOfGsMisc...
...finished 0.239.1

but the SecureHashAlgorithm class does not exist in the image, I don't get System-Digital-Signatures but I do have System-Digital-Signatures-Tests. Puzzling.
Also, I can no longer reach my running server with a http, it insists on trying to use https, where it fails.



> I recommend that you perform a backup[1] before doing a load of software, because then it is very easy to restore[2] to a known point ... I typically keep a number of backups around for this purpose.
>

  At the moment, I have spun up two AMI instances, one called production and one called staging. I am doing my hacking on the staging instance.
Nothing is live, yet, but I should get used to not destroying the production system. ;-) Your point is well taken, I will start making backups.

> If SystemHashing is the only problem area (and you don't have a backup:), then you can unload the SystemHashing package using the Monticello browser[3], then load the GemStone version using the expression above ...
>
> Let me know if you have other issues,
>
> Dale
>
>
> [1] http://code.google.com/p/glassdb/wiki/GemToolsAdmin#Backup
> [2] http://code.google.com/p/glassdb/wiki/GemToolsAdmin#Restore_w/o_tranlogs
> [3] http://code.google.com/p/glassdb/wiki/GemToolsTools#Monticello
> ----- Original Message -----
> | From: "Lawrence Kellogg" <[hidden email]>
> | To: "GemStone Seaside beta discussion" <[hidden email]>
> | Sent: Friday, January 13, 2012 1:03:34 PM
> | Subject: Re: [GS/SS Beta] Configuring Seaside for deployment
> |
> |
> | On Jan 13, 2012, at 1:38 PM, Dale Henrichs wrote:
> |
> | > Lawrence,
> | >
> | > First off, there is an implementation of SecureHashAlgorithm
> | > already ported to GemStone. To load the correct version you can
> | > try this expression:
> | >
> | >  ConfigurationOfGsMisc currentVersion load:
> | >  'System-Digital-Signatures'.
> | >
> |
> |   Thanks Dale, unfortunately, my ConfigurationOfGsMisc class does not
> |   have a current method, so it fails.
> | I am on GemStone64Bit2.4.4.1-x86_64.Linux.
> |
> |   Did you mean:
> |
> |   ConfigurationOfGsMisc project load: 'System-Digital-Signatures' ??
> |
> |   but that doesn't work because it expects a version string.
> |
> |   I know that I totally messed up my configuration when I loaded the
> |   System-Hashing stuff from Squeak.
> |
> |   How do I restore my Gemstone configuration?
> |
> |   Larry
> |
> |
> |
> | > Using the version that is already ported to GemStone will
> | > definitely address the issue you had with the #processBuffer
> | > method (MNU for #primHasSecureHashPrimitive).
> | >
> | >> From looking at the code, I would have to guess that you must be
> | >> passing in a FileStream in the #hashStream: method.
> | >> FileStream>>next: returns a nil explicitly and that looks like a
> | >> bug to me ... The fix would be for FileStream to return result,
> | >> which should be empty on an error...
> | >
> | > If you're not using a FileStream there, then I would be interested
> | > in a stack to understand what is wrong ...
> | >
> | > Dale
> | > ----- Original Message -----
> | > | From: "Lawrence Kellogg" <[hidden email]>
> | > | To: "GemStone Seaside beta discussion"
> | > | <[hidden email]>
> | > | Sent: Thursday, January 12, 2012 8:41:44 PM
> | > | Subject: [GS/SS Beta] Configuring Seaside for deployment
> | > |
> | > | Hello,
> | > | So, I have started going through the chapter on what it takes to
> | > | deploy an application with Seaside.
> | > |
> | > |
> | > | I can bring up the Configuration option by clicking Configure at
> | > | the
> | > | bottom of the browser but if I try to
> | > | password prptect the configure app, I get a crash in the
> | > | SecureHashAlgorithm class, with the message
> | > |
> | > |
> | > | "Byte objects store values from 0 to 255, not nil"
> | > |
> | > |
> | > | (Same issue if I try to execute: "WAConfigurationTool initialize"
> | > | initialize
> | > | (WAAdmin register: self asApplicationAt: 'config' user: 'admin'
> | > | password: 'seaside') addLibrary: WAToolFiles)
> | > |
> | > |
> | > | The trouble is:
> | > |
> | > |
> | > | buf := aPositionableStream next: 64 which returns nil when it
> | > | tries
> | > | to go through the next 64 elements,
> | > | there aren't 64 elements...
> | > |
> | > |
> | > | from here:
> | > |
> | > |
> | > |
> | > | hashStream: aPositionableStream
> | > | "Hash the contents of the given stream from the current position
> | > | to
> | > | the end using the Secure Hash Algorithm. The SHA algorithm is
> | > | defined in FIPS PUB 180-1. It is also described on p. 442 of
> | > | 'Applied Cryptography: Protocols, Algorithms, and Source Code in
> | > | C'
> | > | by Bruce Scheier, Wiley, 1996."
> | > | "SecureHashAlgorithm new hashStream: (ReadStream on: 'foo')"
> | > | "(SecureHashAlgorithm new hashMessage: '') radix: 16
> | > | => 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709'"
> | > |
> | > | | startPosition buf bitLength |
> | > | self initializeTotals.
> | > |
> | > | aPositionableStream atEnd ifTrue: [self processFinalBuffer: #()
> | > | bitLength: 0].
> | > |
> | > |
> | > | startPosition := aPositionableStream position.
> | > | [aPositionableStream atEnd] whileFalse:
> | > | [ buf := aPositionableStream next: 64.
> | > | <<<<<<<<<<<<<<<<<<<<<<-----
> | > | (aPositionableStream atEnd not and: [buf size = 64])
> | > | ifTrue: [self processBuffer: buf]
> | > | ifFalse: [ bitLength := (aPositionableStream position -
> | > | startPosition) * 8.
> | > | self processFinalBuffer: buf bitLength: bitLength]].
> | > | ^ self finalHash
> | > |
> | > |
> | > | and also in SecureHashAlgorithm, which does not understand
> | > |
> | > |
> | > | self primHasSecureHashPrimitive
> | > |
> | > |
> | > | from
> | > |
> | > |
> | > |
> | > | processBuffer: aByteArray
> | > | "Process given 64-byte buffer, accumulating the results in totalA
> | > | through totalE."
> | > |
> | > |
> | > | | a b c d e w tmp |
> | > | self <<<<<<<<<<<<<<<<<<<<<<<<<<<<
> | > | ifTrue: [^ self processBufferUsingPrimitives: aByteArray]
> | > | ifFalse: [totals := nil].
> | > |
> | > |
> | > | "initialize registers a through e from the current totals"
> | > | a := totalA copy.
> | > | b := totalB copy.
> | > | c := totalC copy.
> | > | d := totalD copy.
> | > | e := totalE copy.
> | > |
> | > |
> | > | "expand and process the buffer"
> | > | w := self expandedBlock: aByteArray.
> | > | 1 to: 80 do: [:i |
> | > | tmp := (a copy leftRotateBy: 5)
> | > | += (self hashFunction: i of: b with: c with: d);
> | > | += e;
> | > | += (w at: i);
> | > | += (self constantForStep: i).
> | > | e := d.
> | > | d := c.
> | > | c := b copy leftRotateBy: 30.
> | > | b := a.
> | > | a := tmp].
> | > |
> | > |
> | > | "add a through e into total accumulators"
> | > | totalA += a.
> | > | totalB += b.
> | > | totalC += c.
> | > | totalD += d.
> | > | totalE += e.
> | > |
> | > |
> | > |
> | > |
> | > | I'm wondering if I somehow messed up my SecureHashAlgorithm class
> | > | with the other troubles I had
> | > | with Cloudfork or am I just destined to run into all kinds of
> | > | security problems. ;-)
> | > |
> | > |
> | > | Any thoughts?
> | > |
> | > |
> | > |
> | > |
> | > | Larry
> | > |
> | > |
> |
> |

1234 ... 6