本文整理匯總了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);
}