本文整理汇总了C#中Org.BouncyCastle.Crypto.Tls.Certificate.Encode方法的典型用法代码示例。如果您正苦于以下问题:C# Certificate.Encode方法的具体用法?C# Certificate.Encode怎么用?C# Certificate.Encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Org.BouncyCastle.Crypto.Tls.Certificate
的用法示例。
在下文中一共展示了Certificate.Encode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendCertificateMessage
protected virtual void SendCertificateMessage(Certificate certificate)
{
if (certificate == null)
{
certificate = Certificate.EmptyChain;
}
if (certificate.IsEmpty)
{
TlsContext context = Context;
if (!context.IsServer)
{
ProtocolVersion serverVersion = Context.ServerVersion;
if (serverVersion.IsSsl)
{
string errorMessage = serverVersion.ToString() + " client didn't provide credentials";
RaiseWarning(AlertDescription.no_certificate, errorMessage);
return;
}
}
}
HandshakeMessage message = new HandshakeMessage(HandshakeType.certificate);
certificate.Encode(message);
message.WriteToRecordStream(this);
}
示例2: SendClientCertificate
private void SendClientCertificate(Certificate clientCert)
{
MemoryStream bos = new MemoryStream();
TlsUtilities.WriteUint8((byte)HandshakeType.certificate, bos);
// Reserve space for length
TlsUtilities.WriteUint24(0, bos);
clientCert.Encode(bos);
byte[] message = bos.ToArray();
// Patch actual length back in
TlsUtilities.WriteUint24(message.Length - 4, message, 1);
rs.WriteMessage(ContentType.handshake, message, 0, message.Length);
}
示例3: GenerateCertificate
/// <exception cref="IOException"/>
protected static byte[] GenerateCertificate(Certificate certificate)
{
MemoryStream buf = new MemoryStream();
certificate.Encode(buf);
return buf.ToArray();
}
示例4: SendClientCertificate
private void SendClientCertificate(Certificate clientCert)
{
MemoryStream bos = new MemoryStream();
TlsUtilities.WriteUint8((byte)HandshakeType.certificate, bos);
clientCert.Encode(bos);
byte[] message = bos.ToArray();
rs.WriteMessage(ContentType.handshake, message, 0, message.Length);
}