次のコードで受け入れられる自己署名証明書を作成する方法の例を教えてください。
ServiceHost svh = new ServiceHost(typeof(MyClass));
var tcpbinding = new NetTcpBinding(SecurityMode.TransportWithMessageCredential, true);
//security
tcpbinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
svh.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new BWUserNamePasswordValidator();
svh.Credentials.UserNameAuthentication.UserNamePasswordValidationMode =UserNamePasswordValidationMode.Custom;
svh.Credentials.ServiceCertificate.Certificate = BookmarkWizSettings.TcpBindingCertificate;
....
svh.Open();
私は使用しました
makecert -pe myCertificate
と
makecert -sv SignRoot.pvk -cy authority -r signroot.cer -a sha1 -n "CN=Dev Certification Authority" -ss my -sr localmachine
と
makecert -r -pe -n "CN=Client" -ss MyApp -sky Exchange
BouncyCastle で証明書を生成しようとしましたが、毎回次の例外が発生します。
It is likely that certificate 'CN=Dev Certification Authority' may not have a
private key that is capable of key exchange or the process may not have access
rights for the private key. Please see inner exception for detail.
内部例外は null です。
何かコツがあるのかもしれませんが、私にはわかりません。
WCF サービスの適切な証明書を生成するにはどうすればよいですか??