javax.crypto

Class ExemptionMechanism


  • public class ExemptionMechanism
    extends Object
    This class provides the functionality of an exemption mechanism, examples of which are key recovery, key weakening, and key escrow.

    Applications or applets that use an exemption mechanism may be granted stronger encryption capabilities than those which don't.

    Since:
    1.4
    • Constructor Detail

      • ExemptionMechanism

        protected ExemptionMechanism(ExemptionMechanismSpi exmechSpi,
                          Provider provider,
                          String mechanism)
        Creates a ExemptionMechanism object.
        Parameters:
        exmechSpi - the delegate
        provider - the provider
        mechanism - the exemption mechanism
    • Method Detail

      • getName

        public final String getName()
        Returns the exemption mechanism name of this ExemptionMechanism object.

        This is the same name that was specified in one of the getInstance calls that created this ExemptionMechanism object.

        Returns:
        the exemption mechanism name of this ExemptionMechanism object.
      • getInstance

        public static final ExemptionMechanism getInstance(String algorithm)
                                                    throws NoSuchAlgorithmException
        Returns an ExemptionMechanism object that implements the specified exemption mechanism algorithm.

        This method traverses the list of registered security Providers, starting with the most preferred Provider. A new ExemptionMechanism object encapsulating the ExemptionMechanismSpi implementation from the first Provider that supports the specified algorithm is returned.

        Note that the list of registered providers may be retrieved via the Security.getProviders() method.

        Parameters:
        algorithm - the standard name of the requested exemption mechanism. See the ExemptionMechanism section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard exemption mechanism names.
        Returns:
        the new ExemptionMechanism object.
        Throws:
        NullPointerException - if algorithm is null.
        NoSuchAlgorithmException - if no Provider supports an ExemptionMechanismSpi implementation for the specified algorithm.
        See Also:
        Provider
      • getInstance

        public static final ExemptionMechanism getInstance(String algorithm,
                                     Provider provider)
                                                    throws NoSuchAlgorithmException
        Returns an ExemptionMechanism object that implements the specified exemption mechanism algorithm.

        A new ExemptionMechanism object encapsulating the ExemptionMechanismSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.

        Parameters:
        algorithm - the standard name of the requested exemption mechanism. See the ExemptionMechanism section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard exemption mechanism names.
        provider - the provider.
        Returns:
        the new ExemptionMechanism object.
        Throws:
        NullPointerException - if algorithm is null.
        NoSuchAlgorithmException - if an ExemptionMechanismSpi implementation for the specified algorithm is not available from the specified Provider object.
        IllegalArgumentException - if the provider is null.
        See Also:
        Provider
      • getProvider

        public final Provider getProvider()
        Returns the provider of this ExemptionMechanism object.
        Returns:
        the provider of this ExemptionMechanism object.
      • isCryptoAllowed

        public final boolean isCryptoAllowed(Key key)
                                      throws ExemptionMechanismException
        Returns whether the result blob has been generated successfully by this exemption mechanism.

        The method also makes sure that the key passed in is the same as the one this exemption mechanism used in initializing and generating phases.

        Parameters:
        key - the key the crypto is going to use.
        Returns:
        whether the result blob of the same key has been generated successfully by this exemption mechanism; false if key is null.
        Throws:
        ExemptionMechanismException - if problem(s) encountered while determining whether the result blob has been generated successfully by this exemption mechanism object.
      • getOutputSize

        public final int getOutputSize(int inputLen)
                                throws IllegalStateException
        Returns the length in bytes that an output buffer would need to be in order to hold the result of the next genExemptionBlob operation, given the input length inputLen (in bytes).

        The actual output length of the next genExemptionBlob call may be smaller than the length returned by this method.

        Parameters:
        inputLen - the input length (in bytes)
        Returns:
        the required output buffer size (in bytes)
        Throws:
        IllegalStateException - if this exemption mechanism is in a wrong state (e.g., has not yet been initialized)
      • init

        public final void init(Key key)
                        throws InvalidKeyException,
                               ExemptionMechanismException
        Initializes this exemption mechanism with a key.

        If this exemption mechanism requires any algorithm parameters that cannot be derived from the given key, the underlying exemption mechanism implementation is supposed to generate the required parameters itself (using provider-specific default values); in the case that algorithm parameters must be specified by the caller, an InvalidKeyException is raised.

        Parameters:
        key - the key for this exemption mechanism
        Throws:
        InvalidKeyException - if the given key is inappropriate for this exemption mechanism.
        ExemptionMechanismException - if problem(s) encountered in the process of initializing.
      • init

        public final void init(Key key,
                AlgorithmParameterSpec params)
                        throws InvalidKeyException,
                               InvalidAlgorithmParameterException,
                               ExemptionMechanismException
        Initializes this exemption mechanism with a key and a set of algorithm parameters.

        If this exemption mechanism requires any algorithm parameters and params is null, the underlying exemption mechanism implementation is supposed to generate the required parameters itself (using provider-specific default values); in the case that algorithm parameters must be specified by the caller, an InvalidAlgorithmParameterException is raised.

        Parameters:
        key - the key for this exemption mechanism
        params - the algorithm parameters
        Throws:
        InvalidKeyException - if the given key is inappropriate for this exemption mechanism.
        InvalidAlgorithmParameterException - if the given algorithm parameters are inappropriate for this exemption mechanism.
        ExemptionMechanismException - if problem(s) encountered in the process of initializing.
      • init

        public final void init(Key key,
                AlgorithmParameters params)
                        throws InvalidKeyException,
                               InvalidAlgorithmParameterException,
                               ExemptionMechanismException
        Initializes this exemption mechanism with a key and a set of algorithm parameters.

        If this exemption mechanism requires any algorithm parameters and params is null, the underlying exemption mechanism implementation is supposed to generate the required parameters itself (using provider-specific default values); in the case that algorithm parameters must be specified by the caller, an InvalidAlgorithmParameterException is raised.

        Parameters:
        key - the key for this exemption mechanism
        params - the algorithm parameters
        Throws:
        InvalidKeyException - if the given key is inappropriate for this exemption mechanism.
        InvalidAlgorithmParameterException - if the given algorithm parameters are inappropriate for this exemption mechanism.
        ExemptionMechanismException - if problem(s) encountered in the process of initializing.
      • genExemptionBlob

        public final int genExemptionBlob(byte[] output)
                                   throws IllegalStateException,
                                          ShortBufferException,
                                          ExemptionMechanismException
        Generates the exemption mechanism key blob, and stores the result in the output buffer.

        If the output buffer is too small to hold the result, a ShortBufferException is thrown. In this case, repeat this call with a larger output buffer. Use getOutputSize to determine how big the output buffer should be.

        Parameters:
        output - the buffer for the result
        Returns:
        the number of bytes stored in output
        Throws:
        IllegalStateException - if this exemption mechanism is in a wrong state (e.g., has not been initialized).
        ShortBufferException - if the given output buffer is too small to hold the result.
        ExemptionMechanismException - if problem(s) encountered in the process of generating.
      • genExemptionBlob

        public final int genExemptionBlob(byte[] output,
                           int outputOffset)
                                   throws IllegalStateException,
                                          ShortBufferException,
                                          ExemptionMechanismException
        Generates the exemption mechanism key blob, and stores the result in the output buffer, starting at outputOffset inclusive.

        If the output buffer is too small to hold the result, a ShortBufferException is thrown. In this case, repeat this call with a larger output buffer. Use getOutputSize to determine how big the output buffer should be.

        Parameters:
        output - the buffer for the result
        outputOffset - the offset in output where the result is stored
        Returns:
        the number of bytes stored in output
        Throws:
        IllegalStateException - if this exemption mechanism is in a wrong state (e.g., has not been initialized).
        ShortBufferException - if the given output buffer is too small to hold the result.
        ExemptionMechanismException - if problem(s) encountered in the process of generating.
      • finalize

        protected void finalize()
        Ensures that the key stored away by this ExemptionMechanism object will be wiped out when there are no more references to it.
        Overrides:
        finalize in class Object

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/crypto/exemptionmechanism.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut