All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.java.truecommons.key.disable.DisableAesPbeKeyManagerMapModifier Maven / Gradle / Ivy

Go to download

Putting this module on the class path effectively disables any key management, regardless of any other KeyManager module which may be present on the class path.

There is a newer version: 2.5.0
Show newest version
/*
 * Copyright (C) 2005-2012 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package net.java.truecommons.key.disable;

import java.util.Map;
import javax.annotation.concurrent.Immutable;
import net.java.truecommons.annotations.ServiceImplementation;
import net.java.truecommons.key.spec.KeyManager;
import net.java.truecommons.key.spec.common.AesPbeParameters;
import net.java.truecommons.key.spec.spi.KeyManagerMapModifier;
import net.java.truecommons.key.spec.unknown.UnknownKeyManager;

/**
 * This modifier maps the {@link AesPbeParameters} class to the
 * {@linkplain UnknownKeyManager#SINGLETON unknown key manager} singleton
 * which fails to resolve any keys.
 * Note that the {@link #getPriority} of this modifier is
 * {@link Integer#MAX_VALUE}, so it takes precedence over any other modifier
 * on the class path.
 *
 * @since  TrueCommons 2.2
 * @author Christian Schlichtherle
 */
@Immutable
@ServiceImplementation
public final class DisableAesPbeKeyManagerMapModifier
extends KeyManagerMapModifier {

    @Override
    public Map, KeyManager> apply(final Map, KeyManager> map) {
        map.put(AesPbeParameters.class, UnknownKeyManager.SINGLETON);
        return map;
    }

    /** @return {@link Integer#MAX_VALUE} */
    @Override
    public int getPriority() { return Integer.MAX_VALUE; }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy