@Override public TransformationSpec getTransformationSpec(String provider, String mechanism, String token) throws IllegalArgumentException { Assert.checkNotNullParam("token", token); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } for (TransformationSpec t : ts) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()))) { return t; } } return null; }
/** * Get supported ciphers as comma separated list of cipher-opts by Digest MD5 spec. * * @return comma separated list of ciphers */ static String getSupportedCiphers(String[] demandedCiphers) { TransformationMapper trans = new DefaultTransformationMapper(); if (demandedCiphers == null) { demandedCiphers = CIPHER_OPTS; } StringBuilder ciphers = new StringBuilder(); for (TransformationSpec ts: trans.getTransformationSpecByStrength(SaslMechanismInformation.Names.DIGEST_MD5, demandedCiphers)) { if (ciphers.length() > 0) { ciphers.append(DELIMITER); } ciphers.append(ts.getToken()); } return ciphers.toString(); }
@Override public TransformationSpec[] getTransformationSpecByStrength(String provider, String mechanism, String... tokens) throws IllegalArgumentException { Assert.checkNotNullParam("tokens", tokens); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } ArrayList<TransformationSpec> tf = new ArrayList<TransformationSpec>(ts.length); for (TransformationSpec t : ts) { for (String token : tokens) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()))) { tf.add(t); } } } return tf.toArray(new TransformationSpec[tf.size()]); }
@Override public TransformationSpec[] getTransformationSpecWithStrength(String provider, String mechanism, int strength, String... tokens) throws IllegalArgumentException { Assert.checkNotNullParam("tokens", tokens); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } ArrayList<TransformationSpec> tf = new ArrayList<TransformationSpec>(ts.length); for (TransformationSpec t : ts) { for (String token : tokens) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()) && (strength <= t.getStrength()))) { tf.add(t); } } } return tf.toArray(new TransformationSpec[tf.size()]); }
private String selectCipher(String ciphersFromServer) throws SaslException { if (ciphersFromServer == null) { throw saslDigest.mechNoCiphersOfferedByServer().toSaslException(); } TransformationMapper trans = new DefaultTransformationMapper(); String[] tokensToChooseFrom = ciphersFromServer.split(String.valueOf(DELIMITER)); for (TransformationSpec ts: trans.getTransformationSpecByStrength(SaslMechanismInformation.Names.DIGEST_MD5, tokensToChooseFrom)) { // take the strongest cipher for (String c: demandedCiphers) { if (c.equals(ts.getToken())) { return ts.getToken(); } } } throw saslDigest.mechNoCommonCipher().toSaslException(); }
/** * Get supported ciphers as comma separated list of cipher-opts by Digest MD5 spec. * * @return comma separated list of ciphers */ static String getSupportedCiphers(String[] demandedCiphers) { TransformationMapper trans = new DefaultTransformationMapper(); if (demandedCiphers == null) { demandedCiphers = CIPHER_OPTS; } StringBuilder ciphers = new StringBuilder(); for (TransformationSpec ts: trans.getTransformationSpecByStrength(SaslMechanismInformation.Names.DIGEST_MD5, demandedCiphers)) { if (ciphers.length() > 0) { ciphers.append(DELIMITER); } ciphers.append(ts.getToken()); } return ciphers.toString(); }
@Override public TransformationSpec[] getTransformationSpecByStrength(String provider, String mechanism, String... tokens) throws IllegalArgumentException { Assert.checkNotNullParam("tokens", tokens); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } ArrayList<TransformationSpec> tf = new ArrayList<TransformationSpec>(ts.length); for (TransformationSpec t : ts) { for (String token : tokens) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()))) { tf.add(t); } } } return tf.toArray(new TransformationSpec[tf.size()]); }
@Override public TransformationSpec[] getTransformationSpecByStrength(String provider, String mechanism, String... tokens) throws IllegalArgumentException { Assert.checkNotNullParam("tokens", tokens); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } ArrayList<TransformationSpec> tf = new ArrayList<TransformationSpec>(ts.length); for (TransformationSpec t : ts) { for (String token : tokens) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()))) { tf.add(t); } } } return tf.toArray(new TransformationSpec[tf.size()]); }
/** * Get supported ciphers as comma separated list of cipher-opts by Digest MD5 spec. * * @return comma separated list of ciphers */ static String getSupportedCiphers(String[] demandedCiphers) { TransformationMapper trans = new DefaultTransformationMapper(); if (demandedCiphers == null) { demandedCiphers = CIPHER_OPTS; } StringBuilder ciphers = new StringBuilder(); for (TransformationSpec ts: trans.getTransformationSpecByStrength(SaslMechanismInformation.Names.DIGEST_MD5, demandedCiphers)) { if (ciphers.length() > 0) { ciphers.append(DELIMITER); } ciphers.append(ts.getToken()); } return ciphers.toString(); }
/** * Get supported ciphers as comma separated list of cipher-opts by Digest MD5 spec. * * @return comma separated list of ciphers */ static String getSupportedCiphers(String[] demandedCiphers) { TransformationMapper trans = new DefaultTransformationMapper(); if (demandedCiphers == null) { demandedCiphers = CIPHER_OPTS; } StringBuilder ciphers = new StringBuilder(); for (TransformationSpec ts: trans.getTransformationSpecByStrength(SaslMechanismInformation.Names.DIGEST_MD5, demandedCiphers)) { if (ciphers.length() > 0) { ciphers.append(DELIMITER); } ciphers.append(ts.getToken()); } return ciphers.toString(); }
@Override public TransformationSpec[] getTransformationSpecByStrength(String provider, String mechanism, String... tokens) throws IllegalArgumentException { Assert.checkNotNullParam("tokens", tokens); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } ArrayList<TransformationSpec> tf = new ArrayList<TransformationSpec>(ts.length); for (TransformationSpec t : ts) { for (String token : tokens) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()))) { tf.add(t); } } } return tf.toArray(new TransformationSpec[tf.size()]); }
@Override public TransformationSpec getTransformationSpec(String provider, String mechanism, String token) throws IllegalArgumentException { Assert.checkNotNullParam("token", token); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } for (TransformationSpec t : ts) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()))) { return t; } } return null; }
@Override public TransformationSpec getTransformationSpec(String provider, String mechanism, String token) throws IllegalArgumentException { Assert.checkNotNullParam("token", token); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } for (TransformationSpec t : ts) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()))) { return t; } } return null; }
@Override public TransformationSpec[] getTransformationSpecWithStrength(String provider, String mechanism, int strength, String... tokens) throws IllegalArgumentException { Assert.checkNotNullParam("tokens", tokens); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } ArrayList<TransformationSpec> tf = new ArrayList<TransformationSpec>(ts.length); for (TransformationSpec t : ts) { for (String token : tokens) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()) && (strength <= t.getStrength()))) { tf.add(t); } } } return tf.toArray(new TransformationSpec[tf.size()]); }
@Override public TransformationSpec[] getTransformationSpecWithStrength(String provider, String mechanism, int strength, String... tokens) throws IllegalArgumentException { Assert.checkNotNullParam("tokens", tokens); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } ArrayList<TransformationSpec> tf = new ArrayList<TransformationSpec>(ts.length); for (TransformationSpec t : ts) { for (String token : tokens) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()) && (strength <= t.getStrength()))) { tf.add(t); } } } return tf.toArray(new TransformationSpec[tf.size()]); }
@Override public TransformationSpec getTransformationSpec(String provider, String mechanism, String token) throws IllegalArgumentException { Assert.checkNotNullParam("token", token); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } for (TransformationSpec t : ts) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()))) { return t; } } return null; }
@Override public TransformationSpec[] getTransformationSpecWithStrength(String provider, String mechanism, int strength, String... tokens) throws IllegalArgumentException { Assert.checkNotNullParam("tokens", tokens); TransformationSpec[] ts = transformations.get(mechanism); if (ts == null) { throw log.mechanismNotSupported(mechanism); } ArrayList<TransformationSpec> tf = new ArrayList<TransformationSpec>(ts.length); for (TransformationSpec t : ts) { for (String token : tokens) { if (token.equals(t.getToken()) && (provider == null || provider.equals(t.getProvider()) && (strength <= t.getStrength()))) { tf.add(t); } } } return tf.toArray(new TransformationSpec[tf.size()]); }
private String selectCipher(String ciphersFromServer) throws SaslException { if (ciphersFromServer == null) { throw saslDigest.mechNoCiphersOfferedByServer().toSaslException(); } TransformationMapper trans = new DefaultTransformationMapper(); String[] tokensToChooseFrom = ciphersFromServer.split(String.valueOf(DELIMITER)); for (TransformationSpec ts: trans.getTransformationSpecByStrength(SaslMechanismInformation.Names.DIGEST_MD5, tokensToChooseFrom)) { // take the strongest cipher for (String c: demandedCiphers) { if (c.equals(ts.getToken())) { return ts.getToken(); } } } throw saslDigest.mechNoCommonCipher().toSaslException(); }
private String selectCipher(String ciphersFromServer) throws SaslException { if (ciphersFromServer == null) { throw saslDigest.mechNoCiphersOfferedByServer().toSaslException(); } TransformationMapper trans = new DefaultTransformationMapper(); String[] tokensToChooseFrom = ciphersFromServer.split(String.valueOf(DELIMITER)); for (TransformationSpec ts: trans.getTransformationSpecByStrength(SaslMechanismInformation.Names.DIGEST_MD5, tokensToChooseFrom)) { // take the strongest cipher for (String c: demandedCiphers) { if (c.equals(ts.getToken())) { return ts.getToken(); } } } throw saslDigest.mechNoCommonCipher().toSaslException(); }
private String selectCipher(String ciphersFromServer) throws SaslException { if (ciphersFromServer == null) { throw saslDigest.mechNoCiphersOfferedByServer().toSaslException(); } TransformationMapper trans = new DefaultTransformationMapper(); String[] tokensToChooseFrom = ciphersFromServer.split(String.valueOf(DELIMITER)); for (TransformationSpec ts: trans.getTransformationSpecByStrength(SaslMechanismInformation.Names.DIGEST_MD5, tokensToChooseFrom)) { // take the strongest cipher for (String c: demandedCiphers) { if (c.equals(ts.getToken())) { return ts.getToken(); } } } throw saslDigest.mechNoCommonCipher().toSaslException(); }