public SecureCredential(int version, X509Certificate2 certificate, SecureCredential.Flags flags, SchProtocols protocols, EncryptionPolicy policy) { this.version = version; this.certificate = certificate; this.protocols = protocols; this.policy = policy; }
public SecureCredential(int version, X509Certificate2 certificate, SecureCredential.Flags flags, SchProtocols protocols) { //Setting default values rootStore = phMappers = palgSupportedAlgs = certContextArray = IntPtr.Zero; cCreds = cMappers = cSupportedAlgs = 0; dwMinimumCipherStrength = dwMaximumCipherStrength = 0; dwSessionLifespan = reserved = 0; this.version = version; dwFlags = flags; grbitEnabledProtocols = protocols; if (certificate != null) { certContextArray = certificate.Handle; cCreds = 1; } }
public SecureCredential(int version, X509Certificate certificate, SecureCredential.Flags flags, SchProtocols protocols, EncryptionPolicy policy) { // default values required for a struct rootStore = phMappers = palgSupportedAlgs = certContextArray = IntPtr.Zero; cCreds = cMappers = cSupportedAlgs = 0; if (policy == EncryptionPolicy.RequireEncryption) { // Prohibit null encryption cipher dwMinimumCipherStrength = 0; dwMaximumCipherStrength = 0; } else if (policy == EncryptionPolicy.AllowNoEncryption) { // Allow null encryption cipher in addition to other ciphers dwMinimumCipherStrength = -1; dwMaximumCipherStrength = 0; } else if (policy == EncryptionPolicy.NoEncryption) { // Suppress all encryption and require null encryption cipher only dwMinimumCipherStrength = -1; dwMaximumCipherStrength = -1; } else { throw new ArgumentException(SR.GetString(SR.net_invalid_enum, "EncryptionPolicy"), "policy"); } dwSessionLifespan = reserved = 0; this.version = version; dwFlags = flags; grbitEnabledProtocols = protocols; if (certificate != null) { certContextArray = certificate.Handle; cCreds = 1; } }