Porting the Cryptography package from squeak/pharo to gemstone.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Porting the Cryptography package from squeak/pharo to gemstone.

Paul DeBruicker
Hi -

I'm porting an application from Pharo to Gemstone.

I want to calculate an HMAC using SHA256 in gemstone.  I can do it using
the Cryptography package in Pharo. So, I'm trying to load the
Cryptography package from squeaksource into Gemstone 2.4.4.1 on Ubuntu
10.10 using a Pharo 1.1.1/GemTools 1.0b4 client.  But that gives some
compiler errors.

The Crypto package uses the method #\\\ from the Number class in Pharo.  
When I copy that method into the *squeak category for the Number class
in Gemstone and save it I get this error:

\\ expected a variable name->\ anInteger

That error makes me think that \\\ is not a valid method name in
Gemstone.  How are things like this usually handled when porting?



Is there a way to get calculate and HMAC using SHA256 in Gemstone or
should I keep working on porting the Cryptography package?

Thanks

Paul
Reply | Threaded
Open this post in threaded view
|

Re: Porting the Cryptography package from squeak/pharo to gemstone.

NorbertHartl
Hi Paul,

I can't help you with the compile problems. But I want to let you know that I think the Cryptography stuff is really important ifor gemstone.

Norbert

On 30.11.2010, at 19:06, Paul DeBruicker wrote:

> Hi -
>
> I'm porting an application from Pharo to Gemstone.
>
> I want to calculate an HMAC using SHA256 in gemstone.  I can do it using the Cryptography package in Pharo. So, I'm trying to load the Cryptography package from squeaksource into Gemstone 2.4.4.1 on Ubuntu 10.10 using a Pharo 1.1.1/GemTools 1.0b4 client.  But that gives some compiler errors.
>
> The Crypto package uses the method #\\\ from the Number class in Pharo.  When I copy that method into the *squeak category for the Number class in Gemstone and save it I get this error:
>
> \\ expected a variable name->\ anInteger
>
> That error makes me think that \\\ is not a valid method name in Gemstone.  How are things like this usually handled when porting?
>
>
>
> Is there a way to get calculate and HMAC using SHA256 in Gemstone or should I keep working on porting the Cryptography package?
>
> Thanks
>
> Paul

Reply | Threaded
Open this post in threaded view
|

Re: Porting the Cryptography package from squeak/pharo to gemstone.

Dale Henrichs
In reply to this post by Paul DeBruicker
Paul,

It looks like our parser/compiler does not like sequences of 3 special
characters... it chokes on the selectors:

   +++
   ///
   \\\

while:

   ++
   //
   \\

are accepted ... I'll have to dig into this a bit more ... the "normal
way to handle this" would be to extend our compiler which involves
modifications to the server code.

Before you get too far though, I seem to recall that the Crypto package
makes use of FFI making calls to a particular C library ... For GemStone
2.x that would require creating a number of user actions to make it
possible to call the C functions.

For 3.0 which should be going beta by the end of the year or so, you'd
be able to use GemStone's FFI layer to wrap the calls.

Dale

On 11/30/2010 10:06 AM, Paul DeBruicker wrote:

> Hi -
>
> I'm porting an application from Pharo to Gemstone.
>
> I want to calculate an HMAC using SHA256 in gemstone.  I can do it using
> the Cryptography package in Pharo. So, I'm trying to load the
> Cryptography package from squeaksource into Gemstone 2.4.4.1 on Ubuntu
> 10.10 using a Pharo 1.1.1/GemTools 1.0b4 client.  But that gives some
> compiler errors.
>
> The Crypto package uses the method #\\\ from the Number class in Pharo.
> When I copy that method into the *squeak category for the Number class
> in Gemstone and save it I get this error:
>
> \\ expected a variable name->\ anInteger
>
> That error makes me think that \\\ is not a valid method name in
> Gemstone.  How are things like this usually handled when porting?
>
>
>
> Is there a way to get calculate and HMAC using SHA256 in Gemstone or
> should I keep working on porting the Cryptography package?
>
> Thanks
>
> Paul

Reply | Threaded
Open this post in threaded view
|

Re: Porting the Cryptography package from squeak/pharo to gemstone.

SeanTAllen
In reply to this post by NorbertHartl
FYI... the https related stuff in the crypto package starts new processes which is going to be a big problem if you try to port.

On Tue, Nov 30, 2010 at 1:39 PM, Norbert Hartl <[hidden email]> wrote:
Hi Paul,

I can't help you with the compile problems. But I want to let you know that I think the Cryptography stuff is really important ifor gemstone.

Norbert

On 30.11.2010, at 19:06, Paul DeBruicker wrote:

> Hi -
>
> I'm porting an application from Pharo to Gemstone.
>
> I want to calculate an HMAC using SHA256 in gemstone.  I can do it using the Cryptography package in Pharo. So, I'm trying to load the Cryptography package from squeaksource into Gemstone 2.4.4.1 on Ubuntu 10.10 using a Pharo 1.1.1/GemTools 1.0b4 client.  But that gives some compiler errors.
>
> The Crypto package uses the method #\\\ from the Number class in Pharo.  When I copy that method into the *squeak category for the Number class in Gemstone and save it I get this error:
>
> \\ expected a variable name->\ anInteger
>
> That error makes me think that \\\ is not a valid method name in Gemstone.  How are things like this usually handled when porting?
>
>
>
> Is there a way to get calculate and HMAC using SHA256 in Gemstone or should I keep working on porting the Cryptography package?
>
> Thanks
>
> Paul


Reply | Threaded
Open this post in threaded view
|

Re: Porting the Cryptography package from squeak/pharo to gemstone.

Paul DeBruicker
In reply to this post by Dale Henrichs
Thanks Dale,

It turns out that the #\\\ method was just a faster way to do modulo
calculations.  So I just went back to the slower #\\ method.  Also, I
removed the primitive calls to the C Plugins you mentioned and added the
ThirtyTwoBitRegister class from Pharo to Gemstone.  The package was
setup to use the plugins if available and not use them if not. I also
had to add OrderedCollection class>> #newFrom: from Pharo.

Now I can load the code and the tests pass for the parts I'm interested
in using  (CryptoHashFunctionTest>>#testSHA256 and
CryptoHashFunctionTest>>#testHMAC).  The result of running the tests
are: 102 run, 36 passes, 0 expected failures, 1 failures, 65 errors, 0
unexpected passes.

Thanks

Paul






On 11/30/2010 03:06 PM, Dale Henrichs wrote:

> Paul,
>
> It looks like our parser/compiler does not like sequences of 3 special
> characters... it chokes on the selectors:
>
>   +++
>   ///
>   \\\
>
> while:
>
>   ++
>   //
>   \\
>
> are accepted ... I'll have to dig into this a bit more ... the "normal
> way to handle this" would be to extend our compiler which involves
> modifications to the server code.
>
> Before you get too far though, I seem to recall that the Crypto
> package makes use of FFI making calls to a particular C library ...
> For GemStone 2.x that would require creating a number of user actions
> to make it possible to call the C functions.
>
> For 3.0 which should be going beta by the end of the year or so, you'd
> be able to use GemStone's FFI layer to wrap the calls.
>
> Dale
>
> On 11/30/2010 10:06 AM, Paul DeBruicker wrote:
>> Hi -
>>
>> I'm porting an application from Pharo to Gemstone.
>>
>> I want to calculate an HMAC using SHA256 in gemstone.  I can do it using
>> the Cryptography package in Pharo. So, I'm trying to load the
>> Cryptography package from squeaksource into Gemstone 2.4.4.1 on Ubuntu
>> 10.10 using a Pharo 1.1.1/GemTools 1.0b4 client.  But that gives some
>> compiler errors.
>>
>> The Crypto package uses the method #\\\ from the Number class in Pharo.
>> When I copy that method into the *squeak category for the Number class
>> in Gemstone and save it I get this error:
>>
>> \\ expected a variable name->\ anInteger
>>
>> That error makes me think that \\\ is not a valid method name in
>> Gemstone.  How are things like this usually handled when porting?
>>
>>
>>
>> Is there a way to get calculate and HMAC using SHA256 in Gemstone or
>> should I keep working on porting the Cryptography package?
>>
>> Thanks
>>
>> Paul
>

Reply | Threaded
Open this post in threaded view
|

Re: Porting the Cryptography package from squeak/pharo to gemstone.

Dale Henrichs
Paul,

That's good news ... if you want to make this generally available, I'll
create a Crypto project on GemSource. Then I can add a gemstone entry to
the crypto config (I assume one exists and then we can work on getting
the remaining tests to pass...

Dale

On 11/30/2010 01:52 PM, Paul DeBruicker wrote:

> Thanks Dale,
>
> It turns out that the #\\\ method was just a faster way to do modulo
> calculations.  So I just went back to the slower #\\ method.  Also, I
> removed the primitive calls to the C Plugins you mentioned and added the
> ThirtyTwoBitRegister class from Pharo to Gemstone.  The package was
> setup to use the plugins if available and not use them if not. I also
> had to add OrderedCollection class>>  #newFrom: from Pharo.
>
> Now I can load the code and the tests pass for the parts I'm interested
> in using  (CryptoHashFunctionTest>>#testSHA256 and
> CryptoHashFunctionTest>>#testHMAC).  The result of running the tests
> are: 102 run, 36 passes, 0 expected failures, 1 failures, 65 errors, 0
> unexpected passes.
>
> Thanks
>
> Paul
>
>
>
>
>
>
> On 11/30/2010 03:06 PM, Dale Henrichs wrote:
>> Paul,
>>
>> It looks like our parser/compiler does not like sequences of 3 special
>> characters... it chokes on the selectors:
>>
>>    +++
>>    ///
>>    \\\
>>
>> while:
>>
>>    ++
>>    //
>>    \\
>>
>> are accepted ... I'll have to dig into this a bit more ... the "normal
>> way to handle this" would be to extend our compiler which involves
>> modifications to the server code.
>>
>> Before you get too far though, I seem to recall that the Crypto
>> package makes use of FFI making calls to a particular C library ...
>> For GemStone 2.x that would require creating a number of user actions
>> to make it possible to call the C functions.
>>
>> For 3.0 which should be going beta by the end of the year or so, you'd
>> be able to use GemStone's FFI layer to wrap the calls.
>>
>> Dale
>>
>> On 11/30/2010 10:06 AM, Paul DeBruicker wrote:
>>> Hi -
>>>
>>> I'm porting an application from Pharo to Gemstone.
>>>
>>> I want to calculate an HMAC using SHA256 in gemstone.  I can do it using
>>> the Cryptography package in Pharo. So, I'm trying to load the
>>> Cryptography package from squeaksource into Gemstone 2.4.4.1 on Ubuntu
>>> 10.10 using a Pharo 1.1.1/GemTools 1.0b4 client.  But that gives some
>>> compiler errors.
>>>
>>> The Crypto package uses the method #\\\ from the Number class in Pharo.
>>> When I copy that method into the *squeak category for the Number class
>>> in Gemstone and save it I get this error:
>>>
>>> \\ expected a variable name->\ anInteger
>>>
>>> That error makes me think that \\\ is not a valid method name in
>>> Gemstone.  How are things like this usually handled when porting?
>>>
>>>
>>>
>>> Is there a way to get calculate and HMAC using SHA256 in Gemstone or
>>> should I keep working on porting the Cryptography package?
>>>
>>> Thanks
>>>
>>> Paul
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Porting the Cryptography package from squeak/pharo to gemstone.

Dale Henrichs
In reply to this post by SeanTAllen
Ah okay ... you're tight .. we'll have to look carfefully at those
parts...getting past the c lib dependency (I didn't know that it was
optional) makes it worth the effort getting something figured out there.

Dale

On 11/30/2010 01:05 PM, Sean Allen wrote:

> FYI... the https related stuff in the crypto package starts new
> processes which is going to be a big problem if you try to port.
>
> On Tue, Nov 30, 2010 at 1:39 PM, Norbert Hartl <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Paul,
>
>     I can't help you with the compile problems. But I want to let you
>     know that I think the Cryptography stuff is really important ifor
>     gemstone.
>
>     Norbert
>
>     On 30.11.2010, at 19:06, Paul DeBruicker wrote:
>
>      > Hi -
>      >
>      > I'm porting an application from Pharo to Gemstone.
>      >
>      > I want to calculate an HMAC using SHA256 in gemstone.  I can do
>     it using the Cryptography package in Pharo. So, I'm trying to load
>     the Cryptography package from squeaksource into Gemstone 2.4.4.1 on
>     Ubuntu 10.10 using a Pharo 1.1.1/GemTools 1.0b4 client.  But that
>     gives some compiler errors.
>      >
>      > The Crypto package uses the method #\\\ from the Number class in
>     Pharo.  When I copy that method into the *squeak category for the
>     Number class in Gemstone and save it I get this error:
>      >
>      > \\ expected a variable name->\ anInteger
>      >
>      > That error makes me think that \\\ is not a valid method name in
>     Gemstone.  How are things like this usually handled when porting?
>      >
>      >
>      >
>      > Is there a way to get calculate and HMAC using SHA256 in Gemstone
>     or should I keep working on porting the Cryptography package?
>      >
>      > Thanks
>      >
>      > Paul
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Porting the Cryptography package from squeak/pharo to gemstone.

Paul DeBruicker
In reply to this post by Dale Henrichs
Sure.  Just let me know where to put what I've got.  I also made a
rudimentary ConfigurationOfCryptography as I couldn't find one earlier.






On 11/30/2010 05:02 PM, Dale Henrichs wrote:

> Paul,
>
> That's good news ... if you want to make this generally available,
> I'll create a Crypto project on GemSource. Then I can add a gemstone
> entry to the crypto config (I assume one exists and then we can work
> on getting the remaining tests to pass...
>
> Dale
>
> On 11/30/2010 01:52 PM, Paul DeBruicker wrote:
>> Thanks Dale,
>>
>> It turns out that the #\\\ method was just a faster way to do modulo
>> calculations.  So I just went back to the slower #\\ method.  Also, I
>> removed the primitive calls to the C Plugins you mentioned and added the
>> ThirtyTwoBitRegister class from Pharo to Gemstone.  The package was
>> setup to use the plugins if available and not use them if not. I also
>> had to add OrderedCollection class>>  #newFrom: from Pharo.
>>
>> Now I can load the code and the tests pass for the parts I'm interested
>> in using  (CryptoHashFunctionTest>>#testSHA256 and
>> CryptoHashFunctionTest>>#testHMAC).  The result of running the tests
>> are: 102 run, 36 passes, 0 expected failures, 1 failures, 65 errors, 0
>> unexpected passes.
>>
>> Thanks
>>
>> Paul
>>
>>
>>
>>
>>
>>
>> On 11/30/2010 03:06 PM, Dale Henrichs wrote:
>>> Paul,
>>>
>>> It looks like our parser/compiler does not like sequences of 3 special
>>> characters... it chokes on the selectors:
>>>
>>>    +++
>>>    ///
>>>    \\\
>>>
>>> while:
>>>
>>>    ++
>>>    //
>>>    \\
>>>
>>> are accepted ... I'll have to dig into this a bit more ... the "normal
>>> way to handle this" would be to extend our compiler which involves
>>> modifications to the server code.
>>>
>>> Before you get too far though, I seem to recall that the Crypto
>>> package makes use of FFI making calls to a particular C library ...
>>> For GemStone 2.x that would require creating a number of user actions
>>> to make it possible to call the C functions.
>>>
>>> For 3.0 which should be going beta by the end of the year or so, you'd
>>> be able to use GemStone's FFI layer to wrap the calls.
>>>
>>> Dale
>>>
>>> On 11/30/2010 10:06 AM, Paul DeBruicker wrote:
>>>> Hi -
>>>>
>>>> I'm porting an application from Pharo to Gemstone.
>>>>
>>>> I want to calculate an HMAC using SHA256 in gemstone.  I can do it
>>>> using
>>>> the Cryptography package in Pharo. So, I'm trying to load the
>>>> Cryptography package from squeaksource into Gemstone 2.4.4.1 on Ubuntu
>>>> 10.10 using a Pharo 1.1.1/GemTools 1.0b4 client.  But that gives some
>>>> compiler errors.
>>>>
>>>> The Crypto package uses the method #\\\ from the Number class in
>>>> Pharo.
>>>> When I copy that method into the *squeak category for the Number class
>>>> in Gemstone and save it I get this error:
>>>>
>>>> \\ expected a variable name->\ anInteger
>>>>
>>>> That error makes me think that \\\ is not a valid method name in
>>>> Gemstone.  How are things like this usually handled when porting?
>>>>
>>>>
>>>>
>>>> Is there a way to get calculate and HMAC using SHA256 in Gemstone or
>>>> should I keep working on porting the Cryptography package?
>>>>
>>>> Thanks
>>>>
>>>> Paul
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Porting the Cryptography package from squeak/pharo to gemstone.

Dale Henrichs
In reply to this post by Paul DeBruicker
Paul,

I've added the project to GemSource:

   http://seaside.gemstone.com/ss/Cryptography.html

And given GLASS DEVS commit rights (you're in that group), so put the
package(s) and configuration there and I'll take care of the rest ...

Dale


On 11/30/2010 01:52 PM, Paul DeBruicker wrote:

> Thanks Dale,
>
> It turns out that the #\\\ method was just a faster way to do modulo
> calculations.  So I just went back to the slower #\\ method.  Also, I
> removed the primitive calls to the C Plugins you mentioned and added the
> ThirtyTwoBitRegister class from Pharo to Gemstone.  The package was
> setup to use the plugins if available and not use them if not. I also
> had to add OrderedCollection class>>  #newFrom: from Pharo.
>
> Now I can load the code and the tests pass for the parts I'm interested
> in using  (CryptoHashFunctionTest>>#testSHA256 and
> CryptoHashFunctionTest>>#testHMAC).  The result of running the tests
> are: 102 run, 36 passes, 0 expected failures, 1 failures, 65 errors, 0
> unexpected passes.
>
> Thanks
>
> Paul
>
>
>
>
>
>
> On 11/30/2010 03:06 PM, Dale Henrichs wrote:
>> Paul,
>>
>> It looks like our parser/compiler does not like sequences of 3 special
>> characters... it chokes on the selectors:
>>
>>    +++
>>    ///
>>    \\\
>>
>> while:
>>
>>    ++
>>    //
>>    \\
>>
>> are accepted ... I'll have to dig into this a bit more ... the "normal
>> way to handle this" would be to extend our compiler which involves
>> modifications to the server code.
>>
>> Before you get too far though, I seem to recall that the Crypto
>> package makes use of FFI making calls to a particular C library ...
>> For GemStone 2.x that would require creating a number of user actions
>> to make it possible to call the C functions.
>>
>> For 3.0 which should be going beta by the end of the year or so, you'd
>> be able to use GemStone's FFI layer to wrap the calls.
>>
>> Dale
>>
>> On 11/30/2010 10:06 AM, Paul DeBruicker wrote:
>>> Hi -
>>>
>>> I'm porting an application from Pharo to Gemstone.
>>>
>>> I want to calculate an HMAC using SHA256 in gemstone.  I can do it using
>>> the Cryptography package in Pharo. So, I'm trying to load the
>>> Cryptography package from squeaksource into Gemstone 2.4.4.1 on Ubuntu
>>> 10.10 using a Pharo 1.1.1/GemTools 1.0b4 client.  But that gives some
>>> compiler errors.
>>>
>>> The Crypto package uses the method #\\\ from the Number class in Pharo.
>>> When I copy that method into the *squeak category for the Number class
>>> in Gemstone and save it I get this error:
>>>
>>> \\ expected a variable name->\ anInteger
>>>
>>> That error makes me think that \\\ is not a valid method name in
>>> Gemstone.  How are things like this usually handled when porting?
>>>
>>>
>>>
>>> Is there a way to get calculate and HMAC using SHA256 in Gemstone or
>>> should I keep working on porting the Cryptography package?
>>>
>>> Thanks
>>>
>>> Paul
>>
>