Does anyone mind if we rename this method to.. asAsn1Bytes or something?
#asByteArray would seem to be more appropriate for getting the LargeInteger's internal representation as a ByteArray. Print this script to demonstrate how #asByteArray is exactly reversed of the Integers internal representation.
| ba i | i _ 873984723987498. "a LargePositiveInteger" ba _ ByteArray new: i size. ba replaceFrom: 1 to: ba size with: i startingAt: 1. { ba. i asByteArray }
This selector, #asByteArray, should have already been implemented in base Squeak and usable by serialization for example, but it wasn't yet. Nevertheless, asn1-specific code should not hog this name in the namespace. I'd like to give it back along with an implementation of #asByteArray that is congruent with its internal representation.
However, I'm not sure where we are in terms of our lock down..
Chris Muller wrote:
Does anyone mind if we rename this method to.. asAsn1Bytes or something?
I'd prefer a method name which says what it does, not in which context it might be used. So a method which converts an Integer into a big-endian ByteArray should be called #asBigEndianByteArray, and the method to convert a big endian ByteArray back into an Integer would probably be #asBigEndianInteger (although I like that name less...).
A better alternative is probably to avoid representing ASN.1 Integers as ByteArrays altogether. When they are read from a Stream, you can just create an Integer, and when you're writing an Integer, you just write its bytes to the stream without converting to a ByteArray. A hypothetical class ASN1Stream should do that for you.
Cheers, Hans-Martin
On 12/19/05, Hans-Martin Mosner hmm@heeg.de wrote:
So a method which converts an Integer into a big-endian ByteArray should be called #asBigEndianByteArray, and the method to convert a big endian ByteArray back into an Integer would probably be #asBigEndianInteger (although I like that name less...).
#asIntegerFromBigEndian? Apart from that, +1
(i'm not sure about the feasability of direct streaming - last time I looked at ASN.1 has been a while and all I remember is that it was a bit messy ;-)).
-----Original Message----- From: cryptography-bounces@lists.squeakfoundation.org [mailto:cryptography-bounces@lists.squeakfoundation.org] On Behalf Of Chris Muller Sent: Sunday, December 18, 2005 9:00 PM
However, I'm not sure where we are in terms of our lock down..
All,
I've received advice from our lawyers, but have not yet acted on that advice. I will try to get it done this week. Basically everyone that has mentioned it was correct, the process was simple. I've asked them about confirmation with the government, since I remember that coming up at some point, but apparently there is no process to get certification. As soon as the notification is done I will revert the repository back to public access.
Ron
cryptography@lists.squeakfoundation.org