简体   繁体   English

使用 AuthenticationTypes.Sealing 时如何使用安全标志

[英]How to use secure flag when AuthenticationTypes.Sealing is used

I am creating a Directory Entry object using我正在使用创建目录条目 object

System.DirectoryServices.DirectoryEntry dirEntry = new System.DirectoryServices.DirectoryEntry(path,
                    null, null, System.DirectoryServices.AuthenticationTypes.Sealing))

It gives me warning: The Secure flag must also be set to use sealing.它给了我警告: The Secure flag must also be set to use sealing. What do I need to do?我需要做什么? I can suppress the above warning by using我可以通过使用来抑制上述警告

#pragma warning disable S4433 // LDAP connections should be authenticated

Can you please explain me what am i missing?你能解释一下我错过了什么吗? Please note, I am using AuthenticationTypes.Sealing because I want to create and set the user password in AD in a single commit from performance perspective.请注意,我正在使用 AuthenticationTypes.Sealing,因为我想从性能角度在一次提交中创建和设置 AD 中的用户密码。

Kindly explain.请解释一下。

The AuthenticationTypes enum is bit flag, meaning that multiple values can be combined. AuthenticationTypes枚举是位标志,意味着可以组合多个值。 The error is saying that you cannot use Sealing without Secure .错误是说您不能在没有Secure的情况下使用Sealing So you must include both, which you can do with |所以你必须包括两者,你可以用| , like this: , 像这样:

DirectoryEntry dirEntry = new DirectoryEntry(path,
    null, null, AuthenticationTypes.Sealing | AuthenticationTypes.Secure);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM