bug in System::DirectoryServices::Protocols::BerConverter::Decode?

G

Guest

I'm trying to use the BerDecoder, but even in the simple sample below, I get
the exception "The "format" string contains an invalid character."

Here is my sample code:
byte[] integer1 = {1,2,3,4};
byte[] integer2 = {5,6,7,8};
Object[] data = { integer1, integer2 };

byte[] encodedBytes =
System.DirectoryServices.Protocols.BerConverter.Encode("{oo}", data);

Object[] decodedData =
System.DirectoryServices.Protocols.BerConverter.Decode("{oo}", encodedBytes);

What I really want to do is decode a PKCS.1 private key, but I don't know
what format string to use. I've manually decoded the byte array and I can see
that there are 128 byte "integers" (described with the 0x02 identifier), but
on my sample above, passing a byte array with a format string of "{i}" causes
the Encode function to throw an exception (whereas in the given sample Encode
succeeds, but Decode throws)...

All advice is welcome.
Thanks,
--Jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top