diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-03-02 16:36:48 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-03-02 16:36:48 +0700 |
commit | 0db55f1b5e2dbed6bc774432be7172abe3daa1e4 (patch) | |
tree | c7a1a71ab6e6f37037a41c1ccfd813f2b1793468 /crypto/src/tls/CertificateCompressionAlgorithm.cs | |
parent | Further GCM updates (diff) | |
download | BouncyCastle.NET-ed25519-0db55f1b5e2dbed6bc774432be7172abe3daa1e4.tar.xz |
RFC 8879 preliminaries
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; + } + } + } +} |