diff options
author | David Hook <dgh@cryptoworkshop.com> | 2022-03-23 13:24:15 +1100 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2022-03-23 13:24:15 +1100 |
commit | fbd1138e762589b0b5b754b225660f912aa0d2f2 (patch) | |
tree | 780bba5af2f988ac6e8cd59b88160e9768111372 /crypto/src/tls/CertificateCompressionAlgorithm.cs | |
parent | fixed case of IV to upper github #353 (diff) | |
parent | Refactoring (diff) | |
download | BouncyCastle.NET-ed25519-fbd1138e762589b0b5b754b225660f912aa0d2f2.tar.xz |
Merge remote-tracking branch 'refs/remotes/origin/master'
Diffstat (limited to 'crypto/src/tls/CertificateCompressionAlgorithm.cs')
-rw-r--r-- | crypto/src/tls/CertificateCompressionAlgorithm.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/crypto/src/tls/CertificateCompressionAlgorithm.cs b/crypto/src/tls/CertificateCompressionAlgorithm.cs new file mode 100644 index 000000000..4b6ebdadc --- /dev/null +++ b/crypto/src/tls/CertificateCompressionAlgorithm.cs @@ -0,0 +1,47 @@ +using System; + +namespace Org.BouncyCastle.Tls +{ + /** + * RFC 8879 + */ + public abstract class CertificateCompressionAlgorithm + { + public const int zlib = 1; + public const int brotli = 2; + public const int zstd = 3; + + public static string GetName(int certificateCompressionAlgorithm) + { + switch (certificateCompressionAlgorithm) + { + case zlib: + return "zlib"; + case brotli: + return "brotli"; + case zstd: + return "zstd"; + default: + return "UNKNOWN"; + } + } + + public static string GetText(int certificateCompressionAlgorithm) + { + return GetName(certificateCompressionAlgorithm) + "(" + certificateCompressionAlgorithm + ")"; + } + + public static bool IsRecognized(int certificateCompressionAlgorithm) + { + switch (certificateCompressionAlgorithm) + { + case zlib: + case brotli: + case zstd: + return true; + default: + return false; + } + } + } +} |