Interesting enough, I was able to make it work as well on another machine. I checked out the latest code from Subversion and copied the code into a Flex library project then referenced the new library swc. Everything worked as expected! I will try to use the library swc on my other machine to see if it continues to work there.
For what it is worth, the checked-out code would not compile in AS3. There are many places in the code with int.MAX_VALUE is used as a default parameter in a method call. This must have been OK with AS2 but AS3 chokes. You will need to replace these variables with the actual numbers. e.g. public function bmpString(size:int=int.MAX_VALUE,size2:int=0):BMPStringType { return new BMPStringType(size, size2); } Thanks for your help Nick. Jim --- In flexcoders@yahoogroups.com, "Uber_Nick" <[EMAIL PROTECTED]> wrote: > > Hi Jim, > > I copied your code into a project and pulled in the latest As3Crypto > source. Your project compiled and worked as expected. I was unable > to replicate the error, and would assume it's an environment issue. > > -Nick Matelli > > --- In flexcoders@yahoogroups.com, "Jim Boone" <jim@> wrote: > > > > Hi, > > > > I posted this on the As3Crypto discussion list but there is very > > little activity there. Maybe someone in this group has encrypted > > something using an RSA public key that they might share. > > > > I am trying to read a RSA public key so I can encrypt data in my > > application. I assembled a test app just to learn how the library > > works. Unfortunately, I didn't get very far. I get the message "I DONT > > KNOW HOW TO HANDLE DER stuff of TYPE 1" when I try to run the > > following code. I have downloaded the latest source from trunk but I > > still get the error. I generated the private and public keys using > > openssl as shown below: > > > > openssl genrsa -out private.pem 1024 > > openssl rsa -in private.pem -pubout -out public.pem > > > > Any clue what is happening here? > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > layout="absolute" creationComplete="init()"> > > > > <mx:Script> > > <![CDATA[ > > import com.hurlant.util.Hex; > > import com.hurlant.util.der.PEM; > > import com.hurlant.crypto.rsa.RSAKey; > > > > private var publicKey:String = "-----BEGIN > > PUBLIC KEY-----"+ > > > > "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq63UvOM+wA3FYLl7X5v5US1bd"+ > > > > "BP43wScM3boptegIIIO0ghhzhtmCUv7/278Jow9xI/za0CTf8DL9pSDu8+T+RY7U"+ > > > > "WOMaX/IK9D9tqxztDdPu29qSJFenun1O9OL+HaUYaNWSTLirHMZN67/aITtuyV6+"+ > > "ikAJfa9EOKAnT/CLIQIDAQAB"+ > > "-----END PUBLIC KEY-----"; > > > > private function init():void > > { > > var rsaPublicKey:RSAKey = > > PEM.readRSAPublicKey(publicKey); > > > > var message:ByteArray = > > Hex.toArray("now listen to this"); > > var encryptedMessage:ByteArray = new > > ByteArray; > > > > rsaPublicKey.encrypt(message,encryptedMessage,message.length); > > > > trace(Hex.fromArray(encryptedMessage)); > > } > > ]]> > > </mx:Script> > > </mx:Application> > > > > ~~~~~~~ Error ~~~~~~~~~~~~~~ > > > > I DONT KNOW HOW TO HANDLE DER stuff of TYPE 1 > > Error: Error #2030: End of file was encountered. > > at flash.utils::ByteArray/readBytes() > > at > > com.hurlant.util.der::DER$/parse()[C:\flex\crypto_1.3\com\hurlant > > \util\der\DER.as:134] > > at com.hurlant.util.der::PEM$/readRSAPublicKey()[C:\flex > > \crypto_1.3\com\hurlant\util\der\PEM.as:84] > > at > > Test/init()[C:\flex\workspaces\smtoolsPrototype\Test\src\Test.mxml: > > 28] > > > > ~Jim > > >