Hi All,
Been working this issue for a few days now, here's the deal. I have a bit of VB.NET code that uses an SslStream object to communicate with a Java application over SSL. The Java application uses JSSE to facilitate SSL. The VB.NET SslStream code works fine on any machine thus far except for one. On this particular machine, when the VB.NET code calls the AuthenticateAsClient method, the following exception is raised:
System.Security.Authentication.AuthenticationException: {"A call to SSPI failed, see inner exception."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: Nothing
InnerException: {"Invalid flags specified"}
Message: "A call to SSPI failed, see inner exception."
Source: "System"
StackTrace: " at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)
at PlayProject.Form2.Form2_Load(Object sender, EventArgs e) in C:\Documents and Settings\tony_l7\My Documents\Visual Studio 2005\Projects\PlayProject\PlayProject\Form2.vb:line 23"
TargetSite: {System.Reflection.RuntimeMethodInfo}
And the Inner exception:
System.ComponentModel.Win32Exception: {"Invalid flags specified"}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: Nothing
InnerException: Nothing
Message: "Invalid flags specified"
Source: Nothing
StackTrace: Nothing
TargetSite: Nothing
Any ideas
Thanks in advance!

Cryptic exception...A call to SSPI failed...
cindyjones10
So, I spoke with a co-worker and we noticed that you have this autoprovider in the list:
ZWebAuth
Now, I don't know anything about that dll, but when I did a search for it, the only places I found it mentioned on the web were sites related to spyware, viruses, etc. I am not saying that it is a virus, but you should consider this. Can you track down the source of that auth provider Is this auth provider present on any of the machines where your software is working correctly This is just a guess at this point, but it is a start.
Buddhist
Hi Jon,
Thanks for checking on this. ZWebAuth is the MSN Zone Authorization SSP. But just to be sure, I removed it from the SecurtyProviders key registry entry (HKLM\SYSTEM\CurrentControlSet\Control\SecurtyProviders)...still received the same exceptions. I'll try installing this provider on one of the machines on which the software runs correctly...I'll let you know what happens.
I added listeners for System.Net.Sockets and System.Net.Security and here is the resultant trace log:
System.Net.Sockets Verbose: 0 : [2124] TcpClient#28068188::TcpClient(localhost)
System.Net.Sockets Verbose: 0 : [2124] TcpClient#28068188::Connect(localhost)
System.Net.Sockets Verbose: 0 : [2124] DNS::GetHostAddresses(localhost)
System.Net.Sockets Verbose: 0 : [2124] DNS::GetHostByName(localhost)
System.Net.Sockets Verbose: 0 : [2124] Exiting DNS::GetHostByName() -> IPHostEntry#33163964
System.Net.Sockets Verbose: 0 : [2124] Exiting DNS::GetHostAddresses() -> IPAddress[]#14421545
System.Net.Sockets Verbose: 0 : [2124] Socket#35567111::Socket(InterNetwork#2)
System.Net.Sockets Verbose: 0 : [2124] Exiting Socket#35567111::Socket()
System.Net.Sockets Verbose: 0 : [2124] TcpClient#28068188::Connect(1:31410#16808653)
System.Net.Sockets Verbose: 0 : [2124] Socket#35567111::Connect(1:31410#16808653)
System.Net.Sockets Verbose: 0 : [2124] Exiting Socket#35567111::Connect()
System.Net.Sockets Verbose: 0 : [2124] Exiting TcpClient#28068188::Connect()
System.Net.Sockets Verbose: 0 : [2124] Exiting TcpClient#28068188::Connect()
System.Net.Sockets Verbose: 0 : [2124] Exiting TcpClient#28068188::TcpClient()
System.Net.Sockets Verbose: 0 : [2124] TcpClient#28068188::GetStream()
System.Net.Sockets Verbose: 0 : [2124] Exiting TcpClient#28068188::GetStream() -> NetworkStream#65066874
System.Net Information: 0 : [2124] SecureChannel#34160229::.ctor(hostname=localhost, #clientCertificates=0)
System.Net Information: 0 : [2124] Enumerating security packages:
System.Net Information: 0 : [2124] Negotiate
System.Net Information: 0 : [2124] Kerberos
System.Net Information: 0 : [2124] NTLM
System.Net Information: 0 : [2124] Microsoft Unified Security Protocol Provider
System.Net Information: 0 : [2124] Schannel
System.Net Information: 0 : [2124] WDigest
System.Net Information: 0 : [2124] DPA
System.Net Information: 0 : [2124] Digest
System.Net Information: 0 : [2124] MSN
System.Net Information: 0 : [2124] SecureChannel#34160229 - Left with 0 client certificates to choose from.
System.Net Information: 0 : [2124] AcquireCredentialsHandle(package = Microsoft Unified Security Protocol Provider, intent = Outbound, scc = System.Net.SecureCredential)
System.Net Information: 0 : [2124] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = (null), targetName = localhost, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [2124] InitializeSecurityContext(In-Buffer length=0, Out-Buffer length=70, returned code=ContinueNeeded).
System.Net.Sockets Verbose: 0 : [2124] Socket#35567111::Send()
System.Net.Sockets Verbose: 0 : [2124] Data from Socket#35567111::Send
System.Net.Sockets Verbose: 0 : [2124] 00000000 : 16 03 01 00 41 01 00 00-3D 03 01 45 B8 B3 AA 8F : ....A...=..E....
System.Net.Sockets Verbose: 0 : [2124] 00000010 : 00 27 04 83 C0 53 5B 90-EB 47 7E BD 89 86 B9 00 : .'...S[..G~.....
System.Net.Sockets Verbose: 0 : [2124] 00000020 : D3 48 06 60 FA CE E3 95-EB 22 04 00 00 16 00 04 : .H.`....."......
System.Net.Sockets Verbose: 0 : [2124] 00000030 : 00 05 00 0A 00 09 00 64-00 62 00 03 00 06 00 13 : .......d.b......
System.Net.Sockets Verbose: 0 : [2124] 00000040 : 00 12 00 63 01 00 : ...c..
System.Net.Sockets Verbose: 0 : [2124] Exiting Socket#35567111::Send() -> 70#70
System.Net.Sockets Verbose: 0 : [2124] Socket#35567111::Receive()
System.Net.Sockets Verbose: 0 : [2124] Data from Socket#35567111::Receive
System.Net.Sockets Verbose: 0 : [2124] 00000000 : 16 03 01 04 DA : .....
System.Net.Sockets Verbose: 0 : [2124] Exiting Socket#35567111::Receive() -> 5#5
System.Net.Sockets Verbose: 0 : [2124] Socket#35567111::Receive()
System.Net.Sockets Verbose: 0 : [2124] Data from Socket#35567111::Receive
System.Net.Sockets Verbose: 0 : [2124] (printing 1024 out of 1242)
System.Net.Sockets Verbose: 0 : [2124] 00000005 : 02 00 00 46 03 01 45 B8-B3 AA 34 5A 9B BA A3 71 : ...F..E...4Z...q
System.Net.Sockets Verbose: 0 : [2124] 00000015 : 65 7D A2 72 3C CB 8F 44-F7 90 67 4A 66 59 2B D3 : e}.r<..D..gJfY+.
System.Net.Sockets Verbose: 0 : [2124] 00000025 : 72 DE A3 1B 3D EB 20 45-B8 B3 AA D0 28 ED 3C A7 : r...=. E....(.<.
System.Net.Sockets Verbose: 0 : [2124] 00000035 : 82 08 3C CF D5 CB D6 8E-5B 4D 64 A6 AF 51 24 B0 : ..<.....[Md..Q$.
System.Net.Sockets Verbose: 0 : [2124] 00000045 : A7 C5 B9 29 56 CE 9F 00-13 00 0B 00 03 4C 00 03 : ...)V........L..
System.Net.Sockets Verbose: 0 : [2124] 00000055 : 49 00 03 46 30 82 03 42-30 82 03 00 02 04 39 5B : I..F0..B0.....9[
System.Net.Sockets Verbose: 0 : [2124] 00000065 : 69 7D 30 0B 06 07 2A 86-48 CE 38 04 03 05 00 30 : i}0...*.H.8....0
System.Net.Sockets Verbose: 0 : [2124] 00000075 : 81 86 31 0B 30 09 06 03-55 04 06 13 02 55 53 31 : ..1.0...U....US1
System.Net.Sockets Verbose: 0 : [2124] 00000085 : 0B 30 09 06 03 55 04 08-13 02 47 41 31 11 30 0F : .0...U....GA1.0.
System.Net.Sockets Verbose: 0 : [2124] 00000095 : 06 03 55 04 07 13 08 53-61 76 61 6E 6E 61 68 31 : ..U....Savannah1
System.Net.Sockets Verbose: 0 : [2124] 000000A5 : 1E 30 1C 06 03 55 04 0A-13 15 4E 65 74 77 6F 72 : .0...U....Networ
System.Net.Sockets Verbose: 0 : [2124] 000000B5 : 6B 20 43 6F 6D 6D 65 72-63 65 20 49 6E 63 2E 31 : k Commerce Inc.1
System.Net.Sockets Verbose: 0 : [2124] 000000C5 : 25 30 23 06 03 55 04 0B-13 1C 54 72 61 6E 73 61 : %0#..U....Transa
System.Net.Sockets Verbose: 0 : [2124] 000000D5 : 63 74 69 6F 6E 20 50 72-6F 63 65 73 73 69 6E 67 : ction Processing
System.Net.Sockets Verbose: 0 : [2124] 000000E5 : 20 47 72 6F 75 70 31 10-30 0E 06 03 55 04 03 13 : Group1.0...U...
System.Net.Sockets Verbose: 0 : [2124] 000000F5 : 07 55 6E 6B 6E 6F 77 6E-30 1E 17 0D 30 30 30 36 : .Unknown0...0006
System.Net.Sockets Verbose: 0 : [2124] 00000105 : 32 39 31 35 32 31 33 33-5A 17 0D 34 39 30 33 32 : 29152133Z..49032
System.Net.Sockets Verbose: 0 : [2124] 00000115 : 34 31 35 32 31 33 33 5A-30 81 86 31 0B 30 09 06 : 4152133Z0..1.0..
System.Net.Sockets Verbose: 0 : [2124] 00000125 : 03 55 04 06 13 02 55 53-31 0B 30 09 06 03 55 04 : .U....US1.0...U.
System.Net.Sockets Verbose: 0 : [2124] 00000135 : 08 13 02 47 41 31 11 30-0F 06 03 55 04 07 13 08 : ...GA1.0...U....
System.Net.Sockets Verbose: 0 : [2124] 00000145 : 53 61 76 61 6E 6E 61 68-31 1E 30 1C 06 03 55 04 : Savannah1.0...U.
System.Net.Sockets Verbose: 0 : [2124] 00000155 : 0A 13 15 4E 65 74 77 6F-72 6B 20 43 6F 6D 6D 65 : ...Network Comme
System.Net.Sockets Verbose: 0 : [2124] 00000165 : 72 63 65 20 49 6E 63 2E-31 25 30 23 06 03 55 04 : rce Inc.1%0#..U.
System.Net.Sockets Verbose: 0 : [2124] 00000175 : 0B 13 1C 54 72 61 6E 73-61 63 74 69 6F 6E 20 50 : ...Transaction P
System.Net.Sockets Verbose: 0 : [2124] 00000185 : 72 6F 63 65 73 73 69 6E-67 20 47 72 6F 75 70 31 : rocessing Group1
System.Net.Sockets Verbose: 0 : [2124] 00000195 : 10 30 0E 06 03 55 04 03-13 07 55 6E 6B 6E 6F 77 : .0...U....Unknow
System.Net.Sockets Verbose: 0 : [2124] 000001A5 : 6E 30 82 01 B7 30 82 01-2C 06 07 2A 86 48 CE 38 : n0...0..,..*.H.8
System.Net.Sockets Verbose: 0 : [2124] 000001B5 : 04 01 30 82 01 1F 02 81-81 00 FD 7F 53 81 1D 75 : ..0.........S..u
System.Net.Sockets Verbose: 0 : [2124] 000001C5 : 12 29 52 DF 4A 9C 2E EC-E4 E7 F6 11 B7 52 3C EF : .)R.J........R<.
System.Net.Sockets Verbose: 0 : [2124] 000001D5 : 44 00 C3 1E 3F 80 B6 51-26 69 45 5D 40 22 51 FB : D... ..Q&iE]@"Q.
System.Net.Sockets Verbose: 0 : [2124] 000001E5 : 59 3D 8D 58 FA BF C5 F5-BA 30 F6 CB 9B 55 6C D7 : Y=.X.....0...Ul.
System.Net.Sockets Verbose: 0 : [2124] 000001F5 : 81 3B 80 1D 34 6F F2 66-60 B7 6B 99 50 A5 A4 9F : .;..4o.f`.k.P...
System.Net.Sockets Verbose: 0 : [2124] 00000205 : 9F E8 04 7B 10 22 C2 4F-BB A9 D7 FE B7 C6 1B F8 : ...{.".O........
System.Net.Sockets Verbose: 0 : [2124] 00000215 : 3B 57 E7 C6 A8 A6 15 0F-04 FB 83 F6 D3 C5 1E C3 : ;W..............
System.Net.Sockets Verbose: 0 : [2124] 00000225 : 02 35 54 13 5A 16 91 32-F6 75 F3 AE 2B 61 D7 2A : .5T.Z..2.u..+a.*
System.Net.Sockets Verbose: 0 : [2124] 00000235 : EF F2 22 03 19 9D D1 48-01 C7 02 15 00 97 60 50 : .."....H......`P
System.Net.Sockets Verbose: 0 : [2124] 00000245 : 8F 15 23 0B CC B2 92 B9-82 A2 EB 84 0B F0 58 1C : ..#...........X.
System.Net.Sockets Verbose: 0 : [2124] 00000255 : F5 02 81 81 00 F7 E1 A0-85 D6 9B 3D DE CB BC AB : ...........=....
System.Net.Sockets Verbose: 0 : [2124] 00000265 : 5C 36 B8 57 B9 79 94 AF-BB FA 3A EA 82 F9 57 4C : \6.W.y....:...WL
System.Net.Sockets Verbose: 0 : [2124] 00000275 : 0B 3D 07 82 67 51 59 57-8E BA D4 59 4F E6 71 07 : .=..gQYW...YO.q.
System.Net.Sockets Verbose: 0 : [2124] 00000285 : 10 81 80 B4 49 16 71 23-E8 4C 28 16 13 B7 CF 09 : ....I.q#.L(.....
System.Net.Sockets Verbose: 0 : [2124] 00000295 : 32 8C C8 A6 E1 3C 16 7A-8B 54 7C 8D 28 E0 A3 AE : 2....<.z.T|.(...
System.Net.Sockets Verbose: 0 : [2124] 000002A5 : 1E 2B B3 A6 75 91 6E A3-7F 0B FA 21 35 62 F1 FB : .+..u.n....!5b..
System.Net.Sockets Verbose: 0 : [2124] 000002B5 : 62 7A 01 24 3B CC A4 F1-BE A8 51 90 89 A8 83 DF : bz.$;.....Q.....
System.Net.Sockets Verbose: 0 : [2124] 000002C5 : E1 5A E5 9F 06 92 8B 66-5E 80 7B 55 25 64 01 4C : .Z.....f^.{U%d.L
System.Net.Sockets Verbose: 0 : [2124] 000002D5 : 3B FE CF 49 2A 03 81 84-00 02 81 80 3E CD C8 51 : ;..I*.......>..Q
System.Net.Sockets Verbose: 0 : [2124] 000002E5 : 3D 6F 22 87 D0 3C D9 B4-50 10 A7 CA A6 11 EA A4 : =o"..<..P.......
System.Net.Sockets Verbose: 0 : [2124] 000002F5 : 8C D3 A4 A9 91 C4 C2 8E-1F 18 0C 32 AE 8D 45 A0 : ...........2..E.
System.Net.Sockets Verbose: 0 : [2124] 00000305 : 22 A2 F7 38 A1 B1 B7 51-29 D1 F7 D9 CC BA 63 F2 : "..8...Q).....c.
System.Net.Sockets Verbose: 0 : [2124] 00000315 : 05 DA 28 F3 1E 51 7D 00-C5 C9 7E B9 BE 5E D2 AB : ..(..Q}...~..^..
System.Net.Sockets Verbose: 0 : [2124] 00000325 : 6F A5 FC 2F 28 14 71 26-D0 1E 4D 1B 9D 46 69 9C : o../(.q&..M..Fi.
System.Net.Sockets Verbose: 0 : [2124] 00000335 : 50 A3 2D E3 67 F0 D9 2D-5D 8F B0 7B B9 FF 9A FF : P.-.g..-]..{....
System.Net.Sockets Verbose: 0 : [2124] 00000345 : A3 B0 1D D8 02 A1 82 52-9F 20 A3 E5 41 EC 78 E9 : .......R. ..A.x.
System.Net.Sockets Verbose: 0 : [2124] 00000355 : 85 58 0F B2 F4 3D 5C C5-89 81 1B B8 30 0B 06 07 : .X...=\.....0...
System.Net.Sockets Verbose: 0 : [2124] 00000365 : 2A 86 48 CE 38 04 03 05-00 03 2F 00 30 2C 02 14 : *.H.8...../.0,..
System.Net.Sockets Verbose: 0 : [2124] 00000375 : 7A F3 66 4A 7B 46 C4 13-33 15 90 20 15 3A CA 32 : z.fJ{F..3.. .:.2
System.Net.Sockets Verbose: 0 : [2124] 00000385 : CE 38 85 D2 02 14 27 D1-49 3E 98 44 88 F6 69 D1 : .8....'.I>.D..i.
System.Net.Sockets Verbose: 0 : [2124] 00000395 : DA 8C 6A 61 B1 4F 76 EF-5D F2 0C 00 01 38 00 81 : ..ja.Ov.]....8..
System.Net.Sockets Verbose: 0 : [2124] 000003A5 : 00 F4 88 FD 58 4E 49 DB-CD 20 B4 9D E4 91 07 36 : ....XNI.. .....6
System.Net.Sockets Verbose: 0 : [2124] 000003B5 : 6B 33 6C 38 0D 45 1D 0F-7C 88 B3 1C 7C 5B 2D 8E : k3l8.E..|...|[-.
System.Net.Sockets Verbose: 0 : [2124] 000003C5 : F6 F3 C9 23 C0 43 F0 A5-5B 18 8D 8E BB 55 8C B8 : ...#.C..[....U..
System.Net.Sockets Verbose: 0 : [2124] 000003D5 : 5D 38 D3 34 FD 7C 17 57-43 A3 1D 18 6C DE 33 21 : ]8.4.|.WC...l.3!
System.Net.Sockets Verbose: 0 : [2124] 000003E5 : 2C B5 2A FF 3C E1 B1 29-40 18 11 8D 7C 84 A7 0A : ,.*.<..)@...|...
System.Net.Sockets Verbose: 0 : [2124] 000003F5 : 72 D6 86 C4 03 19 C8 07-29 7A CA 95 0C D9 96 9F : r.......)z......
System.Net.Sockets Verbose: 0 : [2124] Exiting Socket#35567111::Receive() -> 1242#1242
System.Net Information: 0 : [2124] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 208848:14a9e0, targetName = localhost, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [2124] InitializeSecurityContext(In-Buffer length=1247, Out-Buffer length=0, returned code=-2146893815).
IntMain
Jeff Sholl
Hi Jon,
I am unable to find an installer for ZWebAuth anywhere. Any ideas
Thanks,
Fippy
Hi Jon,
Have you been able to find out what's wrong Is there anything else that I can gather/post that would help
Anyone else have any ideas
Thanks,
AlGee
Hi Jon,
Thanks for the reply (you too, Rizwan). I am running Windows XP SP2. Here is the output captured in the trace log:
System.Net Information: 0 : [4120] SecureChannel#64923656::.ctor(hostname=localhost, #clientCertificates=0)
System.Net Information: 0 : [4120] Enumerating security packages:
System.Net Information: 0 : [4120] Negotiate
System.Net Information: 0 : [4120] Kerberos
System.Net Information: 0 : [4120] NTLM
System.Net Information: 0 : [4120] Microsoft Unified Security Protocol Provider
System.Net Information: 0 : [4120] Schannel
System.Net Information: 0 : [4120] WDigest
System.Net Information: 0 : [4120] DPA
System.Net Information: 0 : [4120] Digest
System.Net Information: 0 : [4120] MSN
System.Net Information: 0 : [4120] ZWebAuth
System.Net Information: 0 : [4120] SecureChannel#64923656 - Left with 0 client certificates to choose from.
System.Net Information: 0 : [4120] AcquireCredentialsHandle(package = Microsoft Unified Security Protocol Provider, intent = Outbound, scc = System.Net.SecureCredential)
System.Net Information: 0 : [4120] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = (null), targetName = localhost, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [4120] InitializeSecurityContext(In-Buffer length=0, Out-Buffer length=70, returned code=ContinueNeeded).
System.Net Information: 0 : [4120] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 20f568:d0c718, targetName = localhost, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [4120] InitializeSecurityContext(In-Buffer length=1247, Out-Buffer length=0, returned code=-2146893815).
Thanks!
Matt Tolhurst
Can you enable trace logging using the information in this blog Once you have that information please send the output of that log. It will include information on what SSPI options where used and is likely to help us understand what went wrong.
Dmitry.K
Sorry for the delay, I don't know what that error code means. I sent e-mail to another team within MSFT and I haven't heard back yet...
I will send them another e-mail to see what is going on.
VAD214
Hello,
I'm not an expert of Ssl but your error seems known to me, When i tried to generate some Public key pair with sn.exe and specified the wrong key length I got the same error in past.
So i would recomend you test if your mahchine is capable or have you everything installed which needs to do work with SSL etc.
Best Regards,
Rizwan aka RizwanSharp