
com.github.ncredinburgh.tomcat.encryption.CipherSpecParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tomcat-external-propertysource Show documentation
Show all versions of tomcat-external-propertysource Show documentation
A Tomcat PropertySource class that reads provides property values from an external file.
package com.github.ncredinburgh.tomcat.encryption;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CipherSpecParser {
private static final Pattern PATTERN = Pattern.compile("^(.*)/(.*)/(.*)$");
private final Matcher matcher;
public CipherSpecParser(String cipherSpec) {
if (cipherSpec == null) {
throw new NullPointerException();
}
matcher = PATTERN.matcher(cipherSpec);
if (!matcher.matches()) {
throw new IllegalArgumentException("Malformed cipher spec: " + cipherSpec);
}
}
public String getAlgorithmName() {
return matcher.group(1);
}
public String getMode() {
return matcher.group(2);
}
public String getPadding() {
return matcher.group(3);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy