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 CipherSuitePredicate
ANON_DH_PREDICATE
private static CipherSuitePredicate
DEFAULTS_PREDICATE
private static CipherSuitePredicate
OPENSSL_ALL
private static CipherSuitePredicate
OPENSSL_COMPLEMENT_OF_ALL
private static CipherSuitePredicate
OPENSSL_COMPLEMENT_OF_DEFAULT
private static CipherSuitePredicate
OPENSSL_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) boolean
isAlwaysFalse()
(package private) boolean
isAlwaysTrue()
static CipherSuitePredicate
matchAll(CipherSuitePredicate... predicates)
Match all of the given predicates.static CipherSuitePredicate
matchAnonDH()
Match all anonymous ciphers which use Diffie-Hellman key exchange.static CipherSuitePredicate
matchAny(CipherSuitePredicate... predicates)
Match any of the given predicates.static CipherSuitePredicate
matchAuthentication(EnumSet<Authentication> authentications)
Return a predicate which matches any of the given authentication schemes.static CipherSuitePredicate
matchAuthentication(Authentication authentication)
Return a predicate which matches the given authentication scheme.static CipherSuitePredicate
matchAuthentication(Authentication... authentications)
Return a predicate which matches any of the given authentication schemes.static CipherSuitePredicate
matchDefaultDeletes()
Return a predicate which matches all cipher suites that would be fully deleted in the default selector configuration.static CipherSuitePredicate
matchDigest(EnumSet<Digest> digests)
Return a predicate which matches any of the given digest schemes.static CipherSuitePredicate
matchDigest(Digest digest)
Return a predicate which matches the given digest scheme.static CipherSuitePredicate
matchDigest(Digest... digests)
Return a predicate which matches any of the given digest schemes.static CipherSuitePredicate
matchEncryption(EnumSet<Encryption> encryptions)
Return a predicate which matches any of the given encryption schemes.static CipherSuitePredicate
matchEncryption(Encryption encryption)
Return a predicate which matches the given encryption scheme.static CipherSuitePredicate
matchEncryption(Encryption... encryptions)
Return a predicate which matches any of the given encryption schemes.static CipherSuitePredicate
matchExport()
Return a predicate which matches all exportable cipher suites.static CipherSuitePredicate
matchFalse()
Match no possible cipher suites.static CipherSuitePredicate
matchFips()
Return a predicate which matches all FIPS cipher suites.static CipherSuitePredicate
matchKeyAgreement(KeyAgreement keyAgreement)
Return a predicate which matches the given key exchange scheme.static CipherSuitePredicate
matchKeyExchange(EnumSet<KeyAgreement> keyAgreements)
Return a predicate which matches any of the given key exchange schemes.static CipherSuitePredicate
matchKeyExchange(KeyAgreement... keyAgreements)
Return a predicate which matches any of the given key exchange schemes.static CipherSuitePredicate
matchLevel(EnumSet<SecurityLevel> levels)
Return a predicate which matches any of the given security levels.static CipherSuitePredicate
matchLevel(SecurityLevel level)
Return a predicate which matches the given security level.static CipherSuitePredicate
matchLevel(SecurityLevel... levels)
Return a predicate which matches any of the given security levels.static CipherSuitePredicate
matchLevelLessThan(SecurityLevel level)
Return a predicate which matches all security levels less than the given level.static CipherSuitePredicate
matchName(String name)
Return a predicate which matches a cipher suite with the given name.static CipherSuitePredicate
matchNonExport()
Return a predicate which matches all non-exportable cipher suites.static CipherSuitePredicate
matchNonFips()
Return a predicate which matches all non-FIPS cipher suites.static CipherSuitePredicate
matchNot(CipherSuitePredicate predicate)
Invert the given predicate.static CipherSuitePredicate
matchOpenSslAll()
Match all cipher suites except for anonymous and encryptionless suites, which must be explicitly enabled.static CipherSuitePredicate
matchOpenSslComplementOfAll()
Match all cipher suites included bymatchOpenSslAll()
but are disabled by default (generally, anonymous Diffie-Hellman suites including elliptic curve suites).static CipherSuitePredicate
matchOpenSslComplementOfDefault()
Match all of the cipher suites which are added by OpenSSL when using the specialCOMPLEMENTOFDEFAULT
rule.static CipherSuitePredicate
matchOpenSslDefaultDeletes()
Match all of the cipher suites which are automatically deleted by OpenSSL when using the specialDEFAULT
rule.static CipherSuitePredicate
matchProtocol(EnumSet<Protocol> protocols)
Return a predicate which matches any of the given protocols.static CipherSuitePredicate
matchProtocol(Protocol protocol)
Return a predicate which matches the given protocol.static CipherSuitePredicate
matchProtocol(Protocol... protocols)
Return a predicate which matches any of the given protocols.static CipherSuitePredicate
matchTrue()
Match all possible cipher suites.(package private) static CipherSuitePredicate
optimize(CipherSuitePredicate predicate)
(package private) abstract boolean
test(MechanismDatabase.Entry entry)
String
toString()
Get the string representation of this predicate.(package private) abstract void
toString(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
true
predicate
-
matchFalse
public static CipherSuitePredicate matchFalse()
Match no possible cipher suites.- Returns:
- the
false
predicate
-
matchAll
public static CipherSuitePredicate matchAll(CipherSuitePredicate... predicates)
Match all of the given predicates.- Parameters:
predicates
- the predicates- Returns:
- a predicate that is
true
when 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
true
when any nested predicate istrue
-
matchNot
public static CipherSuitePredicate matchNot(CipherSuitePredicate predicate)
Invert the given predicate.- Parameters:
predicate
- the predicate- Returns:
- a predicate which is
true
when 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 specialDEFAULT
rule.- Returns:
- the predicate
-
matchOpenSslComplementOfDefault
public static CipherSuitePredicate matchOpenSslComplementOfDefault()
Match all of the cipher suites which are added by OpenSSL when using the specialCOMPLEMENTOFDEFAULT
rule.- 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()
-
-