sun.security.util.AlgorithmDecomposer Java Examples

The following examples show how to use sun.security.util.AlgorithmDecomposer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DecomposeAlgorithms.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    AlgorithmDecomposer decomposer = new AlgorithmDecomposer();

    check(decomposer, "AES/CBC/NoPadding", new String[] {
            "AES", "CBC", "NoPadding"});
    check(decomposer, "DES/CBC/PKCS5Padding", new String[] {
            "DES", "CBC", "PKCS5Padding"});
    check(decomposer, "RSA/ECB/OAEPWithSHA-1AndMGF1Padding", new String[] {
            "RSA", "ECB", "OAEP", "SHA1", "SHA-1", "MGF1Padding"});
    check(decomposer, "OAEPWithSHA-512AndMGF1Padding", new String[] {
            "OAEP", "SHA512", "SHA-512", "MGF1Padding"});
    check(decomposer, "OAEPWithSHA-512AndMGF1Padding", new String[] {
            "OAEP", "SHA512", "SHA-512", "MGF1Padding"});
    check(decomposer, "PBEWithSHA1AndRC2_40", new String[] {
            "PBE", "SHA1", "SHA-1", "RC2_40"});
    check(decomposer, "PBEWithHmacSHA224AndAES_128", new String[] {
            "PBE", "HmacSHA224", "AES_128"});
}
 
Example #2
Source File: DecomposeAlgorithms.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void check(AlgorithmDecomposer parser,
        String fullAlgName, String[] components) throws Exception {

    Set<String> parsed = parser.decompose(fullAlgName);
    if (parsed.size() != components.length) {
        throw new Exception("Not expected components number: " + parsed);
    }

    for (String component : components) {
        if (!parsed.contains(component)) {
            throw new Exception("Not a expected component: " + component);
        }
    }

    System.out.println("OK: " + fullAlgName);
}