public override void ProcessClientCredentials(TlsCredentials clientCredentials) { if (clientCredentials is TlsAgreementCredentials) { mAgreementCredentials = (TlsAgreementCredentials)clientCredentials; } else if (!(clientCredentials is TlsSignerCredentials)) { throw new TlsFatalAlert(80); } }
public override void ProcessClientCredentials(TlsCredentials clientCredentials) { if (clientCredentials is TlsAgreementCredentials) { this.mAgreementCredentials = (TlsAgreementCredentials)clientCredentials; return; } if (clientCredentials is TlsSignerCredentials) { return; } throw new TlsFatalAlert(80); }
public override void ProcessClientCredentials(TlsCredentials clientCredentials) { if (base.mKeyExchange == 20) { throw new TlsFatalAlert(80); } if (clientCredentials is TlsAgreementCredentials) { this.mAgreementCredentials = (TlsAgreementCredentials)clientCredentials; } else if (!(clientCredentials is TlsSignerCredentials)) { throw new TlsFatalAlert(80); } }
public override void ProcessClientCredentials(TlsCredentials clientCredentials) { if (clientCredentials is TlsAgreementCredentials) { // TODO Validate client cert has matching parameters (see 'areCompatibleParameters')? this.mAgreementCredentials = (TlsAgreementCredentials)clientCredentials; } else if (clientCredentials is TlsSignerCredentials) { // OK } else { throw new TlsFatalAlert(AlertDescription.internal_error); } }
public virtual void ProcessClientCredentials(TlsCredentials clientCredentials) { if (clientCredentials is TlsAgreementCredentials) { // TODO Validate client cert has matching parameters (see 'AreOnSameCurve')? this.agreementCredentials = (TlsAgreementCredentials)clientCredentials; } else if (clientCredentials is TlsSignerCredentials) { // OK } else { throw new TlsFatalAlert(AlertDescription.internal_error); } }
public override void ProcessClientCredentials(TlsCredentials clientCredentials) { if (mKeyExchange == KeyExchangeAlgorithm.ECDH_anon) { throw new TlsFatalAlert(AlertDescription.internal_error); } if (clientCredentials is TlsAgreementCredentials) { // TODO Validate client cert has matching parameters (see 'TlsEccUtilities.AreOnSameCurve')? this.mAgreementCredentials = (TlsAgreementCredentials)clientCredentials; } else if (clientCredentials is TlsSignerCredentials) { // OK } else { throw new TlsFatalAlert(AlertDescription.internal_error); } }
public virtual void SkipClientCredentials() { this.agreementCredentials = null; }
public CertificateData(Pkcs12Store keystore, String keystorePassword, TlsContext tlsContext, Boolean isClient, String certificateAlias) { this.tlsContext = tlsContext; List <X509Certificate> allCertificates = new List <X509Certificate>(); if (keystore != null) { IEnumerator aliasesEnum = keystore.Aliases.GetEnumerator(); while (aliasesEnum.MoveNext()) { String alias = (String)aliasesEnum.Current; X509Certificate currCertificate = keystore.GetCertificate(alias).Certificate; AsymmetricKeyParameter currParameter = null; if (certificateAlias == null || certificateAlias.Equals(alias)) { currParameter = keystore.GetKey(alias).Key; } if (currParameter != null) { certificate = currCertificate; keyParameter = currParameter; } if (currCertificate != null) { if (keyParameter != null) { allCertificates.Insert(0, currCertificate); } else { allCertificates.Add(currCertificate); } } } } if (!isClient && keyParameter == null) { throw new InvalidOperationException("No private key found"); } if (!isClient && allCertificates.Count == 0) { throw new InvalidOperationException("No certificate found"); } X509CertificateStructure[] certificateChain = new X509CertificateStructure[allCertificates.Count]; for (int i = 0; i < allCertificates.Count; ++i) { certificateChain[i] = allCertificates[i].CertificateStructure; } chain = new Certificate(certificateChain); if (!chain.IsEmpty) { try { if (keyParameter != null) { encryptionCredentials = new DefaultTlsEncryptionCredentials(tlsContext, chain, keyParameter); } agreementCredentials = new DefaultTlsAgreementCredentials(chain, keyParameter); } catch (Exception) { //may be invalid key format } } }
public override void ProcessClientCredentials(TlsCredentials clientCredentials) { if (mKeyExchange == KeyExchangeAlgorithm.ECDH_anon) throw new TlsFatalAlert(AlertDescription.internal_error); if (clientCredentials is TlsAgreementCredentials) { // TODO Validate client cert has matching parameters (see 'TlsEccUtilities.AreOnSameCurve')? this.mAgreementCredentials = (TlsAgreementCredentials)clientCredentials; } else if (clientCredentials is TlsSignerCredentials) { // OK } else { throw new TlsFatalAlert(AlertDescription.internal_error); } }