summary refs log tree commit diff
path: root/crypto/src/crypto/tls/TlsUtilities.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-07-24 14:54:13 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-07-24 14:54:13 +0700
commitbf1886e5381d0f3674efa1f9890dfb9fc1811ab8 (patch)
treed30d93bb51b5397813da1b5e2ffe208db5cb3de6 /crypto/src/crypto/tls/TlsUtilities.cs
parentAdd more variations of Check/IsValid (diff)
downloadBouncyCastle.NET-ed25519-bf1886e5381d0f3674efa1f9890dfb9fc1811ab8.tar.xz
Another round of TLS porting from Java
Diffstat (limited to 'crypto/src/crypto/tls/TlsUtilities.cs')
-rw-r--r--crypto/src/crypto/tls/TlsUtilities.cs19
1 files changed, 17 insertions, 2 deletions
diff --git a/crypto/src/crypto/tls/TlsUtilities.cs b/crypto/src/crypto/tls/TlsUtilities.cs

index 08fb6f0a4..a7932c9cc 100644 --- a/crypto/src/crypto/tls/TlsUtilities.cs +++ b/crypto/src/crypto/tls/TlsUtilities.cs
@@ -118,6 +118,21 @@ namespace Org.BouncyCastle.Crypto.Tls return true; } + public static bool IsSsl(TlsContext context) + { + return context.ServerVersion.IsSsl; + } + + public static bool IsTlsV11(TlsContext context) + { + return ProtocolVersion.TLSv11.IsEqualOrEarlierVersionOf(context.ServerVersion.GetEquivalentTLSVersion()); + } + + public static bool IsTlsV12(TlsContext context) + { + return ProtocolVersion.TLSv12.IsEqualOrEarlierVersionOf(context.ServerVersion.GetEquivalentTLSVersion()); + } + public static void WriteUint8(byte i, Stream output) { output.WriteByte(i); @@ -600,12 +615,12 @@ namespace Org.BouncyCastle.Crypto.Tls return VectorOfOne(new SignatureAndHashAlgorithm(HashAlgorithm.sha1, SignatureAlgorithm.rsa)); } - public static byte[] GetExtensionData(Hashtable extensions, int extensionType) + public static byte[] GetExtensionData(IDictionary extensions, int extensionType) { return extensions == null ? null : (byte[])extensions[extensionType]; } - public static bool HasExpectedEmptyExtensionData(Hashtable extensions, int extensionType, + public static bool HasExpectedEmptyExtensionData(IDictionary extensions, int extensionType, byte alertDescription) { byte[] extension_data = GetExtensionData(extensions, extensionType);