/** * 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 getTransformationSpec(String mechanism, String token) throws IllegalArgumentException { return getTransformationSpec(null, mechanism, token); }
@Override public TransformationSpec[] getTransformationSpecByStrength(String mechanism, String... tokens) throws IllegalArgumentException { return getTransformationSpecByStrength(null, mechanism, tokens); }
@Override public TransformationSpec[] getTransformationSpecWithStrength(String mechanism, int strength, String... tokens) throws IllegalArgumentException { return getTransformationSpecWithStrength(null, mechanism, strength, tokens); }
@Override public TransformationSpec[] getTransformationSpecWithStrength(String mechanism, int strength, String... tokens) throws IllegalArgumentException { return getTransformationSpecWithStrength(null, mechanism, strength, tokens); }
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(); }
@Override public TransformationSpec[] getTransformationSpecByStrength(String mechanism, String... tokens) throws IllegalArgumentException { return getTransformationSpecByStrength(null, mechanism, tokens); }
@Override public TransformationSpec[] getTransformationSpecWithStrength(String mechanism, int strength, String... tokens) throws IllegalArgumentException { return getTransformationSpecWithStrength(null, mechanism, strength, tokens); }
@Override public TransformationSpec getTransformationSpec(String mechanism, String token) throws IllegalArgumentException { return getTransformationSpec(null, mechanism, token); }
TransformationMapper trans = new DefaultTransformationMapper(); Cipher ciph; byte[] cipherKeyBytes;
@Override public TransformationSpec[] getTransformationSpecByStrength(String mechanism, String... tokens) throws IllegalArgumentException { return getTransformationSpecByStrength(null, mechanism, tokens); }
@Override public TransformationSpec[] getTransformationSpecWithStrength(String mechanism, int strength, String... tokens) throws IllegalArgumentException { return getTransformationSpecWithStrength(null, mechanism, strength, tokens); }
@Override public TransformationSpec getTransformationSpec(String mechanism, String token) throws IllegalArgumentException { return getTransformationSpec(null, mechanism, token); }
/** * 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 mechanism, String... tokens) throws IllegalArgumentException { return getTransformationSpecByStrength(null, mechanism, tokens); }
@Override public TransformationSpec getTransformationSpec(String mechanism, String token) throws IllegalArgumentException { return getTransformationSpec(null, mechanism, token); }
/** * 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(); }
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(); }