public DefaultTransformationMapper() { transformations.put("DIGEST-MD5", new TransformationSpec[] { // TODO: once digest-md5 PR will be merged change this to // JBOSS_DIGEST_MD5 new TransformationSpec("3des", "DESede/CBC/NoPadding", NO_KEY, HIGH_STRENGTH + 1, "SunJCA"), new TransformationSpec("rc4", "RC4", 128, HIGH_STRENGTH, "SunJCA"), new TransformationSpec("des", "DES/CBC/NoPadding", NO_KEY, MEDIUM_STRENGTH + 1, "SunJCA"), new TransformationSpec("rc4-56", "RC4", 56, MEDIUM_STRENGTH, "SunJCA"), new TransformationSpec("rc4-40", "RC4", 40, LOW_STRENGTH, "SunJCA") }); // sort all transformation arrays descending by strength for (String mech : transformations.keySet()) { Arrays.sort(transformations.get(mech), (o1, o2) -> { if (o1.getStrength() < o2.getStrength()) { return 1; } else if (o1.getStrength() > o2.getStrength()) { return -1; } else { return 0; } }); } }
@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()]); }
public DefaultTransformationMapper() { transformations.put("DIGEST-MD5", new TransformationSpec[] { // TODO: once digest-md5 PR will be merged change this to // JBOSS_DIGEST_MD5 new TransformationSpec("3des", "DESede/CBC/NoPadding", NO_KEY, HIGH_STRENGTH + 1, "SunJCA"), new TransformationSpec("rc4", "RC4", 128, HIGH_STRENGTH, "SunJCA"), new TransformationSpec("des", "DES/CBC/NoPadding", NO_KEY, MEDIUM_STRENGTH + 1, "SunJCA"), new TransformationSpec("rc4-56", "RC4", 56, MEDIUM_STRENGTH, "SunJCA"), new TransformationSpec("rc4-40", "RC4", 40, LOW_STRENGTH, "SunJCA") }); // sort all transformation arrays descending by strength for (String mech : transformations.keySet()) { Arrays.sort(transformations.get(mech), (o1, o2) -> { if (o1.getStrength() < o2.getStrength()) { return 1; } else if (o1.getStrength() > o2.getStrength()) { return -1; } else { return 0; } }); } }
public DefaultTransformationMapper() { transformations.put("DIGEST-MD5", new TransformationSpec[] { // TODO: once digest-md5 PR will be merged change this to // JBOSS_DIGEST_MD5 new TransformationSpec("3des", "DESede/CBC/NoPadding", NO_KEY, HIGH_STRENGTH + 1, "SunJCA"), new TransformationSpec("rc4", "RC4", 128, HIGH_STRENGTH, "SunJCA"), new TransformationSpec("des", "DES/CBC/NoPadding", NO_KEY, MEDIUM_STRENGTH + 1, "SunJCA"), new TransformationSpec("rc4-56", "RC4", 56, MEDIUM_STRENGTH, "SunJCA"), new TransformationSpec("rc4-40", "RC4", 40, LOW_STRENGTH, "SunJCA") }); // sort all transformation arrays descending by strength for (String mech : transformations.keySet()) { Arrays.sort(transformations.get(mech), (o1, o2) -> { if (o1.getStrength() < o2.getStrength()) { return 1; } else if (o1.getStrength() > o2.getStrength()) { return -1; } else { return 0; } }); } }
public DefaultTransformationMapper() { transformations.put("DIGEST-MD5", new TransformationSpec[] { // TODO: once digest-md5 PR will be merged change this to // JBOSS_DIGEST_MD5 new TransformationSpec("3des", "DESede/CBC/NoPadding", NO_KEY, HIGH_STRENGTH + 1, "SunJCA"), new TransformationSpec("rc4", "RC4", 128, HIGH_STRENGTH, "SunJCA"), new TransformationSpec("des", "DES/CBC/NoPadding", NO_KEY, MEDIUM_STRENGTH + 1, "SunJCA"), new TransformationSpec("rc4-56", "RC4", 56, MEDIUM_STRENGTH, "SunJCA"), new TransformationSpec("rc4-40", "RC4", 40, LOW_STRENGTH, "SunJCA") }); // sort all transformation arrays descending by strength for (String mech : transformations.keySet()) { Arrays.sort(transformations.get(mech), (o1, o2) -> { if (o1.getStrength() < o2.getStrength()) { return 1; } else if (o1.getStrength() > o2.getStrength()) { return -1; } else { return 0; } }); } }
@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[] 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()]); }