public virtual SignatureAndHashAlgorithm SelectClientSignatureAlgorithm(ITlsContext ctx) { if (ctx.IsServer) { throw new InvalidOperationException(); } AssertTls12(ctx); SignatureParameters parameters; if (ctx.HasClientCertificateParameters) { parameters = ctx.ClientCertificateParameters.SignatureParameters; } else if (ctx.HasCurrentSignatureParameters) { parameters = ctx.CurrentSignatureParameters; } else { parameters = GetClientSignatureParameters(ctx); } if (parameters == null || parameters.IsEmpty) { parameters = SignatureParameters.GetDefaultServerParameters(); } return(SelectSignatureAlgorithm(ctx, parameters)); }
public static SignatureParameters GetDefaultServerParameters() { var parameters = new SignatureParameters(); parameters.Add(HashAlgorithmType.Sha1); return(parameters); }
public static SignatureParameters GetDefaultClientParameters() { var parameters = new SignatureParameters(); parameters.EnsureDefaultValues(); return(parameters); }
public static SignatureParameters Create (params HashAlgorithmType[] hashTypes) { var parameters = new SignatureParameters (); foreach (var hash in hashTypes) parameters.Add (hash); return parameters; }
public static SignatureParameters Create (params SignatureAndHashAlgorithm[] algorithms) { var parameters = new SignatureParameters (); foreach (var algorithm in algorithms) parameters.Add (algorithm); return parameters; }
protected override void Clear() { base.Clear(); PendingRead = false; PendingWrite = false; signatureParameters = null; hasSignatureParameters = false; serverSignatureAlgorithm = null; }
public static SignatureParameters Create(params SignatureAndHashAlgorithm[] algorithms) { var parameters = new SignatureParameters(); foreach (var algorithm in algorithms) { parameters.Add(algorithm); } return(parameters); }
public static SignatureParameters Create(params HashAlgorithmType[] hashTypes) { var parameters = new SignatureParameters(); foreach (var hash in hashTypes) { parameters.Add(hash); } return(parameters); }
public void VerifySignatureParameters(ITlsContext ctx, SignatureParameters parameters) { foreach (var algorithm in parameters.SignatureAndHashAlgorithms) { if (!ctx.IsAlgorithmSupported(algorithm)) { throw new TlsException(AlertDescription.IlegalParameter); } } }
public SignatureAndHashAlgorithm SelectSignatureAlgorithm(ITlsContext ctx, SignatureParameters parameters) { AssertTls12(ctx); foreach (var algorithm in parameters.SignatureAndHashAlgorithms) { if (ctx.IsAlgorithmSupported(algorithm)) { return(algorithm); } } throw new TlsException(AlertDescription.IlegalParameter, "No supported signature type available."); }
public virtual SignatureParameters GetServerSignatureParameters(ITlsContext ctx) { if (!ctx.IsServer) { throw new InvalidOperationException(); } AssertTls12(ctx); if (ctx.HasCurrentSignatureParameters) { return(ctx.CurrentSignatureParameters); } return(SignatureParameters.GetDefaultServerParameters()); }
public virtual SignatureParameters GetClientSignatureParameters(ITlsContext ctx) { if (ctx.IsServer) { throw new InvalidOperationException(); } SignatureParameters parameters = null; if (ctx.SettingsProvider.HasClientSignatureParameters) { parameters = ctx.SettingsProvider.ClientSignatureParameters; } if (parameters == null || parameters.IsEmpty) { parameters = SignatureParameters.GetDefaultClientParameters(); } VerifySignatureParameters(ctx, parameters); return(parameters); }
public void VerifySignatureParameters (ITlsContext ctx, SignatureParameters parameters) { foreach (var algorithm in parameters.SignatureAndHashAlgorithms) { if (!ctx.IsAlgorithmSupported (algorithm)) throw new TlsException (AlertDescription.IlegalParameter); } }
public SignatureAndHashAlgorithm SelectSignatureAlgorithm (ITlsContext ctx, SignatureParameters parameters) { AssertTls12 (ctx); foreach (var algorithm in parameters.SignatureAndHashAlgorithms) { if (ctx.IsAlgorithmSupported (algorithm)) return algorithm; } throw new TlsException (AlertDescription.IlegalParameter, "No supported signature type available."); }
protected override void Clear () { base.Clear (); PendingRead = false; PendingWrite = false; signatureParameters = null; hasSignatureParameters = false; serverSignatureAlgorithm = null; }
public static SignatureParameters GetDefaultServerParameters () { var parameters = new SignatureParameters (); parameters.Add (HashAlgorithmType.Sha1); return parameters; }
public static SignatureParameters GetDefaultClientParameters () { var parameters = new SignatureParameters (); parameters.EnsureDefaultValues (); return parameters; }