<PackageReference Include="BouncyCastle.Cryptography" Version="2.1.0" />

TlsUtilities

public abstract class TlsUtilities
public static readonly byte[] EmptyBytes

public static readonly int[] EmptyInts

public static readonly long[] EmptyLongs

public static readonly short[] EmptyShorts

public static readonly string[] EmptyStrings

protected TlsUtilities()

public static void AddIfSupported(IList<SignatureAndHashAlgorithm> supportedAlgs, TlsCrypto crypto, SignatureAndHashAlgorithm alg)

public static void AddIfSupported(IList<int> supportedGroups, TlsCrypto crypto, int namedGroup)

public static void AddIfSupported(IList<int> supportedGroups, TlsCrypto crypto, int[] namedGroups)

public static bool AddToSet<T>(IList<T> s, T i)

public static byte[] CalculateExporterSeed(SecurityParameters securityParameters, byte[] context)

public static void CheckPeerSigAlgs(TlsContext context, TlsCertificate[] peerCertPath)

Check the signature algorithm for certificates in the peer's CertPath as specified in RFC 5246 7.4.2, 7.4.4, 7.4.6 and similar rules for earlier TLS versions.

public static void CheckUint16(int i)

public static void CheckUint16(long i)

public static void CheckUint24(int i)

public static void CheckUint24(long i)

public static void CheckUint32(long i)

public static void CheckUint48(long i)

public static void CheckUint64(long i)

public static void CheckUint8(short i)

public static void CheckUint8(int i)

public static void CheckUint8(long i)

public static SignatureAndHashAlgorithm ChooseSignatureAndHashAlgorithm(TlsContext context, IList<SignatureAndHashAlgorithm> sigHashAlgs, short signatureAlgorithm)

public static SignatureAndHashAlgorithm ChooseSignatureAndHashAlgorithm(ProtocolVersion negotiatedVersion, IList<SignatureAndHashAlgorithm> sigHashAlgs, short signatureAlgorithm)

public static byte[] Clone(byte[] data)

public static string[] Clone(string[] s)

public static bool ConstantTimeAreEqual(int len, byte[] a, int aOff, byte[] b, int bOff)

public static bool ContainsAnySignatureAlgorithm(IList<SignatureAndHashAlgorithm> supportedSignatureAlgorithms, short signatureAlgorithm)

public static bool ContainsNonAscii(byte[] bs)

public static bool ContainsNonAscii(string s)

public static bool ContainsSignatureAlgorithm(IList<SignatureAndHashAlgorithm> supportedSignatureAlgorithms, SignatureAndHashAlgorithm signatureAlgorithm)

public static byte[] CopyOfRangeExact(byte[] original, int from, int to)

public static byte[] DecodeOpaque16(byte[] buf)

public static byte[] DecodeOpaque16(byte[] buf, int minLength)

public static byte[] DecodeOpaque8(byte[] buf)

public static byte[] DecodeOpaque8(byte[] buf, int minLength)

public static int DecodeUint16(byte[] buf)

public static int[] DecodeUint16ArrayWithUint8Length(byte[] buf)

public static long DecodeUint32(byte[] buf)

public static short DecodeUint8(byte[] buf)

public static short[] DecodeUint8ArrayWithUint8Length(byte[] buf)

public static byte[] EncodeOpaque16(byte[] buf)

public static byte[] EncodeOpaque24(byte[] buf)

public static byte[] EncodeOpaque8(byte[] buf)

public static void EncodeSupportedSignatureAlgorithms(IList<SignatureAndHashAlgorithm> supportedSignatureAlgorithms, Stream output)

public static byte[] EncodeUint16(int u16)

public static byte[] EncodeUint16ArrayWithUint16Length(int[] u16s)

public static byte[] EncodeUint16ArrayWithUint8Length(int[] u16s)

public static byte[] EncodeUint24(int u24)

public static byte[] EncodeUint32(long u32)

public static byte[] EncodeUint8(short u8)

public static byte[] EncodeUint8ArrayWithUint8Length(short[] u8s)

public static byte[] EncodeVersion(ProtocolVersion version)

public static TlsSecret GenerateEncryptedPreMasterSecret(TlsContext context, TlsEncryptor encryptor, Stream output)

Generate a pre_master_secret and send it encrypted to the server.

public static int GetCipherType(int cipherSuite)

public static int GetCommonCipherSuite13(ProtocolVersion negotiatedVersion, int[] peerCipherSuites, int[] localCipherSuites, bool useLocalOrder)

public static int[] GetCommonCipherSuites(int[] peerCipherSuites, int[] localCipherSuites, bool useLocalOrder)

public static SignatureAndHashAlgorithm GetDefaultSignatureAlgorithm(short signatureAlgorithm)

public static IList<SignatureAndHashAlgorithm> GetDefaultSignatureAlgorithms(short signatureAlgorithm)

public static int GetEncryptionAlgorithm(int cipherSuite)

public static int GetEncryptionAlgorithmType(int encryptionAlgorithm)

public static byte[] GetExtensionData(IDictionary<int, byte[]> extensions, int extensionType)

public static int GetKeyExchangeAlgorithm(int cipherSuite)

public static IList<int> GetKeyExchangeAlgorithms(int[] cipherSuites)

public static short GetLegacyClientCertType(short signatureAlgorithm)

public static short GetLegacySignatureAlgorithmClient(short clientCertificateType)

public static short GetLegacySignatureAlgorithmClientCert(short clientCertificateType)

public static short GetLegacySignatureAlgorithmServer(int keyExchangeAlgorithm)

public static short GetLegacySignatureAlgorithmServerCert(int keyExchangeAlgorithm)

public static int GetMacAlgorithm(int cipherSuite)

public static ProtocolVersion GetMinimumVersion(int cipherSuite)

public static IList<int> GetNamedGroupRoles(int[] cipherSuites)

public static IList<int> GetNamedGroupRoles(IList<int> keyExchangeAlgorithms)

public static DerObjectIdentifier GetOidForHashAlgorithm(short hashAlgorithm)

public static int[] GetSupportedCipherSuites(TlsCrypto crypto, int[] suites)

public static int[] GetSupportedCipherSuites(TlsCrypto crypto, int[] suites, int suitesOff, int suitesCount)

public static bool HasExpectedEmptyExtensionData(IDictionary<int, byte[]> extensions, int extensionType, short alertDescription)

public static bool HasSigningCapability(short clientCertificateType)

public static TlsSession ImportSession(byte[] sessionID, SessionParameters sessionParameters)

public static bool IsAeadCipherSuite(int cipherSuite)

public static bool IsBlockCipherSuite(int cipherSuite)

public static bool IsNullOrContainsNull(object[] array)

public static bool IsNullOrEmpty<T>(T[] array)

public static bool IsNullOrEmpty(string s)

public static bool IsNullOrEmpty<T>(IList<T> v)

public static bool IsSsl(TlsContext context)

public static bool IsStreamCipherSuite(int cipherSuite)

public static bool IsSupportedCipherSuite(TlsCrypto crypto, int cipherSuite)

public static bool IsSupportedKeyExchange(TlsCrypto crypto, int keyExchangeAlgorithm)

public static bool IsTimeout(SocketException e)

public static bool IsTlsV10(ProtocolVersion version)

public static bool IsTlsV10(TlsContext context)

public static bool IsTlsV11(ProtocolVersion version)

public static bool IsTlsV11(TlsContext context)

public static bool IsTlsV12(ProtocolVersion version)

public static bool IsTlsV12(TlsContext context)

public static bool IsTlsV13(ProtocolVersion version)

public static bool IsTlsV13(TlsContext context)

public static bool IsValidCipherSuiteForSignatureAlgorithms(int cipherSuite, IList<short> sigAlgs)

public static bool IsValidSignatureSchemeForServerKeyExchange(int signatureScheme, int keyExchangeAlgorithm)

public static bool IsValidUint16(int i)

public static bool IsValidUint16(long i)

public static bool IsValidUint24(int i)

public static bool IsValidUint24(long i)

public static bool IsValidUint32(long i)

public static bool IsValidUint48(long i)

public static bool IsValidUint64(long i)

public static bool IsValidUint8(short i)

public static bool IsValidUint8(int i)

public static bool IsValidUint8(long i)

public static bool IsValidVersionForCipherSuite(int cipherSuite, ProtocolVersion version)

public static TlsSecret Prf(SecurityParameters securityParameters, TlsSecret secret, string asciiLabel, byte[] seed, int length)

public static byte[] ReadAllOrNothing(int length, Stream input)

public static Asn1Object ReadAsn1Object(byte[] encoding)

public static byte[] ReadFully(int length, Stream input)

public static void ReadFully(byte[] buf, Stream input)

public static int ReadInt32(byte[] buf, int offset)

public static byte[] ReadOpaque16(Stream input)

public static byte[] ReadOpaque16(Stream input, int minLength)

public static byte[] ReadOpaque24(Stream input)

public static byte[] ReadOpaque24(Stream input, int minLength)

public static byte[] ReadOpaque8(Stream input)

public static byte[] ReadOpaque8(Stream input, int minLength)

public static byte[] ReadOpaque8(Stream input, int minLength, int maxLength)

public static int ReadUint16(Stream input)

public static int ReadUint16(byte[] buf, int offset)

public static int[] ReadUint16Array(int count, Stream input)

public static int ReadUint24(Stream input)

public static int ReadUint24(byte[] buf, int offset)

public static long ReadUint32(Stream input)

public static long ReadUint32(byte[] buf, int offset)

public static long ReadUint48(Stream input)

public static long ReadUint48(byte[] buf, int offset)

public static short ReadUint8(Stream input)

public static short ReadUint8(byte[] buf, int offset)

public static short[] ReadUint8Array(int count, Stream input)

public static short[] ReadUint8ArrayWithUint8Length(Stream input, int minLength)

public static ProtocolVersion ReadVersion(byte[] buf, int offset)

public static ProtocolVersion ReadVersion(Stream input)

public static void RequireDerEncoding(Asn1Encodable asn1, byte[] encoding)

public static IList<T> VectorOfOne<T>(T obj)

public static void VerifySupportedSignatureAlgorithm(IList<SignatureAndHashAlgorithm> supportedSignatureAlgorithms, SignatureAndHashAlgorithm signatureAlgorithm)

public static void WriteGmtUnixTime(byte[] buf, int offset)

public static void WriteOpaque16(byte[] buf, Stream output)

public static void WriteOpaque16(byte[] data, byte[] buf, int off)

public static void WriteOpaque24(byte[] buf, Stream output)

public static void WriteOpaque24(byte[] data, byte[] buf, int off)

public static void WriteOpaque8(byte[] buf, Stream output)

public static void WriteOpaque8(byte[] data, byte[] buf, int off)

public static void WriteUint16(int i, Stream output)

public static void WriteUint16(int i, byte[] buf, int offset)

public static void WriteUint16Array(int[] u16s, Stream output)

public static void WriteUint16Array(int[] u16s, byte[] buf, int offset)

public static void WriteUint16ArrayWithUint16Length(int[] u16s, Stream output)

public static void WriteUint16ArrayWithUint16Length(int[] u16s, byte[] buf, int offset)

public static void WriteUint16ArrayWithUint8Length(int[] u16s, byte[] buf, int offset)

public static void WriteUint24(int i, Stream output)

public static void WriteUint24(int i, byte[] buf, int offset)

public static void WriteUint32(long i, Stream output)

public static void WriteUint32(long i, byte[] buf, int offset)

public static void WriteUint48(long i, Stream output)

public static void WriteUint48(long i, byte[] buf, int offset)

public static void WriteUint64(long i, Stream output)

public static void WriteUint64(long i, byte[] buf, int offset)

public static void WriteUint8(short i, Stream output)

public static void WriteUint8(int i, Stream output)

public static void WriteUint8(short i, byte[] buf, int offset)

public static void WriteUint8(int i, byte[] buf, int offset)

public static void WriteUint8Array(short[] u8s, Stream output)

public static void WriteUint8Array(short[] u8s, byte[] buf, int offset)

public static void WriteUint8ArrayWithUint8Length(short[] u8s, Stream output)

public static void WriteUint8ArrayWithUint8Length(short[] u8s, byte[] buf, int offset)

public static void WriteVersion(ProtocolVersion version, Stream output)

public static void WriteVersion(ProtocolVersion version, byte[] buf, int offset)