LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 23-Oct-2009, 03:00 PM
Junior Member
 
Join Date: Aug 2009
Posts: 5
danielnapierski 0 reputation points
Default Re: SSL - LdapConnection UserDefinedServerCertValidationDele

Originally Posted by palaniappan1 View Post
I dont think a proper doc is there. I'll try to add that. Anyway, the source code is available at developer.novell.com (under the 'Ldap Libraries for Csharp').


All of the HEX codes provided are positive values. Yet all of the integers I've seen passed into the UserDefinedServerCertValidationDelegate are negative. I believe this is because of an overflow when casting an uint (or long?) to an int.

This means that any developers that implement their own handlers have to depend on an cast overflow, which is less than ideal. Perhaps the signature of the delegate should contain uint[] or long[] instead. This test shows the problem. I created my own CertificateError enum that extends uint and uses the HEX values provided.
Code:
[Test] public void TestCertErr() { var errors = (CertificateError[]) Enum.GetValues(typeof(CertificateError)); foreach (var error in errors) { uint certificateError = (uint) error; bool isTooBig = certificateError > int.MaxValue; if (isTooBig) { Log.WarnFormat(null, "Overflow: 0x{0:X2} {1,-25} => \t{2}", certificateError, Enum.GetName(typeof (CertificateError), certificateError), (int) certificateError); } // cast may overflow int intErr = (int)certificateError; Assert.IsTrue(!isTooBig || intErr < 0); uint roundTrip = (uint)intErr; Assert.AreEqual(certificateError, roundTrip); } }
Which produces the following output:
Code:
Overflow: 0x800B0102 ValidityPeriodNesting     =>     -2146762494
Overflow: 0x800B0103 Role                      =>     -2146762493
Overflow: 0x800B0104 PathLenConst              =>     -2146762492
Overflow: 0x800B0105 Critical                  =>     -2146762491
Overflow: 0x800B0106 Purpose                   =>     -2146762490
Overflow: 0x800B0107 IssuerChaining            =>     -2146762489
Overflow: 0x800B0108 Malformed                 =>     -2146762488
Overflow: 0x800B0109 UntrustedRoot             =>     -2146762487
Overflow: 0x800B010A Chaining                  =>     -2146762486
Overflow: 0x800B010C Revoked                   =>     -2146762484
Overflow: 0x800B010D UntrustedTestRoot         =>     -2146762483
Overflow: 0x800B010E RevocationFailure         =>     -2146762482
Overflow: 0x800B010F CnNoMatch                 =>     -2146762481
Overflow: 0x800B0110 WrongUsage                =>     -2146762480
Overflow: 0x800B0112 UntrustedCA               =>     -2146762478
Overflow: 0x800B0113 UnrecognizedError         =>     -2146762477
Reply With Quote
 

Tags
ssl certificate delegate

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -6. The time now is 07:59 AM.


© 2007 Novell, Inc. All Rights Reserved.

Search Engine Friendly URLs by vBSEO 3.3.0 RC2