By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,572 Members | 959 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,572 IT Pros & Developers. It's quick & easy.

Does anyone know if BerConverter class runs on Win 2000 server?

P: n/a
I'm getting an error when I tried to use this BerConverter class in my C#
code. Even though the Interent doc says that it runs on Win2000 sp4, I just
thgouth I'll double check. Does anyone know if BerConverter is supported for
Win2000 server?
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
--
Thanks.
Aug 17 '06 #1
Share this Question
Share on Google+
15 Replies


P: n/a
IMO W2K is not supported, I know it runs on XP SP2 W2K3 and Vista, what kind
of exception or error did you face?

Willy.

"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:8F**********************************@microsof t.com...
| I'm getting an error when I tried to use this BerConverter class in my C#
| code. Even though the Interent doc says that it runs on Win2000 sp4, I
just
| thgouth I'll double check. Does anyone know if BerConverter is supported
for
| Win2000 server?
|
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
| --
| Thanks.
Aug 21 '06 #2

P: n/a
Just checked and I see no reason it should not work on W2K, mind to post a
short but complete sample that illustrates your issue.

Willy.

"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:8F**********************************@microsof t.com...
| I'm getting an error when I tried to use this BerConverter class in my C#
| code. Even though the Interent doc says that it runs on Win2000 sp4, I
just
| thgouth I'll double check. Does anyone know if BerConverter is supported
for
| Win2000 server?
|
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
| --
| Thanks.
Aug 21 '06 #3

P: n/a
Hi Willy,
Thank you for the reply and here is more information about my code and the
problem I'm having.

I'm getting the following error message in the catch
"BerConversionException: An error occurred during the BER conversion."

Here is the calling code. I'm passing the meetingBlob attribute of the
meeting class in Active Directory Schema to decode:
enMeetingBlob =
((byte[])child.Properties["meetingBlob"].Value);
meetingBlob =
CUnityDS.DecodeMeetingBlob(enMeetingBlob);

Here is the method that decodes it I got the error at the following line of
code:
object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
encodedMeetingBlob);
public static string DecodeMeetingBlob(byte[] encodedMeetingBlob)
{
string meetingBlob = null;
//Decode it
object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
encodedMeetingBlob);
foreach (object o in decodedObjects)
{
if (o is byte[])
{
meetingBlob += (ByteArrayToStringInHex((byte[])o));
}
else if (o is byte[][])
{
byte[][] byteArrays = (byte[][])o;
for (int i = 0; i < byteArrays.Length; i++)
{
meetingBlob += (CUnityDS.ByteArrayToStringInHex(byteArrays[i])
+ " - ");
}
//Console.WriteLine();
}
else if (o is string[])
{
string[] strArray = (string[])o;
for (int i = 0; i < strArray.Length; i++)
{
meetingBlob += (strArray[i] + " - ");
}
//Console.WriteLine();
}
else
{
meetingBlob += "\n";
//Console.WriteLine(o);
}
}
string test = meetingBlob;
return meetingBlob;
}
}//end CUnityDS
--
Thanks.
"Willy Denoyette [MVP]" wrote:
Just checked and I see no reason it should not work on W2K, mind to post a
short but complete sample that illustrates your issue.

Willy.

"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:8F**********************************@microsof t.com...
| I'm getting an error when I tried to use this BerConverter class in my C#
| code. Even though the Interent doc says that it runs on Win2000 sp4, I
just
| thgouth I'll double check. Does anyone know if BerConverter is supported
for
| Win2000 server?
|
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
| --
| Thanks.
Aug 22 '06 #4

P: n/a
Here is the stackTrace output: I think the problem might occurr at at
System.DirectoryServices.Protocols.BerSafeHandle.. ctor(berval value)
Can you make out what does this mean?

StackTrace = " at
System.DirectoryServices.Protocols.BerSafeHandle.. ctor(berval value)\r\n at
System.DirectoryServices.Protocols.BerConverter.Tr yDecode(String format,
Byte[] value, Boolean& decodeSucceeded)\r\n at
System.DirectoryServices.Protocols.BerConverter.De ...
--
Thanks.
"Willy Denoyette [MVP]" wrote:
Just checked and I see no reason it should not work on W2K, mind to post a
short but complete sample that illustrates your issue.

Willy.

"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:8F**********************************@microsof t.com...
| I'm getting an error when I tried to use this BerConverter class in my C#
| code. Even though the Interent doc says that it runs on Win2000 sp4, I
just
| thgouth I'll double check. Does anyone know if BerConverter is supported
for
| Win2000 server?
|
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
| --
| Thanks.
Aug 22 '06 #5

P: n/a
From what you posted I see that you are simply passing the meetingBlob
property, this property isn't ber encoded, right!
What I would like to see is the real contents of the blob (the byte array);

Willy.
"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
| Hi Willy,
| Thank you for the reply and here is more information about my code and the
| problem I'm having.
|
| I'm getting the following error message in the catch
| "BerConversionException: An error occurred during the BER conversion."
|
| Here is the calling code. I'm passing the meetingBlob attribute of the
| meeting class in Active Directory Schema to decode:
| enMeetingBlob =
| ((byte[])child.Properties["meetingBlob"].Value);
| meetingBlob =
| CUnityDS.DecodeMeetingBlob(enMeetingBlob);
|
| Here is the method that decodes it I got the error at the following line
of
| code:
| object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| encodedMeetingBlob);
|
|
| public static string DecodeMeetingBlob(byte[] encodedMeetingBlob)
| {
| string meetingBlob = null;
| //Decode it
| object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| encodedMeetingBlob);
| foreach (object o in decodedObjects)
| {
| if (o is byte[])
| {
| meetingBlob += (ByteArrayToStringInHex((byte[])o));
| }
| else if (o is byte[][])
| {
| byte[][] byteArrays = (byte[][])o;
| for (int i = 0; i < byteArrays.Length; i++)
| {
| meetingBlob +=
(CUnityDS.ByteArrayToStringInHex(byteArrays[i])
| + " - ");
| }
| //Console.WriteLine();
| }
| else if (o is string[])
| {
| string[] strArray = (string[])o;
| for (int i = 0; i < strArray.Length; i++)
| {
| meetingBlob += (strArray[i] + " - ");
| }
| //Console.WriteLine();
| }
| else
| {
| meetingBlob += "\n";
| //Console.WriteLine(o);
| }
| }
| string test = meetingBlob;
| return meetingBlob;
| }
| }//end CUnityDS
| --
| Thanks.
|
|
| "Willy Denoyette [MVP]" wrote:
|
| Just checked and I see no reason it should not work on W2K, mind to post
a
| short but complete sample that illustrates your issue.
| >
| Willy.
| >
| "Pucca" <Pu***@discussions.microsoft.comwrote in message
| news:8F**********************************@microsof t.com...
| | I'm getting an error when I tried to use this BerConverter class in my
C#
| | code. Even though the Interent doc says that it runs on Win2000 sp4,
I
| just
| | thgouth I'll double check. Does anyone know if BerConverter is
supported
| for
| | Win2000 server?
| |
| >
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
| | --
| | Thanks.
| >
| >
| >
Aug 22 '06 #6

P: n/a
Hi Willy, The meetingBlob property was encoded in my C++ application. Here
is the content I got during the Debug mode in C#. Thank you.

- enMeetingBlob {Dimensions:[58]} byte[]
[0] 96 byte
[1] 56 byte
[2] 2 byte
[3] 1 byte
[4] 0 byte
[5] 2 byte
[6] 1 byte
[7] 1 byte
[8] 2 byte
[9] 1 byte
[10] 1 byte
[11] 27 byte
[12] 3 byte
[13] 53 byte
[14] 56 byte
[15] 53 byte
[16] 2 byte
[17] 1 byte
[18] 1 byte
[19] 27 byte
[20] 0 byte
[21] 27 byte
[22] 11 byte
[23] 47 byte
[24] 98 byte
[25] 105 byte
[26] 110 byte
[27] 47 byte
[28] 115 byte
[29] 104 byte
[30] 101 byte
[31] 108 byte
[32] 108 byte
[33] 115 byte
[34] 27 byte
[35] 16 byte
[36] 47 byte
[37] 116 byte
[38] 109 byte
[39] 112 byte
[40] 47 byte
[41] 104 byte
[42] 111 byte
[43] 109 byte
[44] 101 byte
[45] 47 byte
[46] 100 byte
[47] 105 byte
[48] 114 byte
[49] 105 byte
[50] 118 byte
[51] 101 byte
[52] 27 byte
[53] 4 byte
[54] 49 byte
[55] 54 byte
[56] 49 byte
[57] 50 byte

--
Thanks.
"Willy Denoyette [MVP]" wrote:
From what you posted I see that you are simply passing the meetingBlob
property, this property isn't ber encoded, right!
What I would like to see is the real contents of the blob (the byte array);

Willy.
"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
| Hi Willy,
| Thank you for the reply and here is more information about my code and the
| problem I'm having.
|
| I'm getting the following error message in the catch
| "BerConversionException: An error occurred during the BER conversion."
|
| Here is the calling code. I'm passing the meetingBlob attribute of the
| meeting class in Active Directory Schema to decode:
| enMeetingBlob =
| ((byte[])child.Properties["meetingBlob"].Value);
| meetingBlob =
| CUnityDS.DecodeMeetingBlob(enMeetingBlob);
|
| Here is the method that decodes it I got the error at the following line
of
| code:
| object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| encodedMeetingBlob);
|
|
| public static string DecodeMeetingBlob(byte[] encodedMeetingBlob)
| {
| string meetingBlob = null;
| //Decode it
| object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| encodedMeetingBlob);
| foreach (object o in decodedObjects)
| {
| if (o is byte[])
| {
| meetingBlob += (ByteArrayToStringInHex((byte[])o));
| }
| else if (o is byte[][])
| {
| byte[][] byteArrays = (byte[][])o;
| for (int i = 0; i < byteArrays.Length; i++)
| {
| meetingBlob +=
(CUnityDS.ByteArrayToStringInHex(byteArrays[i])
| + " - ");
| }
| //Console.WriteLine();
| }
| else if (o is string[])
| {
| string[] strArray = (string[])o;
| for (int i = 0; i < strArray.Length; i++)
| {
| meetingBlob += (strArray[i] + " - ");
| }
| //Console.WriteLine();
| }
| else
| {
| meetingBlob += "\n";
| //Console.WriteLine(o);
| }
| }
| string test = meetingBlob;
| return meetingBlob;
| }
| }//end CUnityDS
| --
| Thanks.
|
|
| "Willy Denoyette [MVP]" wrote:
|
| Just checked and I see no reason it should not work on W2K, mind to post
a
| short but complete sample that illustrates your issue.
| >
| Willy.
| >
| "Pucca" <Pu***@discussions.microsoft.comwrote in message
| news:8F**********************************@microsof t.com...
| | I'm getting an error when I tried to use this BerConverter class in my
C#
| | code. Even though the Interent doc says that it runs on Win2000 sp4,
I
| just
| | thgouth I'll double check. Does anyone know if BerConverter is
supported
| for
| | Win2000 server?
| |
| >
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
| | --
| | Thanks.
| >
| >
| >
Aug 22 '06 #7

P: n/a
IMO your encode blob is not valid.
When I decode your blob on XP SP2 or W2K3 I get :
BerConversionException:An error occurred during the BER conversion.

The encoded string should look libe this, notice the header 48, 132, 0, 0,
0, 62 where 0,0,0,62 is the length of the blob

48, 132, 0, 0, 0, 62, 2, 1, 0, 2, 1, 1, 2, 1, 1, 27, 3, 53, 56, 53, 2, 1,
1, 27, 0, 27, 11, 47, 98, 105, 110, 47, 115, 104, 101, 108, 108, 115, 27,
16, 47, 116, 109, 112, 47, 104, 111, 109, 101, 47, 100, 105, 114, 105, 118,
101, 27, 4, 49, 54, 49, 50

Try following program using the modified blob you'll see what I mean.

using System;
using System.IO;
using System.Threading;
using System.Security;
//
// csc.exe /r:System.DirectoryServices.Protocols.dll Berprobl.cs

using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Globalization;

using System.DirectoryServices.Protocols;
namespace Willys
{
class Tester
{
//
// Converts a byte[] to a hex string
//
public static string ByteArrayToStringInHex(byte[] bytes)
{
StringBuilder s = new StringBuilder(bytes.Length/2);
foreach(byte b in bytes)
{
s.Append(String.Format(CultureInfo.InvariantCultur e, "0x{0:X2},"
,b));
}
string retStr = s.ToString();

// remove the last comma character
retStr = retStr.Remove(retStr.Length-1,1);
return retStr;
}
static void Main()
{
byte[] berEncodedValue = {
48, 132, 0, 0, 0, 62, 2, 1, 0, 2, 1, 1, 2, 1, 1, 27, 3, 53, 56, 53, 2, 1,
1, 27, 0, 27, 11, 47, 98, 105, 110, 47, 115, 104, 101, 108, 108, 115, 27,
16, 47, 116, 109, 112, 47, 104, 111, 109, 101, 47, 100, 105, 114, 105, 118,
101, 27, 4, 49, 54, 49, 50
};
try
{
Console.WriteLine("\r\nBer decoding the byte array...");
object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
berEncodedValue);

Console.WriteLine("\r\nThe decoded objects are:");
foreach(object o in decodedObjects)
{
if(o is byte[])
{
Console.WriteLine(ByteArrayToStringInHex((byte[])o));
}
else if (o is byte[][])
{
byte[][] byteArrays = (byte[][])o;
for(int i=0;i<byteArrays.Length;i++)
{
Console.Write(ByteArrayToStringInHex(byteArrays[i])
+ " - ");
}
Console.WriteLine();
}
else if(o is string[])
{
string[] strArray = (string[])o;
for(int i=0;i<strArray.Length;i++)
{
Console.Write(strArray[i] + " - ");
}
Console.WriteLine();
}
else
{
Console.WriteLine(o);
}
}
}
catch(BerConversionException e)
{
Console.WriteLine("BerConversionException:" + e.Message);
}
catch(ArgumentException e)
{
Console.WriteLine("ArgumentException:" + e.Message);
}
}
}
}

Seems like your problem relates to the encoding done outside the managed
memory space.

Willy.
"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:C0**********************************@microsof t.com...
| Hi Willy, The meetingBlob property was encoded in my C++ application.
Here
| is the content I got during the Debug mode in C#. Thank you.
|
| - enMeetingBlob {Dimensions:[58]} byte[]
| [0] 96 byte
| [1] 56 byte
| [2] 2 byte
| [3] 1 byte
| [4] 0 byte
| [5] 2 byte
| [6] 1 byte
| [7] 1 byte
| [8] 2 byte
| [9] 1 byte
| [10] 1 byte
| [11] 27 byte
| [12] 3 byte
| [13] 53 byte
| [14] 56 byte
| [15] 53 byte
| [16] 2 byte
| [17] 1 byte
| [18] 1 byte
| [19] 27 byte
| [20] 0 byte
| [21] 27 byte
| [22] 11 byte
| [23] 47 byte
| [24] 98 byte
| [25] 105 byte
| [26] 110 byte
| [27] 47 byte
| [28] 115 byte
| [29] 104 byte
| [30] 101 byte
| [31] 108 byte
| [32] 108 byte
| [33] 115 byte
| [34] 27 byte
| [35] 16 byte
| [36] 47 byte
| [37] 116 byte
| [38] 109 byte
| [39] 112 byte
| [40] 47 byte
| [41] 104 byte
| [42] 111 byte
| [43] 109 byte
| [44] 101 byte
| [45] 47 byte
| [46] 100 byte
| [47] 105 byte
| [48] 114 byte
| [49] 105 byte
| [50] 118 byte
| [51] 101 byte
| [52] 27 byte
| [53] 4 byte
| [54] 49 byte
| [55] 54 byte
| [56] 49 byte
| [57] 50 byte
|
| --
| Thanks.
|
|
| "Willy Denoyette [MVP]" wrote:
|
| From what you posted I see that you are simply passing the meetingBlob
| property, this property isn't ber encoded, right!
| What I would like to see is the real contents of the blob (the byte
array);
| >
| Willy.
| >
| >
| "Pucca" <Pu***@discussions.microsoft.comwrote in message
| news:15**********************************@microsof t.com...
| | Hi Willy,
| | Thank you for the reply and here is more information about my code and
the
| | problem I'm having.
| |
| | I'm getting the following error message in the catch
| | "BerConversionException: An error occurred during the BER conversion."
| |
| | Here is the calling code. I'm passing the meetingBlob attribute of
the
| | meeting class in Active Directory Schema to decode:
| | enMeetingBlob =
| | ((byte[])child.Properties["meetingBlob"].Value);
| | meetingBlob =
| | CUnityDS.DecodeMeetingBlob(enMeetingBlob);
| |
| | Here is the method that decodes it I got the error at the following
line
| of
| | code:
| | object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| | encodedMeetingBlob);
| |
| |
| | public static string DecodeMeetingBlob(byte[] encodedMeetingBlob)
| | {
| | string meetingBlob = null;
| | //Decode it
| | object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| | encodedMeetingBlob);
| | foreach (object o in decodedObjects)
| | {
| | if (o is byte[])
| | {
| | meetingBlob += (ByteArrayToStringInHex((byte[])o));
| | }
| | else if (o is byte[][])
| | {
| | byte[][] byteArrays = (byte[][])o;
| | for (int i = 0; i < byteArrays.Length; i++)
| | {
| | meetingBlob +=
| (CUnityDS.ByteArrayToStringInHex(byteArrays[i])
| | + " - ");
| | }
| | //Console.WriteLine();
| | }
| | else if (o is string[])
| | {
| | string[] strArray = (string[])o;
| | for (int i = 0; i < strArray.Length; i++)
| | {
| | meetingBlob += (strArray[i] + " - ");
| | }
| | //Console.WriteLine();
| | }
| | else
| | {
| | meetingBlob += "\n";
| | //Console.WriteLine(o);
| | }
| | }
| | string test = meetingBlob;
| | return meetingBlob;
| | }
| | }//end CUnityDS
| | --
| | Thanks.
| |
| |
| | "Willy Denoyette [MVP]" wrote:
| |
| | Just checked and I see no reason it should not work on W2K, mind to
post
| a
| | short but complete sample that illustrates your issue.
| | >
| | Willy.
| | >
| | "Pucca" <Pu***@discussions.microsoft.comwrote in message
| | news:8F**********************************@microsof t.com...
| | | I'm getting an error when I tried to use this BerConverter class
in my
| C#
| | | code. Even though the Interent doc says that it runs on Win2000
sp4,
| I
| | just
| | | thgouth I'll double check. Does anyone know if BerConverter is
| supported
| | for
| | | Win2000 server?
| | |
| | >
| >
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
| | | --
| | | Thanks.
| | >
| | >
| | >
| >
| >
| >
Aug 22 '06 #8

P: n/a
Thank you very much Willy. I call the encoding fucntion given to me for the
C++ module. Those encoding functions are written in Unix C and I just added
them to my C++ module. I called the Decoding functions in C++ module and
they seem to work.

So does this mean I can't call the BerConverter class in C# to decode this?
Do I have to now make those Unix C functions into a dll which I then pinvok
to decode? It's daunting just thinking of the how to figure out the
marshalling of strings and integer.
--
Thanks.
"Willy Denoyette [MVP]" wrote:
IMO your encode blob is not valid.
When I decode your blob on XP SP2 or W2K3 I get :
BerConversionException:An error occurred during the BER conversion.

The encoded string should look libe this, notice the header 48, 132, 0, 0,
0, 62 where 0,0,0,62 is the length of the blob

48, 132, 0, 0, 0, 62, 2, 1, 0, 2, 1, 1, 2, 1, 1, 27, 3, 53, 56, 53, 2, 1,
1, 27, 0, 27, 11, 47, 98, 105, 110, 47, 115, 104, 101, 108, 108, 115, 27,
16, 47, 116, 109, 112, 47, 104, 111, 109, 101, 47, 100, 105, 114, 105, 118,
101, 27, 4, 49, 54, 49, 50

Try following program using the modified blob you'll see what I mean.

using System;
using System.IO;
using System.Threading;
using System.Security;
//
// csc.exe /r:System.DirectoryServices.Protocols.dll Berprobl.cs

using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Globalization;

using System.DirectoryServices.Protocols;
namespace Willys
{
class Tester
{
//
// Converts a byte[] to a hex string
//
public static string ByteArrayToStringInHex(byte[] bytes)
{
StringBuilder s = new StringBuilder(bytes.Length/2);
foreach(byte b in bytes)
{
s.Append(String.Format(CultureInfo.InvariantCultur e, "0x{0:X2},"
,b));
}
string retStr = s.ToString();

// remove the last comma character
retStr = retStr.Remove(retStr.Length-1,1);
return retStr;
}
static void Main()
{
byte[] berEncodedValue = {
48, 132, 0, 0, 0, 62, 2, 1, 0, 2, 1, 1, 2, 1, 1, 27, 3, 53, 56, 53, 2, 1,
1, 27, 0, 27, 11, 47, 98, 105, 110, 47, 115, 104, 101, 108, 108, 115, 27,
16, 47, 116, 109, 112, 47, 104, 111, 109, 101, 47, 100, 105, 114, 105, 118,
101, 27, 4, 49, 54, 49, 50
};
try
{
Console.WriteLine("\r\nBer decoding the byte array...");
object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
berEncodedValue);

Console.WriteLine("\r\nThe decoded objects are:");
foreach(object o in decodedObjects)
{
if(o is byte[])
{
Console.WriteLine(ByteArrayToStringInHex((byte[])o));
}
else if (o is byte[][])
{
byte[][] byteArrays = (byte[][])o;
for(int i=0;i<byteArrays.Length;i++)
{
Console.Write(ByteArrayToStringInHex(byteArrays[i])
+ " - ");
}
Console.WriteLine();
}
else if(o is string[])
{
string[] strArray = (string[])o;
for(int i=0;i<strArray.Length;i++)
{
Console.Write(strArray[i] + " - ");
}
Console.WriteLine();
}
else
{
Console.WriteLine(o);
}
}
}
catch(BerConversionException e)
{
Console.WriteLine("BerConversionException:" + e.Message);
}
catch(ArgumentException e)
{
Console.WriteLine("ArgumentException:" + e.Message);
}
}
}
}

Seems like your problem relates to the encoding done outside the managed
memory space.

Willy.
"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:C0**********************************@microsof t.com...
| Hi Willy, The meetingBlob property was encoded in my C++ application.
Here
| is the content I got during the Debug mode in C#. Thank you.
|
| - enMeetingBlob {Dimensions:[58]} byte[]
| [0] 96 byte
| [1] 56 byte
| [2] 2 byte
| [3] 1 byte
| [4] 0 byte
| [5] 2 byte
| [6] 1 byte
| [7] 1 byte
| [8] 2 byte
| [9] 1 byte
| [10] 1 byte
| [11] 27 byte
| [12] 3 byte
| [13] 53 byte
| [14] 56 byte
| [15] 53 byte
| [16] 2 byte
| [17] 1 byte
| [18] 1 byte
| [19] 27 byte
| [20] 0 byte
| [21] 27 byte
| [22] 11 byte
| [23] 47 byte
| [24] 98 byte
| [25] 105 byte
| [26] 110 byte
| [27] 47 byte
| [28] 115 byte
| [29] 104 byte
| [30] 101 byte
| [31] 108 byte
| [32] 108 byte
| [33] 115 byte
| [34] 27 byte
| [35] 16 byte
| [36] 47 byte
| [37] 116 byte
| [38] 109 byte
| [39] 112 byte
| [40] 47 byte
| [41] 104 byte
| [42] 111 byte
| [43] 109 byte
| [44] 101 byte
| [45] 47 byte
| [46] 100 byte
| [47] 105 byte
| [48] 114 byte
| [49] 105 byte
| [50] 118 byte
| [51] 101 byte
| [52] 27 byte
| [53] 4 byte
| [54] 49 byte
| [55] 54 byte
| [56] 49 byte
| [57] 50 byte
|
| --
| Thanks.
|
|
| "Willy Denoyette [MVP]" wrote:
|
| From what you posted I see that you are simply passing the meetingBlob
| property, this property isn't ber encoded, right!
| What I would like to see is the real contents of the blob (the byte
array);
| >
| Willy.
| >
| >
| "Pucca" <Pu***@discussions.microsoft.comwrote in message
| news:15**********************************@microsof t.com...
| | Hi Willy,
| | Thank you for the reply and here is more information about my code and
the
| | problem I'm having.
| |
| | I'm getting the following error message in the catch
| | "BerConversionException: An error occurred during the BER conversion."
| |
| | Here is the calling code. I'm passing the meetingBlob attribute of
the
| | meeting class in Active Directory Schema to decode:
| | enMeetingBlob =
| | ((byte[])child.Properties["meetingBlob"].Value);
| | meetingBlob =
| | CUnityDS.DecodeMeetingBlob(enMeetingBlob);
| |
| | Here is the method that decodes it I got the error at the following
line
| of
| | code:
| | object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| | encodedMeetingBlob);
| |
| |
| | public static string DecodeMeetingBlob(byte[] encodedMeetingBlob)
| | {
| | string meetingBlob = null;
| | //Decode it
| | object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| | encodedMeetingBlob);
| | foreach (object o in decodedObjects)
| | {
| | if (o is byte[])
| | {
| | meetingBlob += (ByteArrayToStringInHex((byte[])o));
| | }
| | else if (o is byte[][])
| | {
| | byte[][] byteArrays = (byte[][])o;
| | for (int i = 0; i < byteArrays.Length; i++)
| | {
| | meetingBlob +=
| (CUnityDS.ByteArrayToStringInHex(byteArrays[i])
| | + " - ");
| | }
| | //Console.WriteLine();
| | }
| | else if (o is string[])
| | {
| | string[] strArray = (string[])o;
| | for (int i = 0; i < strArray.Length; i++)
| | {
| | meetingBlob += (strArray[i] + " - ");
| | }
| | //Console.WriteLine();
| | }
| | else
| | {
| | meetingBlob += "\n";
| | //Console.WriteLine(o);
| | }
| | }
| | string test = meetingBlob;
| | return meetingBlob;
| | }
| | }//end CUnityDS
| | --
| | Thanks.
| |
| |
| | "Willy Denoyette [MVP]" wrote:
| |
| | Just checked and I see no reason it should not work on W2K, mind to
post
| a
| | short but complete sample that illustrates your issue.
| | >
| | Willy.
| | >
| | "Pucca" <Pu***@discussions.microsoft.comwrote in message
| | news:8F**********************************@microsof t.com...
| | | I'm getting an error when I tried to use this BerConverter class
in my
| C#
| | | code. Even though the Interent doc says that it runs on Win2000
sp4,
| I
| | just
| | | thgouth I'll double check. Does anyone know if BerConverter is
| supported
| | for
| | | Win2000 server?
| | |
| | >
| >
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
| | | --
| | | Thanks.
| | >
| | >
| | >
| >
| >
| >
Aug 22 '06 #9

P: n/a
Does this mean that the LDAP server isn't an Active Directory server running
on Windows, or is it even a non AD server running on Unix?
Anyway, C++ or C# what should be done is using the same Ldap library for
both Encoding and Decoding. C# uses the Windows library ber (exports in
wldap32.lib headers in winber.h) functions (implementation is in
wldap32.dll). So you can use the same library in your C++ code, else you
will have to create a C++ library using your ldap library and PInvoke these
functions from C#, just wonder why would you even use C# in this case. The
power of C# is in the FCL really, and this library sits in top of Win32 and
all of it's services (like AD services), mixing Unix and Windows has it's
own issues I would guess.

Willy.
"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:94**********************************@microsof t.com...
| Thank you very much Willy. I call the encoding fucntion given to me for
the
| C++ module. Those encoding functions are written in Unix C and I just
added
| them to my C++ module. I called the Decoding functions in C++ module and
| they seem to work.
|
| So does this mean I can't call the BerConverter class in C# to decode
this?
| Do I have to now make those Unix C functions into a dll which I then
pinvok
| to decode? It's daunting just thinking of the how to figure out the
| marshalling of strings and integer.
| --
| Thanks.
|
|
| "Willy Denoyette [MVP]" wrote:
|
| IMO your encode blob is not valid.
| When I decode your blob on XP SP2 or W2K3 I get :
| BerConversionException:An error occurred during the BER conversion.
| >
| The encoded string should look libe this, notice the header 48, 132, 0,
0,
| 0, 62 where 0,0,0,62 is the length of the blob
| >
| 48, 132, 0, 0, 0, 62, 2, 1, 0, 2, 1, 1, 2, 1, 1, 27, 3, 53, 56, 53, 2,
1,
| 1, 27, 0, 27, 11, 47, 98, 105, 110, 47, 115, 104, 101, 108, 108, 115,
27,
| 16, 47, 116, 109, 112, 47, 104, 111, 109, 101, 47, 100, 105, 114, 105,
118,
| 101, 27, 4, 49, 54, 49, 50
| >
| Try following program using the modified blob you'll see what I mean.
| >
| using System;
| using System.IO;
| using System.Threading;
| using System.Security;
| //
| // csc.exe /r:System.DirectoryServices.Protocols.dll Berprobl.cs
| >
| using System.Runtime.InteropServices;
| using System.Collections.Generic;
| using System.Diagnostics;
| using System.Text;
| using System.Globalization;
| >
| using System.DirectoryServices.Protocols;
| namespace Willys
| {
| class Tester
| {
| //
| // Converts a byte[] to a hex string
| //
| public static string ByteArrayToStringInHex(byte[] bytes)
| {
| StringBuilder s = new StringBuilder(bytes.Length/2);
| foreach(byte b in bytes)
| {
| s.Append(String.Format(CultureInfo.InvariantCultur e,
"0x{0:X2},"
| ,b));
| }
| string retStr = s.ToString();
| >
| // remove the last comma character
| retStr = retStr.Remove(retStr.Length-1,1);
| return retStr;
| }
| static void Main()
| {
| byte[] berEncodedValue = {
| 48, 132, 0, 0, 0, 62, 2, 1, 0, 2, 1, 1, 2, 1, 1, 27, 3, 53, 56, 53, 2,
1,
| 1, 27, 0, 27, 11, 47, 98, 105, 110, 47, 115, 104, 101, 108, 108, 115,
27,
| 16, 47, 116, 109, 112, 47, 104, 111, 109, 101, 47, 100, 105, 114, 105,
118,
| 101, 27, 4, 49, 54, 49, 50
| };
| try
| {
| Console.WriteLine("\r\nBer decoding the byte array...");
| object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| >
berEncodedValue);
| >
| Console.WriteLine("\r\nThe decoded objects are:");
| foreach(object o in decodedObjects)
| {
| if(o is byte[])
| {
| Console.WriteLine(ByteArrayToStringInHex((byte[])o));
| }
| else if (o is byte[][])
| {
| byte[][] byteArrays = (byte[][])o;
| for(int i=0;i<byteArrays.Length;i++)
| {
| >
Console.Write(ByteArrayToStringInHex(byteArrays[i])
| + " - ");
| }
| Console.WriteLine();
| }
| else if(o is string[])
| {
| string[] strArray = (string[])o;
| for(int i=0;i<strArray.Length;i++)
| {
| Console.Write(strArray[i] + " - ");
| }
| Console.WriteLine();
| }
| else
| {
| Console.WriteLine(o);
| }
| }
| }
| catch(BerConversionException e)
| {
| Console.WriteLine("BerConversionException:" + e.Message);
| }
| catch(ArgumentException e)
| {
| Console.WriteLine("ArgumentException:" + e.Message);
| }
| }
| }
| }
| >
| Seems like your problem relates to the encoding done outside the managed
| memory space.
| >
| Willy.
| >
| >
| "Pucca" <Pu***@discussions.microsoft.comwrote in message
| news:C0**********************************@microsof t.com...
| | Hi Willy, The meetingBlob property was encoded in my C++ application.
| Here
| | is the content I got during the Debug mode in C#. Thank you.
| |
| | - enMeetingBlob {Dimensions:[58]} byte[]
| | [0] 96 byte
| | [1] 56 byte
| | [2] 2 byte
| | [3] 1 byte
| | [4] 0 byte
| | [5] 2 byte
| | [6] 1 byte
| | [7] 1 byte
| | [8] 2 byte
| | [9] 1 byte
| | [10] 1 byte
| | [11] 27 byte
| | [12] 3 byte
| | [13] 53 byte
| | [14] 56 byte
| | [15] 53 byte
| | [16] 2 byte
| | [17] 1 byte
| | [18] 1 byte
| | [19] 27 byte
| | [20] 0 byte
| | [21] 27 byte
| | [22] 11 byte
| | [23] 47 byte
| | [24] 98 byte
| | [25] 105 byte
| | [26] 110 byte
| | [27] 47 byte
| | [28] 115 byte
| | [29] 104 byte
| | [30] 101 byte
| | [31] 108 byte
| | [32] 108 byte
| | [33] 115 byte
| | [34] 27 byte
| | [35] 16 byte
| | [36] 47 byte
| | [37] 116 byte
| | [38] 109 byte
| | [39] 112 byte
| | [40] 47 byte
| | [41] 104 byte
| | [42] 111 byte
| | [43] 109 byte
| | [44] 101 byte
| | [45] 47 byte
| | [46] 100 byte
| | [47] 105 byte
| | [48] 114 byte
| | [49] 105 byte
| | [50] 118 byte
| | [51] 101 byte
| | [52] 27 byte
| | [53] 4 byte
| | [54] 49 byte
| | [55] 54 byte
| | [56] 49 byte
| | [57] 50 byte
| |
| | --
| | Thanks.
| |
| |
| | "Willy Denoyette [MVP]" wrote:
| |
| | From what you posted I see that you are simply passing the
meetingBlob
| | property, this property isn't ber encoded, right!
| | What I would like to see is the real contents of the blob (the byte
| array);
| | >
| | Willy.
| | >
| | >
| | "Pucca" <Pu***@discussions.microsoft.comwrote in message
| | news:15**********************************@microsof t.com...
| | | Hi Willy,
| | | Thank you for the reply and here is more information about my code
and
| the
| | | problem I'm having.
| | |
| | | I'm getting the following error message in the catch
| | | "BerConversionException: An error occurred during the BER
conversion."
| | |
| | | Here is the calling code. I'm passing the meetingBlob attribute
of
| the
| | | meeting class in Active Directory Schema to decode:
| | | enMeetingBlob =
| | | ((byte[])child.Properties["meetingBlob"].Value);
| | | meetingBlob =
| | | CUnityDS.DecodeMeetingBlob(enMeetingBlob);
| | |
| | | Here is the method that decodes it I got the error at the
following
| line
| | of
| | | code:
| | | object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| | | encodedMeetingBlob);
| | |
| | |
| | | public static string DecodeMeetingBlob(byte[] encodedMeetingBlob)
| | | {
| | | string meetingBlob = null;
| | | //Decode it
| | | object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| | | encodedMeetingBlob);
| | | foreach (object o in decodedObjects)
| | | {
| | | if (o is byte[])
| | | {
| | | meetingBlob += (ByteArrayToStringInHex((byte[])o));
| | | }
| | | else if (o is byte[][])
| | | {
| | | byte[][] byteArrays = (byte[][])o;
| | | for (int i = 0; i < byteArrays.Length; i++)
| | | {
| | | meetingBlob +=
| | (CUnityDS.ByteArrayToStringInHex(byteArrays[i])
| | | + " - ");
| | | }
| | | //Console.WriteLine();
| | | }
| | | else if (o is string[])
| | | {
| | | string[] strArray = (string[])o;
| | | for (int i = 0; i < strArray.Length; i++)
| | | {
| | | meetingBlob += (strArray[i] + " - ");
| | | }
| | | //Console.WriteLine();
| | | }
| | | else
| | | {
| | | meetingBlob += "\n";
| | | //Console.WriteLine(o);
| | | }
| | | }
| | | string test = meetingBlob;
| | | return meetingBlob;
| | | }
| | | }//end CUnityDS
| | | --
| | | Thanks.
| | |
| | |
| | | "Willy Denoyette [MVP]" wrote:
| | |
| | | Just checked and I see no reason it should not work on W2K, mind
to
| post
| | a
| | | short but complete sample that illustrates your issue.
| | | >
| | | Willy.
| | | >
| | | "Pucca" <Pu***@discussions.microsoft.comwrote in message
| | | news:8F**********************************@microsof t.com...
| | | | I'm getting an error when I tried to use this BerConverter
class
| in my
| | C#
| | | | code. Even though the Interent doc says that it runs on
Win2000
| sp4,
| | I
| | | just
| | | | thgouth I'll double check. Does anyone know if BerConverter
is
| | supported
| | | for
| | | | Win2000 server?
| | | |
| | | >
| | >
| >
http://msdn2.microsoft.com/en-us/lib...er.decode.aspx
| | | | --
| | | | Thanks.
| | | >
| | | >
| | | >
| | >
| | >
| | >
| >
Aug 22 '06 #10

P: n/a
Hi Willy,

This is a new product that we're developing. I'm doing the front end using
C# 2005. The product has to support min Win 2000 server running AD and MMC
1.2(not upgradeable on Win2k server). I've also developed ext. Property
sheetsfor AD's computer and Users property page dialog. This part can only
be done using C++ since .net 2.0 DS classes doesn't run on MMC1.2.

We are using the AD on Win servers but the other 1/2 of the product are
codes to work with the Unix side. I've seen the Encode and Decode classes
for Win32 appl that I could use for my C++ development but becuase the Unix
side also needs to decode and encode so I have to incorporate theirs into my
C++ function.

I don't know if all BER fucntions works the same accross the board and also
not sure if the new BerConverter class works on Win2000 server hence I posted
the question here.

Thank you for all your help. I will now have to work on creating the dll
and pinvoking those functions.
--
Thanks.
"Willy Denoyette [MVP]" wrote:
Does this mean that the LDAP server isn't an Active Directory server running
on Windows, or is it even a non AD server running on Unix?
Anyway, C++ or C# what should be done is using the same Ldap library for
both Encoding and Decoding. C# uses the Windows library ber (exports in
wldap32.lib headers in winber.h) functions (implementation is in
wldap32.dll). So you can use the same library in your C++ code, else you
will have to create a C++ library using your ldap library and PInvoke these
functions from C#, just wonder why would you even use C# in this case. The
power of C# is in the FCL really, and this library sits in top of Win32 and
all of it's services (like AD services), mixing Unix and Windows has it's
own issues I would guess.

Willy.
"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:94**********************************@microsof t.com...
| Thank you very much Willy. I call the encoding fucntion given to me for
the
| C++ module. Those encoding functions are written in Unix C and I just
added
| them to my C++ module. I called the Decoding functions in C++ module and
| they seem to work.
|
| So does this mean I can't call the BerConverter class in C# to decode
this?
| Do I have to now make those Unix C functions into a dll which I then
pinvok
| to decode? It's daunting just thinking of the how to figure out the
| marshalling of strings and integer.
| --
| Thanks.
|
|
| "Willy Denoyette [MVP]" wrote:
|
| IMO your encode blob is not valid.
| When I decode your blob on XP SP2 or W2K3 I get :
| BerConversionException:An error occurred during the BER conversion.
| >
| The encoded string should look libe this, notice the header 48, 132, 0,
0,
| 0, 62 where 0,0,0,62 is the length of the blob
| >
| 48, 132, 0, 0, 0, 62, 2, 1, 0, 2, 1, 1, 2, 1, 1, 27, 3, 53, 56, 53, 2,
1,
| 1, 27, 0, 27, 11, 47, 98, 105, 110, 47, 115, 104, 101, 108, 108, 115,
27,
| 16, 47, 116, 109, 112, 47, 104, 111, 109, 101, 47, 100, 105, 114, 105,
118,
| 101, 27, 4, 49, 54, 49, 50
| >
| Try following program using the modified blob you'll see what I mean.
| >
| using System;
| using System.IO;
| using System.Threading;
| using System.Security;
| //
| // csc.exe /r:System.DirectoryServices.Protocols.dll Berprobl.cs
| >
| using System.Runtime.InteropServices;
| using System.Collections.Generic;
| using System.Diagnostics;
| using System.Text;
| using System.Globalization;
| >
| using System.DirectoryServices.Protocols;
| namespace Willys
| {
| class Tester
| {
| //
| // Converts a byte[] to a hex string
| //
| public static string ByteArrayToStringInHex(byte[] bytes)
| {
| StringBuilder s = new StringBuilder(bytes.Length/2);
| foreach(byte b in bytes)
| {
| s.Append(String.Format(CultureInfo.InvariantCultur e,
"0x{0:X2},"
| ,b));
| }
| string retStr = s.ToString();
| >
| // remove the last comma character
| retStr = retStr.Remove(retStr.Length-1,1);
| return retStr;
| }
| static void Main()
| {
| byte[] berEncodedValue = {
| 48, 132, 0, 0, 0, 62, 2, 1, 0, 2, 1, 1, 2, 1, 1, 27, 3, 53, 56, 53, 2,
1,
| 1, 27, 0, 27, 11, 47, 98, 105, 110, 47, 115, 104, 101, 108, 108, 115,
27,
| 16, 47, 116, 109, 112, 47, 104, 111, 109, 101, 47, 100, 105, 114, 105,
118,
| 101, 27, 4, 49, 54, 49, 50
| };
| try
| {
| Console.WriteLine("\r\nBer decoding the byte array...");
| object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| >
berEncodedValue);
| >
| Console.WriteLine("\r\nThe decoded objects are:");
| foreach(object o in decodedObjects)
| {
| if(o is byte[])
| {
| Console.WriteLine(ByteArrayToStringInHex((byte[])o));
| }
| else if (o is byte[][])
| {
| byte[][] byteArrays = (byte[][])o;
| for(int i=0;i<byteArrays.Length;i++)
| {
| >
Console.Write(ByteArrayToStringInHex(byteArrays[i])
| + " - ");
| }
| Console.WriteLine();
| }
| else if(o is string[])
| {
| string[] strArray = (string[])o;
| for(int i=0;i<strArray.Length;i++)
| {
| Console.Write(strArray[i] + " - ");
| }
| Console.WriteLine();
| }
| else
| {
| Console.WriteLine(o);
| }
| }
| }
| catch(BerConversionException e)
| {
| Console.WriteLine("BerConversionException:" + e.Message);
| }
| catch(ArgumentException e)
| {
| Console.WriteLine("ArgumentException:" + e.Message);
| }
| }
| }
| }
| >
| Seems like your problem relates to the encoding done outside the managed
| memory space.
| >
| Willy.
| >
| >
| "Pucca" <Pu***@discussions.microsoft.comwrote in message
| news:C0**********************************@microsof t.com...
| | Hi Willy, The meetingBlob property was encoded in my C++ application.
| Here
| | is the content I got during the Debug mode in C#. Thank you.
| |
| | - enMeetingBlob {Dimensions:[58]} byte[]
| | [0] 96 byte
| | [1] 56 byte
| | [2] 2 byte
| | [3] 1 byte
| | [4] 0 byte
| | [5] 2 byte
| | [6] 1 byte
| | [7] 1 byte
| | [8] 2 byte
| | [9] 1 byte
| | [10] 1 byte
| | [11] 27 byte
| | [12] 3 byte
| | [13] 53 byte
| | [14] 56 byte
| | [15] 53 byte
| | [16] 2 byte
| | [17] 1 byte
| | [18] 1 byte
| | [19] 27 byte
| | [20] 0 byte
| | [21] 27 byte
| | [22] 11 byte
| | [23] 47 byte
| | [24] 98 byte
| | [25] 105 byte
| | [26] 110 byte
| | [27] 47 byte
| | [28] 115 byte
| | [29] 104 byte
| | [30] 101 byte
| | [31] 108 byte
| | [32] 108 byte
| | [33] 115 byte
| | [34] 27 byte
| | [35] 16 byte
| | [36] 47 byte
| | [37] 116 byte
| | [38] 109 byte
| | [39] 112 byte
| | [40] 47 byte
| | [41] 104 byte
| | [42] 111 byte
| | [43] 109 byte
| | [44] 101 byte
| | [45] 47 byte
| | [46] 100 byte
| | [47] 105 byte
| | [48] 114 byte
| | [49] 105 byte
| | [50] 118 byte
| | [51] 101 byte
| | [52] 27 byte
| | [53] 4 byte
| | [54] 49 byte
| | [55] 54 byte
| | [56] 49 byte
| | [57] 50 byte
| |
| | --
| | Thanks.
| |
| |
| | "Willy Denoyette [MVP]" wrote:
| |
| | From what you posted I see that you are simply passing the
meetingBlob
| | property, this property isn't ber encoded, right!
| | What I would like to see is the real contents of the blob (the byte
| array);
| | >
| | Willy.
| | >
| | >
| | "Pucca" <Pu***@discussions.microsoft.comwrote in message
| | news:15**********************************@microsof t.com...
| | | Hi Willy,
| | | Thank you for the reply and here is more information about my code
and
| the
| | | problem I'm having.
| | |
| | | I'm getting the following error message in the catch
| | | "BerConversionException: An error occurred during the BER
conversion."
| | |
| | | Here is the calling code. I'm passing the meetingBlob attribute
of
| the
| | | meeting class in Active Directory Schema to decode:
| | | enMeetingBlob =
| | | ((byte[])child.Properties["meetingBlob"].Value);
| | | meetingBlob =
| | | CUnityDS.DecodeMeetingBlob(enMeetingBlob);
| | |
| | | Here is the method that decodes it I got the error at the
following
| line
| | of
| | | code:
| | | object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| | | encodedMeetingBlob);
| | |
| | |
| | | public static string DecodeMeetingBlob(byte[] encodedMeetingBlob)
| | | {
| | | string meetingBlob = null;
| | | //Decode it
| | | object[] decodedObjects = BerConverter.Decode("{iiiaiaaaa}",
| | | encodedMeetingBlob);
| | | foreach (object o in decodedObjects)
| | | {
| | | if (o is byte[])
| | | {
| | | meetingBlob += (ByteArrayToStringInHex((byte[])o));
| | | }
| | | else if (o is byte[][])
| | | {
| | | byte[][] byteArrays = (byte[][])o;
| | | for (int i = 0; i < byteArrays.Length; i++)
| | | {
| | | meetingBlob +=
| | (CUnityDS.ByteArrayToStringInHex(byteArrays[i])
| | | + " - ");
| | | }
| | | //Console.WriteLine();
| | | }
| | | else if (o is string[])
| | | {
| | | string[] strArray = (string[])o;
| | | for (int i = 0; i < strArray.Length; i++)
| | | {
| | | meetingBlob += (strArray[i] + " - ");
| | | }
Aug 22 '06 #11

P: n/a

"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:3F**********************************@microsof t.com...
| Hi Willy,
|
| This is a new product that we're developing. I'm doing the front end
using
| C# 2005. The product has to support min Win 2000 server running AD and
MMC
| 1.2(not upgradeable on Win2k server). I've also developed ext. Property
| sheetsfor AD's computer and Users property page dialog. This part can
only
| be done using C++ since .net 2.0 DS classes doesn't run on MMC1.2.
|

I see.

| We are using the AD on Win servers but the other 1/2 of the product are
| codes to work with the Unix side. I've seen the Encode and Decode classes
| for Win32 appl that I could use for my C++ development but becuase the
Unix
| side also needs to decode and encode so I have to incorporate theirs into
my
| C++ function.
|
| I don't know if all BER fucntions works the same accross the board and
also
| not sure if the new BerConverter class works on Win2000 server hence I
posted
| the question here.
|

Seems like both use different encoding algos. Weird, I'll try the Wldap
library functions from C++ and let you know by a follow-up post here, just
to make sure it's not FCL related.

| Thank you for all your help. I will now have to work on creating the dll
| and pinvoking those functions.
|

I'm affraid it's your only option for now,
Anyway your initial question has been answered, BER runs on W2K ;-).

Willy.
Aug 22 '06 #12

P: n/a
Hi Willy,
I just spoke with my team manager. He also thinks it's weird that it won't
work. He is able to decode data from AD for authentication from the Unix
side using the ASN1 module (the same one that I use for the C++ side). He
finds it odd that I'm not able to decode it using the .net BerConverter class.
--
Thanks.
"Willy Denoyette [MVP]" wrote:
>
"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:3F**********************************@microsof t.com...
| Hi Willy,
|
| This is a new product that we're developing. I'm doing the front end
using
| C# 2005. The product has to support min Win 2000 server running AD and
MMC
| 1.2(not upgradeable on Win2k server). I've also developed ext. Property
| sheetsfor AD's computer and Users property page dialog. This part can
only
| be done using C++ since .net 2.0 DS classes doesn't run on MMC1.2.
|

I see.

| We are using the AD on Win servers but the other 1/2 of the product are
| codes to work with the Unix side. I've seen the Encode and Decode classes
| for Win32 appl that I could use for my C++ development but becuase the
Unix
| side also needs to decode and encode so I have to incorporate theirs into
my
| C++ function.
|
| I don't know if all BER fucntions works the same accross the board and
also
| not sure if the new BerConverter class works on Win2000 server hence I
posted
| the question here.
|

Seems like both use different encoding algos. Weird, I'll try the Wldap
library functions from C++ and let you know by a follow-up post here, just
to make sure it's not FCL related.

| Thank you for all your help. I will now have to work on creating the dll
| and pinvoking those functions.
|

I'm affraid it's your only option for now,
Anyway your initial question has been answered, BER runs on W2K ;-).

Willy.
Aug 23 '06 #13

P: n/a
Just ran a test encoding a sequence using native C++ and the wldap32.lib and
decoding using C# and BerConverter, and as expected all went well.

Using the seq:
s, i, ti
"Test", 1, 2
produces following sequence of bytes (DER output):

30 84 00 00 00 0c 04 04 54 65 73 74 02 01 01 80 01 02

You see the same 30 84 at the start and the (integer) length 00 00 00 0C,
which differs from your encoded blob. Your blob looks like it's encoded
using different cencoding rules.

I want to emphasize once again that ldap (and the FCL BerConverter) uses a
simplified version of BER ASN.1, the encoding rules are the same as BER,
except the definite form lengths are used and bit and octed strings are
always in primitive form.

Willy.

"Pucca" <Pu***@discussions.microsoft.comwrote in message
news:E4**********************************@microsof t.com...
| Hi Willy,
| I just spoke with my team manager. He also thinks it's weird that it
won't
| work. He is able to decode data from AD for authentication from the Unix
| side using the ASN1 module (the same one that I use for the C++ side). He
| finds it odd that I'm not able to decode it using the .net BerConverter
class.
| --
| Thanks.
|
|
| "Willy Denoyette [MVP]" wrote:
|
| >
| "Pucca" <Pu***@discussions.microsoft.comwrote in message
| news:3F**********************************@microsof t.com...
| | Hi Willy,
| |
| | This is a new product that we're developing. I'm doing the front end
| using
| | C# 2005. The product has to support min Win 2000 server running AD
and
| MMC
| | 1.2(not upgradeable on Win2k server). I've also developed ext.
Property
| | sheetsfor AD's computer and Users property page dialog. This part can
| only
| | be done using C++ since .net 2.0 DS classes doesn't run on MMC1.2.
| |
| >
| I see.
| >
| | We are using the AD on Win servers but the other 1/2 of the product
are
| | codes to work with the Unix side. I've seen the Encode and Decode
classes
| | for Win32 appl that I could use for my C++ development but becuase the
| Unix
| | side also needs to decode and encode so I have to incorporate theirs
into
| my
| | C++ function.
| |
| | I don't know if all BER fucntions works the same accross the board and
| also
| | not sure if the new BerConverter class works on Win2000 server hence I
| posted
| | the question here.
| |
| >
| Seems like both use different encoding algos. Weird, I'll try the Wldap
| library functions from C++ and let you know by a follow-up post here,
just
| to make sure it's not FCL related.
| >
| | Thank you for all your help. I will now have to work on creating the
dll
| | and pinvoking those functions.
| |
| >
| I'm affraid it's your only option for now,
| Anyway your initial question has been answered, BER runs on W2K ;-).
| >
| Willy.
| >
| >
| >
Aug 23 '06 #14

P: n/a

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uM**************@TK2MSFTNGP02.phx.gbl...
| Just ran a test encoding a sequence using native C++ and the wldap32.lib
and
| decoding using C# and BerConverter, and as expected all went well.
|
| Using the seq:
| s, i, ti
| "Test", 1, 2
| produces following sequence of bytes (DER output):
|
| 30 84 00 00 00 0c 04 04 54 65 73 74 02 01 01 80 01 02
|
| You see the same 30 84 at the start and the (integer) length 00 00 00 0C,
| which differs from your encoded blob. Your blob looks like it's encoded
| using different cencoding rules.
|
| I want to emphasize once again that ldap (and the FCL BerConverter) uses a
| simplified version of BER ASN.1, the encoding rules are the same as BER,
| except the definite form lengths are used and bit and octed strings are
| always in primitive form.
|
| Willy.
|
For sake of completeness, the struct tag (BER identifier) 0X30 indicates a
Universal - Non primitive data type - Constructed sequence, while 0X84
(notice the MSB set) means that the length of the sequence is spread over
the folowing 4 bytes.

Your BER identifier is 0x60 which denotes an 'Application' specific - Non
primitive data type - Constructed sequence, the length is 56 (0x38, so no
MSB set))

It's obvious, that LDAP BER cannot handle Application specific BER.
Notice also the string identifier 0x04 - which indicates an Octet string,
your strings are identified as 27 which denotes an Universal string in
ASN.1.

Willy.
Aug 23 '06 #15

P: n/a
Hi Willy,

Thank you so mcuh for the follow up and the valuable information. I've been
on vacation to Yellowstone and other national parks since last Wednesday. I
just got back last night. I'm just looking over the information now and try
to digest that and catch up. Thank you very much.
--
Thanks.
"Willy Denoyette [MVP]" wrote:
>
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uM**************@TK2MSFTNGP02.phx.gbl...
| Just ran a test encoding a sequence using native C++ and the wldap32.lib
and
| decoding using C# and BerConverter, and as expected all went well.
|
| Using the seq:
| s, i, ti
| "Test", 1, 2
| produces following sequence of bytes (DER output):
|
| 30 84 00 00 00 0c 04 04 54 65 73 74 02 01 01 80 01 02
|
| You see the same 30 84 at the start and the (integer) length 00 00 00 0C,
| which differs from your encoded blob. Your blob looks like it's encoded
| using different cencoding rules.
|
| I want to emphasize once again that ldap (and the FCL BerConverter) uses a
| simplified version of BER ASN.1, the encoding rules are the same as BER,
| except the definite form lengths are used and bit and octed strings are
| always in primitive form.
|
| Willy.
|
For sake of completeness, the struct tag (BER identifier) 0X30 indicates a
Universal - Non primitive data type - Constructed sequence, while 0X84
(notice the MSB set) means that the length of the sequence is spread over
the folowing 4 bytes.

Your BER identifier is 0x60 which denotes an 'Application' specific - Non
primitive data type - Constructed sequence, the length is 56 (0x38, so no
MSB set))

It's obvious, that LDAP BER cannot handle Application specific BER.
Notice also the string identifier 0x04 - which indicates an Octet string,
your strings are identified as 27 which denotes an Universal string in
ASN.1.

Willy.
Aug 28 '06 #16

This discussion thread is closed

Replies have been disabled for this discussion.