public bool IsSupported(CipherSuite suite) { if (!_registry.IsSupported(suite)) { return(false); } if (!_cipherAlgorithmRegistry.IsSupported(_registry.MapCipherAlgorithm(suite))) { return(false); } if (!_cipherParameterFactoryProvider.IsSupported(_registry.MapCipherAlgorithm(suite))) { return(false); } if (!_hashAlgorithmRegistry.IsSupported(_registry.MapHashAlgorithm(suite))) { return(false); } if (!_prfHashRegistry.IsSupported(_registry.MapHashAlgorithm(suite))) { return(false); } if (!_signatureAlgorithmsRegistry.IsSupported(_registry.MapSignatureAlgorithm(suite))) { return(false); } if (!_signatureCipherParameterFactoryProvider.IsSupported(_registry.MapSignatureAlgorithm(suite))) { return(false); } if (!_keyExchangeProvider.IsSupported(_registry.MapKeyExchange(suite))) { return(false); } return(true); }
public virtual bool IsCompatible(CipherSuite cipherSuite, X509Certificate certificate) { var signatureAlgorithm = CipherSuitesRegistry.MapSignatureAlgorithm(cipherSuite); var requiresECKey = Equals(CipherSuitesRegistry.MapKeyExchange(cipherSuite), ECIdentifiers.ECDH); if (signatureAlgorithm.Equals(ECIdentifiers.ECDSA)) { if (certificate.SignatureAlgorithm.Algorithm != ECIdentifiers.ECDSAWithSHA256) { return(false); } if (!(certificate.SubjectPublicKey is ECPublicKey)) { return(false); } return(true); } if (signatureAlgorithm.Equals(RSAIdentifiers.RSASig)) { if (!RSAKeyReader.IsRSAIdentifier(certificate.SignatureAlgorithm.Algorithm)) { return(false); } if (requiresECKey && !(certificate.SubjectPublicKey is ECPublicKey)) { return(false); } if (!requiresECKey && !(certificate.SubjectPublicKey is RSAPublicKey)) { return(false); } return(true); } return(false); }