Package org.wildfly.security.ssl
Class CipherSuitePredicate
- java.lang.Object
-
- org.wildfly.security.ssl.CipherSuitePredicate
-
- Direct Known Subclasses:
AndCipherSuitePredicate,AuthenticationCipherSuitePredicate,BooleanCipherSuitePredicate,DigestCipherSuitePredicate,EncryptionCipherSuitePredicate,ExportCipherSuitePredicate,FipsCipherSuitePredicate,KeyAgreementCipherSuitePredicate,LevelCipherSuitePredicate,NotCipherSuitePredicate,OrCipherSuitePredicate,ProtocolCipherSuitePredicate
public abstract class CipherSuitePredicate extends Object
An opaque predicate which can be used to match SSL/TLS cipher suites.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description private static CipherSuitePredicateANON_DH_PREDICATEprivate static CipherSuitePredicateDEFAULTS_PREDICATEprivate static CipherSuitePredicateOPENSSL_ALLprivate static CipherSuitePredicateOPENSSL_COMPLEMENT_OF_ALLprivate static CipherSuitePredicateOPENSSL_COMPLEMENT_OF_DEFAULTprivate static CipherSuitePredicateOPENSSL_DEFAULT_DELETES
-
Constructor Summary
Constructors Constructor Description CipherSuitePredicate()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) booleanisAlwaysFalse()(package private) booleanisAlwaysTrue()static CipherSuitePredicatematchAll(CipherSuitePredicate... predicates)Match all of the given predicates.static CipherSuitePredicatematchAnonDH()Match all anonymous ciphers which use Diffie-Hellman key exchange.static CipherSuitePredicatematchAny(CipherSuitePredicate... predicates)Match any of the given predicates.static CipherSuitePredicatematchAuthentication(EnumSet<Authentication> authentications)Return a predicate which matches any of the given authentication schemes.static CipherSuitePredicatematchAuthentication(Authentication authentication)Return a predicate which matches the given authentication scheme.static CipherSuitePredicatematchAuthentication(Authentication... authentications)Return a predicate which matches any of the given authentication schemes.static CipherSuitePredicatematchDefaultDeletes()Return a predicate which matches all cipher suites that would be fully deleted in the default selector configuration.static CipherSuitePredicatematchDigest(EnumSet<Digest> digests)Return a predicate which matches any of the given digest schemes.static CipherSuitePredicatematchDigest(Digest digest)Return a predicate which matches the given digest scheme.static CipherSuitePredicatematchDigest(Digest... digests)Return a predicate which matches any of the given digest schemes.static CipherSuitePredicatematchEncryption(EnumSet<Encryption> encryptions)Return a predicate which matches any of the given encryption schemes.static CipherSuitePredicatematchEncryption(Encryption encryption)Return a predicate which matches the given encryption scheme.static CipherSuitePredicatematchEncryption(Encryption... encryptions)Return a predicate which matches any of the given encryption schemes.static CipherSuitePredicatematchExport()Return a predicate which matches all exportable cipher suites.static CipherSuitePredicatematchFalse()Match no possible cipher suites.static CipherSuitePredicatematchFips()Return a predicate which matches all FIPS cipher suites.static CipherSuitePredicatematchKeyAgreement(KeyAgreement keyAgreement)Return a predicate which matches the given key exchange scheme.static CipherSuitePredicatematchKeyExchange(EnumSet<KeyAgreement> keyAgreements)Return a predicate which matches any of the given key exchange schemes.static CipherSuitePredicatematchKeyExchange(KeyAgreement... keyAgreements)Return a predicate which matches any of the given key exchange schemes.static CipherSuitePredicatematchLevel(EnumSet<SecurityLevel> levels)Return a predicate which matches any of the given security levels.static CipherSuitePredicatematchLevel(SecurityLevel level)Return a predicate which matches the given security level.static CipherSuitePredicatematchLevel(SecurityLevel... levels)Return a predicate which matches any of the given security levels.static CipherSuitePredicatematchLevelLessThan(SecurityLevel level)Return a predicate which matches all security levels less than the given level.static CipherSuitePredicatematchName(String name)Return a predicate which matches a cipher suite with the given name.static CipherSuitePredicatematchNonExport()Return a predicate which matches all non-exportable cipher suites.static CipherSuitePredicatematchNonFips()Return a predicate which matches all non-FIPS cipher suites.static CipherSuitePredicatematchNot(CipherSuitePredicate predicate)Invert the given predicate.static CipherSuitePredicatematchOpenSslAll()Match all cipher suites except for anonymous and encryptionless suites, which must be explicitly enabled.static CipherSuitePredicatematchOpenSslComplementOfAll()Match all cipher suites included bymatchOpenSslAll()but are disabled by default (generally, anonymous Diffie-Hellman suites including elliptic curve suites).static CipherSuitePredicatematchOpenSslComplementOfDefault()Match all of the cipher suites which are added by OpenSSL when using the specialCOMPLEMENTOFDEFAULTrule.static CipherSuitePredicatematchOpenSslDefaultDeletes()Match all of the cipher suites which are automatically deleted by OpenSSL when using the specialDEFAULTrule.static CipherSuitePredicatematchProtocol(EnumSet<Protocol> protocols)Return a predicate which matches any of the given protocols.static CipherSuitePredicatematchProtocol(Protocol protocol)Return a predicate which matches the given protocol.static CipherSuitePredicatematchProtocol(Protocol... protocols)Return a predicate which matches any of the given protocols.static CipherSuitePredicatematchTrue()Match all possible cipher suites.(package private) static CipherSuitePredicateoptimize(CipherSuitePredicate predicate)(package private) abstract booleantest(MechanismDatabase.Entry entry)StringtoString()Get the string representation of this predicate.(package private) abstract voidtoString(StringBuilder b)(package private) static <T> T[]withoutNulls(T[] orig)
-
-
-
Field Detail
-
DEFAULTS_PREDICATE
private static final CipherSuitePredicate DEFAULTS_PREDICATE
-
ANON_DH_PREDICATE
private static final CipherSuitePredicate ANON_DH_PREDICATE
-
OPENSSL_COMPLEMENT_OF_ALL
private static final CipherSuitePredicate OPENSSL_COMPLEMENT_OF_ALL
-
OPENSSL_DEFAULT_DELETES
private static final CipherSuitePredicate OPENSSL_DEFAULT_DELETES
-
OPENSSL_COMPLEMENT_OF_DEFAULT
private static final CipherSuitePredicate OPENSSL_COMPLEMENT_OF_DEFAULT
-
OPENSSL_ALL
private static final CipherSuitePredicate OPENSSL_ALL
-
-
Method Detail
-
optimize
static CipherSuitePredicate optimize(CipherSuitePredicate predicate)
-
matchTrue
public static CipherSuitePredicate matchTrue()
Match all possible cipher suites.- Returns:
- the
truepredicate
-
matchFalse
public static CipherSuitePredicate matchFalse()
Match no possible cipher suites.- Returns:
- the
falsepredicate
-
matchAll
public static CipherSuitePredicate matchAll(CipherSuitePredicate... predicates)
Match all of the given predicates.- Parameters:
predicates- the predicates- Returns:
- a predicate that is
truewhen all nested predicates aretrue
-
matchAny
public static CipherSuitePredicate matchAny(CipherSuitePredicate... predicates)
Match any of the given predicates.- Parameters:
predicates- the predicates- Returns:
- a predicate that is
truewhen any nested predicate istrue
-
matchNot
public static CipherSuitePredicate matchNot(CipherSuitePredicate predicate)
Invert the given predicate.- Parameters:
predicate- the predicate- Returns:
- a predicate which is
truewhen the nested predicate isfalse, and vice-versa
-
withoutNulls
static <T> T[] withoutNulls(T[] orig)
-
matchEncryption
public static CipherSuitePredicate matchEncryption(Encryption encryption)
Return a predicate which matches the given encryption scheme.- Parameters:
encryption- the encryption scheme- Returns:
- the predicate
-
matchEncryption
public static CipherSuitePredicate matchEncryption(Encryption... encryptions)
Return a predicate which matches any of the given encryption schemes.- Parameters:
encryptions- the encryption schemes- Returns:
- the predicate
-
matchEncryption
public static CipherSuitePredicate matchEncryption(EnumSet<Encryption> encryptions)
Return a predicate which matches any of the given encryption schemes.- Parameters:
encryptions- the encryption schemes- Returns:
- the predicate
-
matchAuthentication
public static CipherSuitePredicate matchAuthentication(Authentication authentication)
Return a predicate which matches the given authentication scheme.- Parameters:
authentication- the authentication scheme- Returns:
- the predicate
-
matchAuthentication
public static CipherSuitePredicate matchAuthentication(Authentication... authentications)
Return a predicate which matches any of the given authentication schemes.- Parameters:
authentications- the authentication schemes- Returns:
- the predicate
-
matchAuthentication
public static CipherSuitePredicate matchAuthentication(EnumSet<Authentication> authentications)
Return a predicate which matches any of the given authentication schemes.- Parameters:
authentications- the authentication schemes- Returns:
- the predicate
-
matchKeyAgreement
public static CipherSuitePredicate matchKeyAgreement(KeyAgreement keyAgreement)
Return a predicate which matches the given key exchange scheme.- Parameters:
keyAgreement- the key exchange scheme- Returns:
- the predicate
-
matchKeyExchange
public static CipherSuitePredicate matchKeyExchange(KeyAgreement... keyAgreements)
Return a predicate which matches any of the given key exchange schemes.- Parameters:
keyAgreements- the key exchange schemes- Returns:
- the predicate
-
matchKeyExchange
public static CipherSuitePredicate matchKeyExchange(EnumSet<KeyAgreement> keyAgreements)
Return a predicate which matches any of the given key exchange schemes.- Parameters:
keyAgreements- the key exchange schemes- Returns:
- the predicate
-
matchDigest
public static CipherSuitePredicate matchDigest(Digest digest)
Return a predicate which matches the given digest scheme.- Parameters:
digest- the digest scheme- Returns:
- the predicate
-
matchDigest
public static CipherSuitePredicate matchDigest(Digest... digests)
Return a predicate which matches any of the given digest schemes.- Parameters:
digests- the digest schemes- Returns:
- the predicate
-
matchDigest
public static CipherSuitePredicate matchDigest(EnumSet<Digest> digests)
Return a predicate which matches any of the given digest schemes.- Parameters:
digests- the digest schemes- Returns:
- the predicate
-
matchProtocol
public static CipherSuitePredicate matchProtocol(Protocol protocol)
Return a predicate which matches the given protocol.- Parameters:
protocol- the protocol- Returns:
- the predicate
-
matchProtocol
public static CipherSuitePredicate matchProtocol(Protocol... protocols)
Return a predicate which matches any of the given protocols.- Parameters:
protocols- the protocols- Returns:
- the predicate
-
matchProtocol
public static CipherSuitePredicate matchProtocol(EnumSet<Protocol> protocols)
Return a predicate which matches any of the given protocols.- Parameters:
protocols- the protocols- Returns:
- the predicate
-
matchLevel
public static CipherSuitePredicate matchLevel(SecurityLevel level)
Return a predicate which matches the given security level.- Parameters:
level- the security level- Returns:
- the predicate
-
matchLevel
public static CipherSuitePredicate matchLevel(SecurityLevel... levels)
Return a predicate which matches any of the given security levels.- Parameters:
levels- the security levels- Returns:
- the predicate
-
matchLevel
public static CipherSuitePredicate matchLevel(EnumSet<SecurityLevel> levels)
Return a predicate which matches any of the given security levels.- Parameters:
levels- the security levels- Returns:
- the predicate
-
matchLevelLessThan
public static CipherSuitePredicate matchLevelLessThan(SecurityLevel level)
Return a predicate which matches all security levels less than the given level.- Parameters:
level- the security level to compare against- Returns:
- the predicate
-
matchFips
public static CipherSuitePredicate matchFips()
Return a predicate which matches all FIPS cipher suites.- Returns:
- the predicate
-
matchNonFips
public static CipherSuitePredicate matchNonFips()
Return a predicate which matches all non-FIPS cipher suites.- Returns:
- the predicate
-
matchExport
public static CipherSuitePredicate matchExport()
Return a predicate which matches all exportable cipher suites.- Returns:
- the predicate
-
matchNonExport
public static CipherSuitePredicate matchNonExport()
Return a predicate which matches all non-exportable cipher suites.- Returns:
- the predicate
-
matchName
public static CipherSuitePredicate matchName(String name)
Return a predicate which matches a cipher suite with the given name. The cipher suite name must be a standard or OpenSSL-style mechanism name identifying a single mechanism.- Returns:
- the predicate
-
matchDefaultDeletes
public static CipherSuitePredicate matchDefaultDeletes()
Return a predicate which matches all cipher suites that would be fully deleted in the default selector configuration.- Returns:
- the predicate
-
matchAnonDH
public static CipherSuitePredicate matchAnonDH()
Match all anonymous ciphers which use Diffie-Hellman key exchange.- Returns:
- the predicate
-
matchOpenSslAll
public static CipherSuitePredicate matchOpenSslAll()
Match all cipher suites except for anonymous and encryptionless suites, which must be explicitly enabled.- Returns:
- the predicate
-
matchOpenSslComplementOfAll
public static CipherSuitePredicate matchOpenSslComplementOfAll()
Match all cipher suites included bymatchOpenSslAll()but are disabled by default (generally, anonymous Diffie-Hellman suites including elliptic curve suites).- Returns:
- the predicate
-
matchOpenSslDefaultDeletes
public static CipherSuitePredicate matchOpenSslDefaultDeletes()
Match all of the cipher suites which are automatically deleted by OpenSSL when using the specialDEFAULTrule.- Returns:
- the predicate
-
matchOpenSslComplementOfDefault
public static CipherSuitePredicate matchOpenSslComplementOfDefault()
Match all of the cipher suites which are added by OpenSSL when using the specialCOMPLEMENTOFDEFAULTrule.- Returns:
- the predicate
-
toString
abstract void toString(StringBuilder b)
-
toString
public final String toString()
Get the string representation of this predicate.
-
test
abstract boolean test(MechanismDatabase.Entry entry)
-
isAlwaysTrue
boolean isAlwaysTrue()
-
isAlwaysFalse
boolean isAlwaysFalse()
-
-