Beispiel #1
0
        public virtual void AssertCertificateVerifySignatureAlgorithm(ITlsContext ctx, SignatureAndHashAlgorithm algorithm)
        {
            if (!ctx.IsServer)
            {
                throw new InvalidOperationException();
            }

            AssertTls12(ctx);

            VerifySignatureAlgorithm(ctx, algorithm);

            ClientCertificateParameters parameters;

            if (ctx.HasClientCertificateParameters && ctx.ClientCertificateParameters != null)
            {
                parameters = ctx.ClientCertificateParameters;
            }
            else
            {
                parameters = null;
            }

            if (parameters != null && parameters.HasSignatureParameters && parameters.SignatureParameters != null)
            {
                if (!parameters.SignatureParameters.SignatureAndHashAlgorithms.Contains(algorithm))
                {
                    throw new TlsException(AlertDescription.IlegalParameter);
                }
            }
            else if (!algorithm.Equals(SignatureParameters.DefaultAlgorithm))
            {
                throw new TlsException(AlertDescription.IlegalParameter);
            }
        }
Beispiel #2
0
        public virtual void AssertServerSignatureAlgorithm(ITlsContext ctx, SignatureAndHashAlgorithm algorithm)
        {
            if (ctx.IsServer)
            {
                throw new InvalidOperationException();
            }

            AssertTls12(ctx);

            VerifySignatureAlgorithm(ctx, algorithm);

            if (ctx.HasCurrentSignatureParameters && ctx.CurrentSignatureParameters != null)
            {
                if (!ctx.CurrentSignatureParameters.SignatureAndHashAlgorithms.Contains(algorithm))
                {
                    throw new TlsException(AlertDescription.IlegalParameter);
                }
            }
            else if (!algorithm.Equals(SignatureParameters.DefaultAlgorithm))
            {
                throw new TlsException(AlertDescription.IlegalParameter);
            }
        }
		public virtual void AssertCertificateVerifySignatureAlgorithm (ITlsContext ctx, SignatureAndHashAlgorithm algorithm)
		{
			if (!ctx.IsServer)
				throw new InvalidOperationException ();

			AssertTls12 (ctx);

			VerifySignatureAlgorithm (ctx, algorithm);

			ClientCertificateParameters parameters;
			if (ctx.HasClientCertificateParameters && ctx.ClientCertificateParameters != null)
				parameters = ctx.ClientCertificateParameters;
			else
				parameters = null;

			if (parameters != null && parameters.HasSignatureParameters && parameters.SignatureParameters != null) {
				if (!parameters.SignatureParameters.SignatureAndHashAlgorithms.Contains (algorithm))
					throw new TlsException (AlertDescription.IlegalParameter);
			} else if (!algorithm.Equals (SignatureParameters.DefaultAlgorithm)) {
				throw new TlsException (AlertDescription.IlegalParameter);
			}
		}
		public virtual void AssertServerSignatureAlgorithm (ITlsContext ctx, SignatureAndHashAlgorithm algorithm)
		{
			if (ctx.IsServer)
				throw new InvalidOperationException ();

			AssertTls12 (ctx);

			VerifySignatureAlgorithm (ctx, algorithm);

			if (ctx.HasCurrentSignatureParameters && ctx.CurrentSignatureParameters != null) {
				if (!ctx.CurrentSignatureParameters.SignatureAndHashAlgorithms.Contains (algorithm))
					throw new TlsException (AlertDescription.IlegalParameter);
			} else if (!algorithm.Equals (SignatureParameters.DefaultAlgorithm)) {
				throw new TlsException (AlertDescription.IlegalParameter);
			}
		}