/** * Return a predicate which matches any of the given key exchange schemes. * * @param keyAgreements the key exchange schemes * @return the predicate */ public static CipherSuitePredicate matchKeyExchange(KeyAgreement... keyAgreements) { keyAgreements = withoutNulls(keyAgreements); return keyAgreements == null || keyAgreements.length == 0 ? matchFalse() : keyAgreements.length == KeyAgreement.fullSize ? matchTrue() : new KeyAgreementCipherSuitePredicate(EnumSet.of(keyAgreements[0], keyAgreements)); }
/** * Return a predicate which matches any of the given key exchange schemes. * * @param keyAgreements the key exchange schemes * @return the predicate */ public static CipherSuitePredicate matchKeyExchange(EnumSet<KeyAgreement> keyAgreements) { return keyAgreements == null || keyAgreements.isEmpty() ? matchFalse() : KeyAgreement.isFull(keyAgreements) ? matchTrue() : new KeyAgreementCipherSuitePredicate(keyAgreements); }
/** * Return a predicate which matches any of the given security levels. * * @param levels the security levels * @return the predicate */ public static CipherSuitePredicate matchLevel(SecurityLevel... levels) { levels = withoutNulls(levels); return levels == null || levels.length == 0 ? matchFalse() : levels.length == SecurityLevel.fullSize ? matchTrue() : new LevelCipherSuitePredicate(EnumSet.of(levels[0], levels)); }
/** * Return a predicate which matches any of the given authentication schemes. * * @param authentications the authentication schemes * @return the predicate */ public static CipherSuitePredicate matchAuthentication(Authentication... authentications) { authentications = withoutNulls(authentications); return authentications == null || authentications.length == 0 ? matchFalse() : authentications.length == Authentication.fullSize ? matchTrue() : new AuthenticationCipherSuitePredicate(true, EnumSet.of(authentications[0], authentications)); }
/** * Return a predicate which matches any of the given protocols. * * @param protocols the protocols * @return the predicate */ public static CipherSuitePredicate matchProtocol(Protocol... protocols) { protocols = withoutNulls(protocols); return protocols == null || protocols.length == 0 ? matchFalse() : protocols.length == Protocol.fullSize ? matchTrue() : new ProtocolCipherSuitePredicate(EnumSet.of(protocols[0], protocols)); }
/** * Return a predicate which matches any of the given encryption schemes. * * @param encryptions the encryption schemes * @return the predicate */ public static CipherSuitePredicate matchEncryption(Encryption... encryptions) { encryptions = withoutNulls(encryptions); return encryptions == null || encryptions.length == 0 ? matchFalse() : encryptions.length == Encryption.fullSize ? matchTrue() : new EncryptionCipherSuitePredicate(EnumSet.of(encryptions[0], encryptions)); }
/** * Return a predicate which matches any of the given digest schemes. * * @param digests the digest schemes * @return the predicate */ public static CipherSuitePredicate matchDigest(Digest... digests) { digests = withoutNulls(digests); return digests == null || digests.length == 0 ? matchFalse() : digests.length == Digest.fullSize ? matchTrue() : new DigestCipherSuitePredicate(EnumSet.of(digests[0], digests)); }
/** * Return a predicate which matches any of the given protocols. * * @param protocols the protocols * @return the predicate */ public static CipherSuitePredicate matchProtocol(EnumSet<Protocol> protocols) { return protocols == null || protocols.isEmpty() ? matchFalse() : Protocol.isFull(protocols) ? matchTrue() : new ProtocolCipherSuitePredicate(protocols); }
/** * Return a predicate which matches any of the given security levels. * * @param levels the security levels * @return the predicate */ public static CipherSuitePredicate matchLevel(EnumSet<SecurityLevel> levels) { return levels == null || levels.isEmpty() ? matchFalse() : SecurityLevel.isFull(levels) ? matchTrue() : new LevelCipherSuitePredicate(levels); }
/** * Return a predicate which matches any of the given encryption schemes. * * @param encryptions the encryption schemes * @return the predicate */ public static CipherSuitePredicate matchEncryption(EnumSet<Encryption> encryptions) { return encryptions == null || encryptions.isEmpty() ? matchFalse() : Encryption.isFull(encryptions) ? matchTrue() : new EncryptionCipherSuitePredicate(encryptions); }
/** * Return a predicate which matches any of the given digest schemes. * * @param digests the digest schemes * @return the predicate */ public static CipherSuitePredicate matchDigest(EnumSet<Digest> digests) { return digests == null || digests.isEmpty() ? matchFalse() : Digest.isFull(digests) ? matchTrue() : new DigestCipherSuitePredicate(digests); }
/** * Return a predicate which matches any of the given authentication schemes. * * @param authentications the authentication schemes * @return the predicate */ public static CipherSuitePredicate matchAuthentication(EnumSet<Authentication> authentications) { return authentications == null || authentications.isEmpty() ? matchFalse() : Authentication.isFull(authentications) ? matchTrue() : optimize(new AuthenticationCipherSuitePredicate(true, authentications)); }
static CipherSuitePredicate optimize(CipherSuitePredicate predicate) { return predicate.isAlwaysFalse() ? matchFalse() : predicate.isAlwaysTrue() ? matchTrue() : predicate; }
/** * Return a predicate which matches any of the given digest schemes. * * @param digests the digest schemes * @return the predicate */ public static CipherSuitePredicate matchDigest(EnumSet<Digest> digests) { return digests == null || digests.isEmpty() ? matchFalse() : Digest.isFull(digests) ? matchTrue() : new DigestCipherSuitePredicate(digests); }
/** * Return a predicate which matches any of the given encryption schemes. * * @param encryptions the encryption schemes * @return the predicate */ public static CipherSuitePredicate matchEncryption(EnumSet<Encryption> encryptions) { return encryptions == null || encryptions.isEmpty() ? matchFalse() : Encryption.isFull(encryptions) ? matchTrue() : new EncryptionCipherSuitePredicate(encryptions); }
/** * Return a predicate which matches any of the given authentication schemes. * * @param authentications the authentication schemes * @return the predicate */ public static CipherSuitePredicate matchAuthentication(Authentication... authentications) { authentications = withoutNulls(authentications); return authentications == null || authentications.length == 0 ? matchFalse() : authentications.length == Authentication.fullSize ? matchTrue() : new AuthenticationCipherSuitePredicate(true, EnumSet.of(authentications[0], authentications)); }
/** * Return a predicate which matches any of the given key exchange schemes. * * @param keyAgreements the key exchange schemes * @return the predicate */ public static CipherSuitePredicate matchKeyExchange(EnumSet<KeyAgreement> keyAgreements) { return keyAgreements == null || keyAgreements.isEmpty() ? matchFalse() : KeyAgreement.isFull(keyAgreements) ? matchTrue() : new KeyAgreementCipherSuitePredicate(keyAgreements); }
/** * Return a predicate which matches any of the given security levels. * * @param levels the security levels * @return the predicate */ public static CipherSuitePredicate matchLevel(SecurityLevel... levels) { levels = withoutNulls(levels); return levels == null || levels.length == 0 ? matchFalse() : levels.length == SecurityLevel.fullSize ? matchTrue() : new LevelCipherSuitePredicate(EnumSet.of(levels[0], levels)); }
/** * Return a predicate which matches any of the given security levels. * * @param levels the security levels * @return the predicate */ public static CipherSuitePredicate matchLevel(EnumSet<SecurityLevel> levels) { return levels == null || levels.isEmpty() ? matchFalse() : SecurityLevel.isFull(levels) ? matchTrue() : new LevelCipherSuitePredicate(levels); }
/** * Return a predicate which matches any of the given protocols. * * @param protocols the protocols * @return the predicate */ public static CipherSuitePredicate matchProtocol(Protocol... protocols) { protocols = withoutNulls(protocols); return protocols == null || protocols.length == 0 ? matchFalse() : protocols.length == Protocol.fullSize ? matchTrue() : new ProtocolCipherSuitePredicate(EnumSet.of(protocols[0], protocols)); }