本文整理汇总了C#中ProtocolVersion.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ProtocolVersion.ToString方法的具体用法?C# ProtocolVersion.ToString怎么用?C# ProtocolVersion.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProtocolVersion
的用法示例。
在下文中一共展示了ProtocolVersion.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddVersionTests
private static void AddVersionTests(IList testSuite, ProtocolVersion version)
{
string prefix = version.ToString()
.Replace(" ", "")
.Replace("\\", "")
.Replace(".", "")
+ "_";
/*
* NOTE: Temporarily disabled automatic test runs because of problems getting a clean exit
* of the DTLS server after a fatal alert. As of writing, manual runs show the correct
* alerts being raised
*/
//{
// TlsTestConfig c = CreateDtlsTestConfig(version);
// c.clientAuth = C.CLIENT_AUTH_INVALID_VERIFY;
// c.ExpectServerFatalAlert(AlertDescription.decrypt_error);
// testSuite.Add(new TestCaseData(c).SetName(prefix + "BadCertificateVerify"));
//}
//{
// TlsTestConfig c = CreateDtlsTestConfig(version);
// c.clientAuth = C.CLIENT_AUTH_INVALID_CERT;
// c.ExpectServerFatalAlert(AlertDescription.bad_certificate);
// testSuite.Add(new TestCaseData(c).SetName(prefix + "BadClientCertificate"));
//}
//{
// TlsTestConfig c = CreateDtlsTestConfig(version);
// c.clientAuth = C.CLIENT_AUTH_NONE;
// c.serverCertReq = C.SERVER_CERT_REQ_MANDATORY;
// c.ExpectServerFatalAlert(AlertDescription.handshake_failure);
// testSuite.Add(new TestCaseData(c).SetName(prefix + "BadMandatoryCertReqDeclined"));
//}
{
TlsTestConfig c = CreateDtlsTestConfig(version);
testSuite.Add(new TestCaseData(c).SetName(prefix + "GoodDefault"));
}
{
TlsTestConfig c = CreateDtlsTestConfig(version);
c.serverCertReq = C.SERVER_CERT_REQ_NONE;
testSuite.Add(new TestCaseData(c).SetName(prefix + "GoodNoCertReq"));
}
{
TlsTestConfig c = CreateDtlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_NONE;
testSuite.Add(new TestCaseData(c).SetName(prefix + "GoodOptionalCertReqDeclined"));
}
}
示例2: AddVersionTests
private static void AddVersionTests(IList testSuite, ProtocolVersion version)
{
string prefix = version.ToString()
.Replace(" ", "")
.Replace("\\", "")
.Replace(".", "")
+ "_";
{
TlsTestConfig c = CreateTlsTestConfig(version);
testSuite.Add(new TestCaseData(c).SetName(prefix + "GoodDefault"));
}
{
TlsTestConfig c = CreateTlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_INVALID_VERIFY;
c.ExpectServerFatalAlert(AlertDescription.decrypt_error);
testSuite.Add(new TestCaseData(c).SetName(prefix + "BadCertificateVerify"));
}
{
TlsTestConfig c = CreateTlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_INVALID_CERT;
c.ExpectServerFatalAlert(AlertDescription.bad_certificate);
testSuite.Add(new TestCaseData(c).SetName(prefix + "BadClientCertificate"));
}
{
TlsTestConfig c = CreateTlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_NONE;
c.serverCertReq = C.SERVER_CERT_REQ_MANDATORY;
c.ExpectServerFatalAlert(AlertDescription.handshake_failure);
testSuite.Add(new TestCaseData(c).SetName(prefix + "BadMandatoryCertReqDeclined"));
}
{
TlsTestConfig c = CreateTlsTestConfig(version);
c.serverCertReq = C.SERVER_CERT_REQ_NONE;
testSuite.Add(new TestCaseData(c).SetName(prefix + "GoodNoCertReq"));
}
{
TlsTestConfig c = CreateTlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_NONE;
testSuite.Add(new TestCaseData(c).SetName(prefix + "GoodOptionalCertReqDeclined"));
}
}
示例3: AddVersionTests
private static void AddVersionTests(IList testSuite, ProtocolVersion version)
{
string prefix = version.ToString()
.Replace(" ", "")
.Replace("\\", "")
.Replace(".", "")
+ "_";
/*
* NOTE: Temporarily disabled automatic test runs because of problems getting a clean exit
* of the DTLS server after a fatal alert. As of writing, manual runs show the correct
* alerts being raised
*/
#if false
/*
* Server only declares support for SHA1/RSA, client selects MD5/RSA. Since the client is
* NOT actually tracking MD5 over the handshake, we expect fatal alert from the client.
*/
if (TlsUtilities.IsTlsV12(version))
{
TlsTestConfig c = CreateDtlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_VALID;
c.clientAuthSigAlg = new SignatureAndHashAlgorithm(HashAlgorithm.md5, SignatureAlgorithm.rsa);
c.serverCertReqSigAlgs = TlsUtilities.GetDefaultRsaSignatureAlgorithms();
c.ExpectClientFatalAlert(AlertDescription.internal_error);
AddTestCase(testSuite, c, prefix + "BadCertificateVerifyHashAlg");
}
/*
* Server only declares support for SHA1/ECDSA, client selects SHA1/RSA. Since the client is
* actually tracking SHA1 over the handshake, we expect fatal alert to come from the server
* when it verifies the selected algorithm against the CertificateRequest supported
* algorithms.
*/
if (TlsUtilities.IsTlsV12(version))
{
TlsTestConfig c = CreateDtlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_VALID;
c.clientAuthSigAlg = new SignatureAndHashAlgorithm(HashAlgorithm.sha1, SignatureAlgorithm.rsa);
c.serverCertReqSigAlgs = TlsUtilities.GetDefaultECDsaSignatureAlgorithms();
c.ExpectServerFatalAlert(AlertDescription.illegal_parameter);
AddTestCase(testSuite, c, prefix + "BadCertificateVerifySigAlg");
}
/*
* Server only declares support for SHA1/ECDSA, client signs with SHA1/RSA, but sends
* SHA1/ECDSA in the CertificateVerify. Since the client is actually tracking SHA1 over the
* handshake, and the claimed algorithm is in the CertificateRequest supported algorithms,
* we expect fatal alert to come from the server when it finds the claimed algorithm
* doesn't match the client certificate.
*/
if (TlsUtilities.IsTlsV12(version))
{
TlsTestConfig c = CreateDtlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_VALID;
c.clientAuthSigAlg = new SignatureAndHashAlgorithm(HashAlgorithm.sha1, SignatureAlgorithm.rsa);
c.clientAuthSigAlgClaimed = new SignatureAndHashAlgorithm(HashAlgorithm.sha1, SignatureAlgorithm.ecdsa);
c.serverCertReqSigAlgs = TlsUtilities.GetDefaultECDsaSignatureAlgorithms();
c.ExpectServerFatalAlert(AlertDescription.decrypt_error);
AddTestCase(testSuite, c, prefix + "BadCertificateVerifySigAlgMismatch");
}
{
TlsTestConfig c = CreateDtlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_INVALID_VERIFY;
c.ExpectServerFatalAlert(AlertDescription.decrypt_error);
AddTestCase(testSuite, c, prefix + "BadCertificateVerifySignature");
}
{
TlsTestConfig c = CreateDtlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_INVALID_CERT;
c.ExpectServerFatalAlert(AlertDescription.bad_certificate);
AddTestCase(testSuite, c, prefix + "BadClientCertificate");
}
{
TlsTestConfig c = CreateDtlsTestConfig(version);
c.clientAuth = C.CLIENT_AUTH_NONE;
c.serverCertReq = C.SERVER_CERT_REQ_MANDATORY;
c.ExpectServerFatalAlert(AlertDescription.handshake_failure);
AddTestCase(testSuite, c, prefix + "BadMandatoryCertReqDeclined");
}
/*
* Server selects MD5/RSA for ServerKeyExchange signature, which is not in the default
* supported signature algorithms that the client sent. We expect fatal alert from the
* client when it verifies the selected algorithm against the supported algorithms.
*/
if (TlsUtilities.IsTlsV12(version))
{
TlsTestConfig c = CreateDtlsTestConfig(version);
c.serverAuthSigAlg = new SignatureAndHashAlgorithm(HashAlgorithm.md5, SignatureAlgorithm.rsa);
//.........这里部分代码省略.........
示例4: GetIdentityUrl
internal static UriIdentifier GetIdentityUrl(Scenarios scenario, ProtocolVersion providerVersion, bool useSsl)
{
return new UriIdentifier(GetFullUrl("/" + identityPage, new Dictionary<string, string> {
{ "user", scenario.ToString() },
{ "version", providerVersion.ToString() },
}, useSsl));
}