public void SetDefaultValue(int index) { this.AuthScheme = AuthSchemes.None; this.AuthAlgorithm = AuthAlgorithms.None; this.Qop.SetDefaultValue(index); this.Nonce.SetDefaultValue(index); this.Realm.SetDefaultValue(index); this.Opaque.SetDefaultValue(index); this.Stale = false; }
public void WriteDigestAuthorization(HeaderNames header, ByteArrayPart username, ByteArrayPart realm, AuthQops qop, AuthAlgorithms algorithm, ByteArrayPart uri, ByteArrayPart nonce, int nc, int cnonce, ByteArrayPart opaque, byte[] response) { if (header == HeaderNames.Authorization) { Write(C.Authorization); } else if (header == HeaderNames.ProxyAuthorization) { Write(C.Proxy_Authorization); } else { throw new ArgumentException(@"HeaderNames"); } Write(C.__Digest_username__); Write(username); Write(C.___realm__); Write(realm); if (qop != AuthQops.None) { Write(C.___qop__); Write(qop.ToByteArrayPart()); } else { Write(C.DQUOTE); } Write(C.__algorithm_); Write(algorithm.ToByteArrayPart()); Write(C.__uri__); Write(uri); Write(C.___nonce__); Write(nonce); if (qop != AuthQops.None) { Write(C.__nc_); Write(nc); Write(C.__cnonce__); WriteAsHex8(cnonce); } Write(C.___opaque__); if (opaque.IsValid) { Write(opaque); } Write(C.___response__); Write(response); Write(C.DQUOTE); Write(C.CRLF); }
public void SetDefaultValue() { AuthScheme = AuthSchemes.None; AuthAlgorithm = AuthAlgorithms.None; NonceCountBytes.SetDefaultValue(); MessageQop.SetDefaultValue(); DigestUri.SetDefaultValue(); Nonce.SetDefaultValue(); Realm.SetDefaultValue(); Cnonce.SetDefaultValue(); Opaque.SetDefaultValue(); Response.SetDefaultValue(); Username.SetDefaultValue(); NonceCount = int.MinValue; HasResponse = false; OnSetDefaultValue(); }
public static ByteArrayPart ToByteArrayPart(this AuthAlgorithms algorithm) { switch (algorithm) { case AuthAlgorithms.None: case AuthAlgorithms.Other: throw new ArgumentException(); case AuthAlgorithms.Md5: return(SipMessageWriter.C.MD5); case AuthAlgorithms.Md5Sess: return(SipMessageWriter.C.MD5_sess); default: throw new NotImplementedException(); } }
public void SetDefaultValue(int index) { this.AuthScheme = AuthSchemes.None; this.AuthAlgorithm = AuthAlgorithms.None; this.NonceCountBytes.SetDefaultValue(index); this.MessageQop.SetDefaultValue(index); this.DigestUri.SetDefaultValue(index); this.Realm.SetDefaultValue(index); this.Opaque.SetDefaultValue(index); this.Nonce.SetDefaultValue(index); this.Cnonce.SetDefaultValue(index); this.Response.SetDefaultValue(index); this.Username.SetDefaultValue(index); this.Targetname.SetDefaultValue(index); this.GssapiData.SetDefaultValue(index); this.NonceCount = -2147483648; this.Cnum = -2147483648; this.Crand = -2147483648; this.Version = -2147483648; this.HasResponse = false; this.HasGssapiData = false; }
public static byte[] GetResponseHexChars(ByteArrayPart username, ByteArrayPart realm, AuthAlgorithms algorithm, ByteArrayPart nonce, int cnonce, int nonceCount, ByteArrayPart password, AuthQops qop, ByteArrayPart digestUri, ByteArrayPart method, ArraySegment <byte> body) { if (responseCalculator == null) { responseCalculator = new ResponseCalculator(); } return(responseCalculator.GetResponseHexChars(username, realm, algorithm == AuthAlgorithms.Md5Sess, nonce, cnonce, nonceCount, password, qop.ToByteArrayPart(), digestUri, method, body)); }
public byte[] GetDigestResponseHexChars(ByteArrayPart username, ByteArrayPart realm, AuthAlgorithms algorithm, ByteArrayPart nonce, int cnonce, int nonceCount, ByteArrayPart password, AuthQops qop, ByteArrayPart digestUri, Methods method, ArraySegment <byte> body) { return(response); }
public void WriteDigestAuthorization(HeaderNames header, ByteArrayPart username, ByteArrayPart realm, AuthQops qop, AuthAlgorithms algorithm, ByteArrayPart uri, ByteArrayPart nonce, int nc, int cnonce, ByteArrayPart opaque, byte[] response) { if (header == HeaderNames.Authorization) Write(C.Authorization); else if (header == HeaderNames.ProxyAuthorization) Write(C.Proxy_Authorization); else throw new ArgumentException(@"HeaderNames"); Write(C.__Digest_username__); Write(username); Write(C.___realm__); Write(realm); if (qop != AuthQops.None) { Write(C.___qop__); Write(qop.ToByteArrayPart()); } else Write(C.DQUOTE); Write(C.__algorithm_); Write(algorithm.ToByteArrayPart()); Write(C.__uri__); Write(uri); Write(C.___nonce__); Write(nonce); if (qop != AuthQops.None) { Write(C.__nc_); Write(nc); Write(C.__cnonce__); WriteAsHex8(cnonce); } Write(C.___opaque__); if (opaque.IsValid) Write(opaque); Write(C.___response__); Write(response); Write(C.DQUOTE); Write(C.CRLF); }
public byte[] GetDigestResponseHexChars(ByteArrayPart username, ByteArrayPart realm, AuthAlgorithms algorithm, ByteArrayPart nonce, int cnonce, int nonceCount, ByteArrayPart password, AuthQops qop, ByteArrayPart digestUri, Methods method, ArraySegment<byte> body) { return response; }