mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8284851: Update javax.crypto files to use proper javadoc for mentioned classes
Reviewed-by: weijun, valeriep
This commit is contained in:
parent
8cdead0c94
commit
f804f2ce8e
92 changed files with 2142 additions and 2010 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -38,14 +38,14 @@ public class AEADBadTagException extends BadPaddingException {
|
|||
private static final long serialVersionUID = -488059093241685509L;
|
||||
|
||||
/**
|
||||
* Constructs a AEADBadTagException with no detail message.
|
||||
* Constructs an {@code AEADBadTagException} with no detail message.
|
||||
*/
|
||||
public AEADBadTagException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a AEADBadTagException with the specified
|
||||
* Constructs an {@code AEADBadTagException} with the specified
|
||||
* detail message.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -41,8 +41,8 @@ public class BadPaddingException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = -5315033893984728443L;
|
||||
|
||||
/**
|
||||
* Constructs a BadPaddingException with no detail
|
||||
* message. A detail message is a String that describes this
|
||||
* Constructs a {@code BadPaddingException} with no detail
|
||||
* message. A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*/
|
||||
public BadPaddingException() {
|
||||
|
@ -50,7 +50,7 @@ public class BadPaddingException extends GeneralSecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a BadPaddingException with the specified
|
||||
* Constructs a {@code BadPaddingException} with the specified
|
||||
* detail message.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -52,7 +52,7 @@ import sun.security.util.KnownOIDs;
|
|||
* encryption and decryption. It forms the core of the Java Cryptographic
|
||||
* Extension (JCE) framework.
|
||||
*
|
||||
* <p>In order to create a {code Cipher} object, the application calls the
|
||||
* <p>In order to create a {@code Cipher} object, the application calls the
|
||||
* cipher's {@code getInstance} method, and passes the name of the
|
||||
* requested <i>transformation</i> to it. Optionally, the name of a provider
|
||||
* may be specified.
|
||||
|
@ -141,8 +141,8 @@ import sun.security.util.KnownOIDs;
|
|||
* information on the ChaCha20 and ChaCha20-Poly1305 algorithms.
|
||||
* <p>
|
||||
* Every implementation of the Java platform is required to support
|
||||
* the following standard {@code Cipher} transformations with the keysizes
|
||||
* in parentheses:
|
||||
* the following standard {@code Cipher} object transformations with
|
||||
* the keysizes in parentheses:
|
||||
* <ul>
|
||||
* <li>{@code AES/CBC/NoPadding} (128)</li>
|
||||
* <li>{@code AES/CBC/PKCS5Padding} (128)</li>
|
||||
|
@ -258,14 +258,14 @@ public class Cipher {
|
|||
private final Object lock;
|
||||
|
||||
/**
|
||||
* Creates a {code Cipher} object.
|
||||
* Creates a {@code Cipher} object.
|
||||
*
|
||||
* @param cipherSpi the delegate
|
||||
* @param provider the provider
|
||||
* @param transformation the transformation
|
||||
* @throws NullPointerException if {@code provider} is {@code null}
|
||||
* @throws IllegalArgumentException if the supplied arguments
|
||||
* are deemed invalid for constructing the {code Cipher} object
|
||||
* are deemed invalid for constructing the {@code Cipher} object
|
||||
*/
|
||||
protected Cipher(CipherSpi cipherSpi,
|
||||
Provider provider,
|
||||
|
@ -515,7 +515,8 @@ public class Cipher {
|
|||
* Java Security Standard Algorithm Names Specification</a>
|
||||
* for information about standard transformation names.
|
||||
*
|
||||
* @return a cipher that implements the requested transformation
|
||||
* @return a {@code Cipher} object that implements the requested
|
||||
* transformation
|
||||
*
|
||||
* @throws NoSuchAlgorithmException if {@code transformation}
|
||||
* is {@code null}, empty, in an invalid format,
|
||||
|
@ -606,7 +607,8 @@ public class Cipher {
|
|||
*
|
||||
* @param provider the name of the provider
|
||||
*
|
||||
* @return a cipher that implements the requested transformation
|
||||
* @return a {@code Cipher} object that implements the requested
|
||||
* transformation
|
||||
*
|
||||
* @throws IllegalArgumentException if the {@code provider}
|
||||
* is {@code null} or empty
|
||||
|
@ -677,7 +679,8 @@ public class Cipher {
|
|||
*
|
||||
* @param provider the provider
|
||||
*
|
||||
* @return a cipher that implements the requested transformation
|
||||
* @return a {@code Cipher} object that implements the requested
|
||||
* transformation
|
||||
*
|
||||
* @throws IllegalArgumentException if the {@code provider}
|
||||
* is {@code null}
|
||||
|
@ -1014,8 +1017,8 @@ public class Cipher {
|
|||
*
|
||||
* @return the required output buffer size (in bytes)
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not yet been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object is in a
|
||||
* wrong state (e.g., has not yet been initialized)
|
||||
*/
|
||||
public final int getOutputSize(int inputLen) {
|
||||
|
||||
|
@ -1047,7 +1050,7 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the parameters used with this cipher.
|
||||
* Returns the parameters used with this {@code Cipher} object.
|
||||
*
|
||||
* <p>The returned parameters may be the same that were used to initialize
|
||||
* this cipher, or may contain additional default or random parameter
|
||||
|
@ -1063,10 +1066,12 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the exemption mechanism object used with this cipher.
|
||||
* Returns the exemption mechanism object used with this {@code Cipher}
|
||||
* object.
|
||||
*
|
||||
* @return the exemption mechanism object used with this cipher, or
|
||||
* {@code null} if this cipher does not use any exemption mechanism.
|
||||
* @return the exemption mechanism object used with this {@code Cipher}
|
||||
* object, or {@code null} if this {@code Cipher} object does not use any
|
||||
* exemption mechanism.
|
||||
*/
|
||||
public final ExemptionMechanism getExemptionMechanism() {
|
||||
chooseFirstProvider();
|
||||
|
@ -1183,9 +1188,10 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this cipher with a key.
|
||||
* Initializes this {@code Cipher} object with a key.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* <p>The {@code Cipher} object is initialized for one of the following four
|
||||
* operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending
|
||||
* on the value of {@code opmode}.
|
||||
*
|
||||
|
@ -1214,12 +1220,12 @@ public class Cipher {
|
|||
* SecureRandom, a system-provided source of randomness will be used.)
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* previously-acquired state. In other words, initializing a {@code Cipher}
|
||||
* object is equivalent to creating a new instance of that {@code Cipher}
|
||||
* object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of
|
||||
* the following:
|
||||
* @param opmode the operation mode of this {@code Cipher} object
|
||||
* (this is one of the following:
|
||||
* {@code ENCRYPT_MODE}, {@code DECRYPT_MODE},
|
||||
* {@code WRAP_MODE} or {@code UNWRAP_MODE})
|
||||
* @param key the key
|
||||
|
@ -1239,9 +1245,11 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this cipher with a key and a source of randomness.
|
||||
* Initializes this {@code Cipher} object with a key and a
|
||||
* source of randomness.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* <p>The {@code Cipher} object is initialized for one of the following four
|
||||
* operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending
|
||||
* on the value of {@code opmode}.
|
||||
*
|
||||
|
@ -1266,12 +1274,12 @@ public class Cipher {
|
|||
* them from {@code random}.
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* previously-acquired state. In other words, initializing a {@code Cipher}
|
||||
* object is equivalent to creating a new instance of that
|
||||
* {@code Cipher} object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of the
|
||||
* following:
|
||||
* @param opmode the operation mode of this {@code Cipher} object
|
||||
* (this is one of the following:
|
||||
* {@code ENCRYPT_MODE}, {@code DECRYPT_MODE},
|
||||
* {@code WRAP_MODE} or {@code UNWRAP_MODE})
|
||||
* @param key the encryption key
|
||||
|
@ -1314,10 +1322,11 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this cipher with a key and a set of algorithm
|
||||
* Initializes this {@code Cipher} object with a key and a set of algorithm
|
||||
* parameters.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* <p>The {@code Cipher} object is initialized for one of the following four
|
||||
* operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending
|
||||
* on the value of {@code opmode}.
|
||||
*
|
||||
|
@ -1346,12 +1355,12 @@ public class Cipher {
|
|||
* SecureRandom, a system-provided source of randomness will be used.)
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* previously-acquired state. In other words, initializing a {@code Cipher}
|
||||
* object is equivalent to creating a new instance of that {@code Cipher}
|
||||
* object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of the
|
||||
* following:
|
||||
* @param opmode the operation mode of this {@code Cipher} object
|
||||
* (this is one of the following:
|
||||
* {@code ENCRYPT_MODE}, {@code DECRYPT_MODE},
|
||||
* {@code WRAP_MODE} or {@code UNWRAP_MODE})
|
||||
* @param key the encryption key
|
||||
|
@ -1378,10 +1387,11 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this cipher with a key, a set of algorithm
|
||||
* Initializes this {@code Cipher} object with a key, a set of algorithm
|
||||
* parameters, and a source of randomness.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* <p>The {@code Cipher} object is initialized for one of the following four
|
||||
* operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending
|
||||
* on the value of {@code opmode}.
|
||||
*
|
||||
|
@ -1406,12 +1416,12 @@ public class Cipher {
|
|||
* them from {@code random}.
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* previously-acquired state. In other words, initializing a {@code Cipher}
|
||||
* object is equivalent to creating a new instance of that {@code Cipher}
|
||||
* object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of the
|
||||
* following:
|
||||
* @param opmode the operation mode of this {@code Cipher} object
|
||||
* (this is one of the following:
|
||||
* {@code ENCRYPT_MODE}, {@code DECRYPT_MODE},
|
||||
* {@code WRAP_MODE} or {@code UNWRAP_MODE})
|
||||
* @param key the encryption key
|
||||
|
@ -1455,10 +1465,11 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this cipher with a key and a set of algorithm
|
||||
* Initializes this {@code Cipher} object with a key and a set of algorithm
|
||||
* parameters.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* <p>The {@code Cipher} object is initialized for one of the following four
|
||||
* operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending
|
||||
* on the value of {@code opmode}.
|
||||
*
|
||||
|
@ -1487,12 +1498,12 @@ public class Cipher {
|
|||
* SecureRandom, a system-provided source of randomness will be used.)
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* previously-acquired state. In other words, initializing a {@code Cipher}
|
||||
* object is equivalent to creating a new instance of that {@code Cipher}
|
||||
* object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of the
|
||||
* following: {@code ENCRYPT_MODE},
|
||||
* @param opmode the operation mode of this {@code Cipher} object
|
||||
* this is one of the following: {@code ENCRYPT_MODE},
|
||||
* {@code DECRYPT_MODE}, {@code WRAP_MODE}
|
||||
* or {@code UNWRAP_MODE})
|
||||
* @param key the encryption key
|
||||
|
@ -1519,10 +1530,11 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this cipher with a key, a set of algorithm
|
||||
* Initializes this {@code Cipher} object with a key, a set of algorithm
|
||||
* parameters, and a source of randomness.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* <p>The {@code Cipher} object is initialized for one of the following four
|
||||
* operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending
|
||||
* on the value of {@code opmode}.
|
||||
*
|
||||
|
@ -1547,12 +1559,12 @@ public class Cipher {
|
|||
* them from {@code random}.
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* previously-acquired state. In other words, initializing a {@code Cipher}
|
||||
* object is equivalent to creating a new instance of that {@code Cipher}
|
||||
* object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of the
|
||||
* following: {@code ENCRYPT_MODE},
|
||||
* @param opmode the operation mode of this {@code Cipher} object
|
||||
* (this is one of the following: {@code ENCRYPT_MODE},
|
||||
* {@code DECRYPT_MODE}, {@code WRAP_MODE}
|
||||
* or {@code UNWRAP_MODE})
|
||||
* @param key the encryption key
|
||||
|
@ -1596,8 +1608,10 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this cipher with the public key from the given certificate.
|
||||
* <p> The cipher is initialized for one of the following four operations:
|
||||
* Initializes this {@code Cipher} object with the public key from the given
|
||||
* certificate.
|
||||
* <p> The {@code Cipher} object is initialized for one of the following
|
||||
* four operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending
|
||||
* on the value of {@code opmode}.
|
||||
*
|
||||
|
@ -1637,12 +1651,12 @@ public class Cipher {
|
|||
* SecureRandom, a system-provided source of randomness will be used.)
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* previously-acquired state. In other words, initializing a {@code Cipher}
|
||||
* object is equivalent to creating a new instance of that {@code Cipher}
|
||||
* object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of the
|
||||
* following:
|
||||
* @param opmode the operation mode of this {@code Cipher} object
|
||||
* (this is one of the following:
|
||||
* {@code ENCRYPT_MODE}, {@code DECRYPT_MODE},
|
||||
* {@code WRAP_MODE} or {@code UNWRAP_MODE})
|
||||
* @param certificate the certificate
|
||||
|
@ -1665,11 +1679,11 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes this cipher with the public key from the given certificate
|
||||
* and a source of randomness.
|
||||
* Initializes this {@code Cipher} object with the public key from the given
|
||||
* certificate and a source of randomness.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* encryption, decryption, key wrapping
|
||||
* <p>The {@code Cipher} object is initialized for one of the following four
|
||||
* operations: encryption, decryption, key wrapping
|
||||
* or key unwrapping, depending on
|
||||
* the value of {@code opmode}.
|
||||
*
|
||||
|
@ -1704,12 +1718,12 @@ public class Cipher {
|
|||
* them from {@code random}.
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* previously-acquired state. In other words, initializing a {@code Cipher}
|
||||
* object is equivalent to creating a new instance of that {@code Cipher}
|
||||
* object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of the
|
||||
* following:
|
||||
* @param opmode the operation mode of this {@code Cipher} object
|
||||
* (this is one of the following:
|
||||
* {@code ENCRYPT_MODE}, {@code DECRYPT_MODE},
|
||||
* {@code WRAP_MODE} or {@code UNWRAP_MODE})
|
||||
* @param certificate the certificate
|
||||
|
@ -1782,9 +1796,11 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Ensures that cipher is in a valid state for update() and doFinal()
|
||||
* calls - should be initialized and in ENCRYPT_MODE or DECRYPT_MODE.
|
||||
* @throws IllegalStateException if this cipher is not in valid state
|
||||
* Ensures that {@code Cipher} object is in a valid state for update() and
|
||||
* doFinal() calls - should be initialized and in ENCRYPT_MODE or
|
||||
* DECRYPT_MODE.
|
||||
* @throws IllegalStateException if this {@code Cipher} object is not in
|
||||
* valid state
|
||||
*/
|
||||
private void checkCipherState() {
|
||||
if (!(this instanceof NullCipher)) {
|
||||
|
@ -1801,8 +1817,8 @@ public class Cipher {
|
|||
|
||||
/**
|
||||
* Continues a multiple-part encryption or decryption operation
|
||||
* (depending on how this cipher was initialized), processing another data
|
||||
* part.
|
||||
* (depending on how this {@code Cipher} object was initialized),
|
||||
* processing another data part.
|
||||
*
|
||||
* <p>The bytes in the {@code input} buffer are processed, and the
|
||||
* result is stored in a new buffer.
|
||||
|
@ -1816,8 +1832,8 @@ public class Cipher {
|
|||
* cipher is a block cipher and the input data is too short to result in a
|
||||
* new block
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object is in a
|
||||
* wrong state (e.g., has not been initialized)
|
||||
*/
|
||||
public final byte[] update(byte[] input) {
|
||||
checkCipherState();
|
||||
|
@ -1836,8 +1852,8 @@ public class Cipher {
|
|||
|
||||
/**
|
||||
* Continues a multiple-part encryption or decryption operation
|
||||
* (depending on how this cipher was initialized), processing another data
|
||||
* part.
|
||||
* (depending on how this {@code Cipher} object was initialized),
|
||||
* processing another data part.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, are processed,
|
||||
|
@ -1851,12 +1867,12 @@ public class Cipher {
|
|||
* starts
|
||||
* @param inputLen the input length
|
||||
*
|
||||
* @return the new buffer with the result, or null if this
|
||||
* @return the new buffer with the result, or {@code null} if this
|
||||
* cipher is a block cipher and the input data is too short to result in a
|
||||
* new block.
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
*/
|
||||
public final byte[] update(byte[] input, int inputOffset, int inputLen) {
|
||||
checkCipherState();
|
||||
|
@ -1876,8 +1892,8 @@ public class Cipher {
|
|||
|
||||
/**
|
||||
* Continues a multiple-part encryption or decryption operation
|
||||
* (depending on how this cipher was initialized), processing another data
|
||||
* part.
|
||||
* (depending on how this {@code Cipher} object was initialized),
|
||||
* processing another data part.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, are processed,
|
||||
|
@ -1905,8 +1921,8 @@ public class Cipher {
|
|||
*
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws ShortBufferException if the given output buffer is too small
|
||||
* to hold the result
|
||||
*/
|
||||
|
@ -1931,8 +1947,8 @@ public class Cipher {
|
|||
|
||||
/**
|
||||
* Continues a multiple-part encryption or decryption operation
|
||||
* (depending on how this cipher was initialized), processing another data
|
||||
* part.
|
||||
* (depending on how this {@code Cipher} object was initialized),
|
||||
* processing another data part.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, are processed,
|
||||
|
@ -1963,8 +1979,8 @@ public class Cipher {
|
|||
*
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws ShortBufferException if the given output buffer is too small
|
||||
* to hold the result
|
||||
*/
|
||||
|
@ -1990,8 +2006,8 @@ public class Cipher {
|
|||
|
||||
/**
|
||||
* Continues a multiple-part encryption or decryption operation
|
||||
* (depending on how this cipher was initialized), processing another data
|
||||
* part.
|
||||
* (depending on how this {@code Cipher} object was initialized),
|
||||
* processing another data part.
|
||||
*
|
||||
* <p>All {@code input.remaining()} bytes starting at
|
||||
* {@code input.position()} are processed. The result is stored
|
||||
|
@ -2017,8 +2033,8 @@ public class Cipher {
|
|||
*
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws IllegalArgumentException if input and output are the
|
||||
* same object
|
||||
* @throws ReadOnlyBufferException if the output buffer is read-only
|
||||
|
@ -2047,7 +2063,7 @@ public class Cipher {
|
|||
|
||||
/**
|
||||
* Finishes a multiple-part encryption or decryption operation, depending
|
||||
* on how this cipher was initialized.
|
||||
* on how this {@code Cipher} object was initialized.
|
||||
*
|
||||
* <p>Input data that may have been buffered during a previous
|
||||
* {@code update} operation is processed, with padding (if requested)
|
||||
|
@ -2057,29 +2073,30 @@ public class Cipher {
|
|||
* case of decryption.
|
||||
* The result is stored in a new buffer.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to {@code init}.
|
||||
* <p>Upon finishing, this method resets this {@code Cipher} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code init}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code init}) more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code Cipher} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* @return the new buffer with the result
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws IllegalBlockSizeException if this cipher is a block cipher,
|
||||
* no padding has been requested (only in encryption mode), and the total
|
||||
* input length of the data processed by this cipher is not a multiple of
|
||||
* block size; or if this encryption algorithm is unable to
|
||||
* process the input data provided.
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* @throws BadPaddingException if this {@code Cipher} object is in
|
||||
* decryption mode, and (un)padding has been requested, but the decrypted
|
||||
* data is not bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this {@code Cipher} object is decrypting
|
||||
* in an AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
*/
|
||||
public final byte[] doFinal()
|
||||
|
@ -2092,7 +2109,7 @@ public class Cipher {
|
|||
|
||||
/**
|
||||
* Finishes a multiple-part encryption or decryption operation, depending
|
||||
* on how this cipher was initialized.
|
||||
* on how this {@code Cipher} object was initialized.
|
||||
*
|
||||
* <p>Input data that may have been buffered during a previous
|
||||
* {@code update} operation is processed, with padding (if requested)
|
||||
|
@ -2109,14 +2126,15 @@ public class Cipher {
|
|||
* {@link #getOutputSize(int) getOutputSize} to determine how big
|
||||
* the output buffer should be.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to {@code init}.
|
||||
* <p>Upon finishing, this method resets this {@code Cipher} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code init}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code init}) more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code Cipher} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* @param output the buffer for the result
|
||||
* @param outputOffset the offset in {@code output} where the result
|
||||
|
@ -2124,8 +2142,8 @@ public class Cipher {
|
|||
*
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws IllegalBlockSizeException if this cipher is a block cipher,
|
||||
* no padding has been requested (only in encryption mode), and the total
|
||||
* input length of the data processed by this cipher is not a multiple of
|
||||
|
@ -2133,11 +2151,11 @@ public class Cipher {
|
|||
* process the input data provided.
|
||||
* @throws ShortBufferException if the given output buffer is too small
|
||||
* to hold the result
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* @throws BadPaddingException if this {@code Cipher} object is in
|
||||
* decryption mode, and (un)padding has been requested, but the
|
||||
* decrypted data is not bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this {@code Cipher} object is decrypting
|
||||
* in an AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
*/
|
||||
public final int doFinal(byte[] output, int outputOffset)
|
||||
|
@ -2157,7 +2175,7 @@ public class Cipher {
|
|||
/**
|
||||
* Encrypts or decrypts data in a single-part operation, or finishes a
|
||||
* multiple-part operation. The data is encrypted or decrypted,
|
||||
* depending on how this cipher was initialized.
|
||||
* depending on how this {@code Cipher} object was initialized.
|
||||
*
|
||||
* <p>The bytes in the {@code input} buffer, and any input bytes that
|
||||
* may have been buffered during a previous {@code update} operation,
|
||||
|
@ -2167,31 +2185,32 @@ public class Cipher {
|
|||
* case of decryption.
|
||||
* The result is stored in a new buffer.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to {@code init}.
|
||||
* <p>Upon finishing, this method resets this {@code Cipher} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code init}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code init}) more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code Cipher} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* @param input the input buffer
|
||||
*
|
||||
* @return the new buffer with the result
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws IllegalBlockSizeException if this cipher is a block cipher,
|
||||
* no padding has been requested (only in encryption mode), and the total
|
||||
* input length of the data processed by this cipher is not a multiple of
|
||||
* block size; or if this encryption algorithm is unable to
|
||||
* process the input data provided.
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* @throws BadPaddingException if this {@code Cipher} object is in
|
||||
* decryption mode, and (un)padding has been requested, but the
|
||||
* decrypted data is not bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this {@code Cipher} object is decrypting
|
||||
* in an AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
*/
|
||||
public final byte[] doFinal(byte[] input)
|
||||
|
@ -2210,7 +2229,7 @@ public class Cipher {
|
|||
/**
|
||||
* Encrypts or decrypts data in a single-part operation, or finishes a
|
||||
* multiple-part operation. The data is encrypted or decrypted,
|
||||
* depending on how this cipher was initialized.
|
||||
* depending on how this {@code Cipher} object was initialized.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, and any input
|
||||
|
@ -2221,14 +2240,15 @@ public class Cipher {
|
|||
* case of decryption.
|
||||
* The result is stored in a new buffer.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to {@code init}.
|
||||
* <p>Upon finishing, this method resets this {@code Cipher} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code init}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code init}) more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code Cipher} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* @param input the input buffer
|
||||
* @param inputOffset the offset in {@code input} where the input
|
||||
|
@ -2237,18 +2257,18 @@ public class Cipher {
|
|||
*
|
||||
* @return the new buffer with the result
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws IllegalBlockSizeException if this cipher is a block cipher,
|
||||
* no padding has been requested (only in encryption mode), and the total
|
||||
* input length of the data processed by this cipher is not a multiple of
|
||||
* block size; or if this encryption algorithm is unable to
|
||||
* process the input data provided.
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* @throws BadPaddingException if this {@code Cipher} object is in
|
||||
* decryption mode, and (un)padding has been requested, but the decrypted
|
||||
* data is not bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this {@code Cipher} object is decrypting
|
||||
* in an AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
*/
|
||||
public final byte[] doFinal(byte[] input, int inputOffset, int inputLen)
|
||||
|
@ -2268,7 +2288,7 @@ public class Cipher {
|
|||
/**
|
||||
* Encrypts or decrypts data in a single-part operation, or finishes a
|
||||
* multiple-part operation. The data is encrypted or decrypted,
|
||||
* depending on how this cipher was initialized.
|
||||
* depending on how this {@code Cipher} object was initialized.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, and any input
|
||||
|
@ -2285,14 +2305,15 @@ public class Cipher {
|
|||
* {@link #getOutputSize(int) getOutputSize} to determine how big
|
||||
* the output buffer should be.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to {@code init}.
|
||||
* <p>Upon finishing, this method resets this {@code Cipher} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code init}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code init}) more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code Cipher} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* <p>Note: this method should be copy-safe, which means the
|
||||
* {@code input} and {@code output} buffers can reference
|
||||
|
@ -2307,8 +2328,8 @@ public class Cipher {
|
|||
*
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws IllegalBlockSizeException if this cipher is a block cipher,
|
||||
* no padding has been requested (only in encryption mode), and the total
|
||||
* input length of the data processed by this cipher is not a multiple of
|
||||
|
@ -2316,11 +2337,11 @@ public class Cipher {
|
|||
* process the input data provided.
|
||||
* @throws ShortBufferException if the given output buffer is too small
|
||||
* to hold the result
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* @throws BadPaddingException if this {@code Cipher} object is in
|
||||
* decryption mode, and (un)padding has been requested, but the decrypted
|
||||
* data is not bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this {@code Cipher} object is decrypting
|
||||
* in an AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
*/
|
||||
public final int doFinal(byte[] input, int inputOffset, int inputLen,
|
||||
|
@ -2343,7 +2364,7 @@ public class Cipher {
|
|||
/**
|
||||
* Encrypts or decrypts data in a single-part operation, or finishes a
|
||||
* multiple-part operation. The data is encrypted or decrypted,
|
||||
* depending on how this cipher was initialized.
|
||||
* depending on how this {@code Cipher} object was initialized.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, and any input
|
||||
|
@ -2362,14 +2383,15 @@ public class Cipher {
|
|||
* {@link #getOutputSize(int) getOutputSize} to determine how big
|
||||
* the output buffer should be.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to {@code init}.
|
||||
* <p>Upon finishing, this method resets this {@code Cipher} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code init}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code init}) more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code Cipher} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* <p>Note: this method should be copy-safe, which means the
|
||||
* {@code input} and {@code output} buffers can reference
|
||||
|
@ -2386,8 +2408,8 @@ public class Cipher {
|
|||
*
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws IllegalBlockSizeException if this cipher is a block cipher,
|
||||
* no padding has been requested (only in encryption mode), and the total
|
||||
* input length of the data processed by this cipher is not a multiple of
|
||||
|
@ -2395,11 +2417,11 @@ public class Cipher {
|
|||
* process the input data provided.
|
||||
* @throws ShortBufferException if the given output buffer is too small
|
||||
* to hold the result
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* @throws BadPaddingException if this {@code Cipher} object is in
|
||||
* decryption mode, and (un)padding has been requested, but the decrypted
|
||||
* data is not bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this {@code Cipher} object is decrypting
|
||||
* in an AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
*/
|
||||
public final int doFinal(byte[] input, int inputOffset, int inputLen,
|
||||
|
@ -2423,7 +2445,7 @@ public class Cipher {
|
|||
/**
|
||||
* Encrypts or decrypts data in a single-part operation, or finishes a
|
||||
* multiple-part operation. The data is encrypted or decrypted,
|
||||
* depending on how this cipher was initialized.
|
||||
* depending on how this {@code Cipher} object was initialized.
|
||||
*
|
||||
* <p>All {@code input.remaining()} bytes starting at
|
||||
* {@code input.position()} are processed.
|
||||
|
@ -2442,14 +2464,15 @@ public class Cipher {
|
|||
* {@link #getOutputSize(int) getOutputSize} to determine how big
|
||||
* the output buffer should be.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to {@code init}.
|
||||
* <p>Upon finishing, this method resets this {@code Cipher} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code init}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code init}) more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code Cipher} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* <p>Note: this method should be copy-safe, which means the
|
||||
* {@code input} and {@code output} buffers can reference
|
||||
|
@ -2461,8 +2484,8 @@ public class Cipher {
|
|||
*
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
* @throws IllegalArgumentException if input and output are the
|
||||
* same object
|
||||
* @throws ReadOnlyBufferException if the output buffer is read-only
|
||||
|
@ -2473,11 +2496,11 @@ public class Cipher {
|
|||
* process the input data provided.
|
||||
* @throws ShortBufferException if there is insufficient space in the
|
||||
* output buffer
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* @throws BadPaddingException if this {@code Cipher} object is in
|
||||
* decryption mode, and (un)padding has been requested, but the
|
||||
* decrypted data is not bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this {@code Cipher} object is decrypting
|
||||
* in an AEAD mode (such as GCM/CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
*
|
||||
* @since 1.5
|
||||
|
@ -2509,7 +2532,7 @@ public class Cipher {
|
|||
*
|
||||
* @return the wrapped key
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong
|
||||
* @throws IllegalStateException if this {@code Cipher} object is in a wrong
|
||||
* state (e.g., has not been initialized)
|
||||
*
|
||||
* @throws IllegalBlockSizeException if this cipher is a block
|
||||
|
@ -2554,8 +2577,8 @@ public class Cipher {
|
|||
*
|
||||
* @return the unwrapped key
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized)
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized)
|
||||
*
|
||||
* @throws NoSuchAlgorithmException if no installed providers
|
||||
* can create keys of type {@code wrappedKeyType} for the
|
||||
|
@ -2654,7 +2677,7 @@ public class Cipher {
|
|||
|
||||
/**
|
||||
* Returns an {code AlgorithmParameterSpec} object which contains
|
||||
* the maximum cipher parameter value according to the
|
||||
* the maximum {@code Cipher} parameter value according to the
|
||||
* jurisdiction policy file. If JCE unlimited strength jurisdiction
|
||||
* policy files are installed or there is no maximum limit on the
|
||||
* parameters for the specified transformation in the policy file,
|
||||
|
@ -2680,20 +2703,20 @@ public class Cipher {
|
|||
* Continues a multi-part update of the Additional Authentication
|
||||
* Data (AAD).
|
||||
* <p>
|
||||
* Calls to this method provide AAD to the cipher when operating in
|
||||
* modes such as AEAD (GCM/CCM). If this cipher is operating in
|
||||
* either GCM or CCM mode, all AAD must be supplied before beginning
|
||||
* operations on the ciphertext (via the {@code update} and
|
||||
* {@code doFinal} methods).
|
||||
* Calls to this method provide AAD to the {@code Cipher} object
|
||||
* when operating in modes such as AEAD (GCM/CCM). If this
|
||||
* {@code Cipher} object is operating in either GCM or CCM mode, all AAD
|
||||
* must be supplied before beginning operations on the ciphertext
|
||||
* (via the {@code update} and {@code doFinal} methods).
|
||||
*
|
||||
* @param src the buffer containing the Additional Authentication Data
|
||||
*
|
||||
* @throws IllegalArgumentException if the {@code src}
|
||||
* byte array is {@code null}
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized), does not accept AAD, or if
|
||||
* operating in either GCM or CCM mode and one of the {@code update}
|
||||
* methods has already been called for the active
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized),
|
||||
* does not accept AAD, or if operating in either GCM or CCM mode and
|
||||
* one of the {@code update} methods has already been called for the active
|
||||
* encryption/decryption operation
|
||||
* @throws UnsupportedOperationException if the corresponding method
|
||||
* in the {@code CipherSpi} has not been overridden by an
|
||||
|
@ -2713,11 +2736,11 @@ public class Cipher {
|
|||
* Continues a multi-part update of the Additional Authentication
|
||||
* Data (AAD), using a subset of the provided buffer.
|
||||
* <p>
|
||||
* Calls to this method provide AAD to the cipher when operating in
|
||||
* modes such as AEAD (GCM/CCM). If this cipher is operating in
|
||||
* either GCM or CCM mode, all AAD must be supplied before beginning
|
||||
* operations on the ciphertext (via the {@code update}
|
||||
* and {@code doFinal} methods).
|
||||
* Calls to this method provide AAD to the {@code Cipher} object
|
||||
* when operating in modes such as AEAD (GCM/CCM). If this
|
||||
* {@code Cipher} object is operating in either GCM or CCM mode,
|
||||
* all AAD must be supplied before beginning operations on the
|
||||
* ciphertext (via the {@code update} and {@code doFinal} methods).
|
||||
*
|
||||
* @param src the buffer containing the AAD
|
||||
* @param offset the offset in {@code src} where the AAD input starts
|
||||
|
@ -2728,10 +2751,10 @@ public class Cipher {
|
|||
* is less than 0, or the sum of the {@code offset} and
|
||||
* {@code len} is greater than the length of the
|
||||
* {@code src} byte array
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized), does not accept AAD, or if
|
||||
* operating in either GCM or CCM mode and one of the {@code update}
|
||||
* methods has already been called for the active
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized),
|
||||
* does not accept AAD, or if operating in either GCM or CCM mode and
|
||||
* one of the {@code update} methods has already been called for the active
|
||||
* encryption/decryption operation
|
||||
* @throws UnsupportedOperationException if the corresponding method
|
||||
* in the {@code CipherSpi} has not been overridden by an
|
||||
|
@ -2759,11 +2782,11 @@ public class Cipher {
|
|||
* Continues a multi-part update of the Additional Authentication
|
||||
* Data (AAD).
|
||||
* <p>
|
||||
* Calls to this method provide AAD to the cipher when operating in
|
||||
* modes such as AEAD (GCM/CCM). If this cipher is operating in
|
||||
* either GCM or CCM mode, all AAD must be supplied before beginning
|
||||
* operations on the ciphertext (via the {@code update}
|
||||
* and {@code doFinal} methods).
|
||||
* Calls to this method provide AAD to the {@code Cipher} object
|
||||
* when operating in modes such as AEAD (GCM/CCM). If this
|
||||
* {@code Cipher} object is operating in either GCM or CCM mode, all AAD
|
||||
* must be supplied before beginning operations on the ciphertext
|
||||
* (via the {@code update} and {@code doFinal} methods).
|
||||
* <p>
|
||||
* All {@code src.remaining()} bytes starting at
|
||||
* {@code src.position()} are processed.
|
||||
|
@ -2774,10 +2797,10 @@ public class Cipher {
|
|||
*
|
||||
* @throws IllegalArgumentException if the {@code src ByteBuffer}
|
||||
* is {@code null}
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized), does not accept AAD, or if
|
||||
* operating in either GCM or CCM mode and one of the {@code update}
|
||||
* methods has already been called for the active
|
||||
* @throws IllegalStateException if this {@code Cipher} object
|
||||
* is in a wrong state (e.g., has not been initialized),
|
||||
* does not accept AAD, or if operating in either GCM or CCM mode and
|
||||
* one of the {@code update} methods has already been called for the active
|
||||
* encryption/decryption operation
|
||||
* @throws UnsupportedOperationException if the corresponding method
|
||||
* in the {@code CipherSpi} has not been overridden by an
|
||||
|
@ -2801,14 +2824,15 @@ public class Cipher {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of this cipher.
|
||||
* Returns a {@code String} representation of this {@code Cipher} object.
|
||||
*
|
||||
* @implNote
|
||||
* This implementation returns a String containing the transformation,
|
||||
* mode, and provider of this cipher.
|
||||
* The exact format of the String is unspecified and is subject to change.
|
||||
* This implementation returns a {@code String} containing the
|
||||
* transformation, mode, and provider of this {@code Cipher} object.
|
||||
* The exact format of the {@code String} is unspecified and is subject
|
||||
* to change.
|
||||
*
|
||||
* @return a String describing this cipher
|
||||
* @return a String describing this {@code Cipher} object
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -30,38 +30,40 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* A CipherInputStream is composed of an InputStream and a Cipher so
|
||||
* that read() methods return data that are read in from the
|
||||
* underlying InputStream but have been additionally processed by the
|
||||
* Cipher. The Cipher must be fully initialized before being used by
|
||||
* a CipherInputStream.
|
||||
* A {@code CipherInputStream} is composed of an {@code InputStream}
|
||||
* and a {@code Cipher} object so that read() methods return data that are
|
||||
* read in from the underlying {@code InputStream} but have been
|
||||
* additionally processed by the {@code Cipher} object. The {@code Cipher}
|
||||
* object must be fully initialized before being used by a
|
||||
* {@code CipherInputStream}.
|
||||
*
|
||||
* <p> For example, if the Cipher is initialized for decryption, the
|
||||
* CipherInputStream will attempt to read in data and decrypt them,
|
||||
* before returning the decrypted data.
|
||||
* <p> For example, if the {@code Cipher} object is initialized for decryption,
|
||||
* the {@code CipherInputStream} will attempt to read in data and decrypt
|
||||
* them, before returning the decrypted data.
|
||||
*
|
||||
* <p> This class adheres strictly to the semantics, especially the
|
||||
* failure semantics, of its ancestor classes
|
||||
* java.io.FilterInputStream and java.io.InputStream. This class has
|
||||
* exactly those methods specified in its ancestor classes, and
|
||||
* {@code java.io.FilterInputStream} and {@code java.io.InputStream}.
|
||||
* This class has exactly those methods specified in its ancestor classes, and
|
||||
* overrides them all. Moreover, this class catches all exceptions
|
||||
* that are not thrown by its ancestor classes. In particular, the
|
||||
* <code>skip</code> method skips, and the <code>available</code>
|
||||
* method counts only data that have been processed by the encapsulated Cipher.
|
||||
* This class may catch BadPaddingException and other exceptions thrown by
|
||||
* failed integrity checks during decryption. These exceptions are not
|
||||
* {@code skip} method skips, and the {@code available}
|
||||
* method counts only data that have been processed by the encapsulated
|
||||
* {@code Cipher} object.
|
||||
* This class may catch {@code BadPaddingException} and other exceptions
|
||||
* thrown by failed integrity checks during decryption. These exceptions are not
|
||||
* re-thrown, so the client may not be informed that integrity checks
|
||||
* failed. Because of this behavior, this class may not be suitable
|
||||
* for use with decryption in an authenticated mode of operation (e.g. GCM).
|
||||
* Applications that require authenticated encryption can use the Cipher API
|
||||
* directly as an alternative to using this class.
|
||||
* Applications that require authenticated encryption can use the
|
||||
* {@code Cipher} API directly as an alternative to using this class.
|
||||
*
|
||||
* <p> It is crucial for a programmer using this class not to use
|
||||
* methods that are not defined or overridden in this class (such as a
|
||||
* new method or constructor that is later added to one of the super
|
||||
* classes), because the design and implementation of those methods
|
||||
* are unlikely to have considered security impact with regard to
|
||||
* CipherInputStream.
|
||||
* {@code CipherInputStream}.
|
||||
*
|
||||
* @author Li Gong
|
||||
* @see java.io.InputStream
|
||||
|
@ -100,7 +102,7 @@ public class CipherInputStream extends FilterInputStream {
|
|||
|
||||
/**
|
||||
* Ensure obuffer is big enough for the next update or doFinal
|
||||
* operation, given the input length <code>inLen</code> (in bytes)
|
||||
* operation, given the input length {@code inLen} (in bytes)
|
||||
* The ostart and ofinish indices are reset to 0.
|
||||
*
|
||||
* @param inLen the input length (in bytes)
|
||||
|
@ -163,13 +165,13 @@ public class CipherInputStream extends FilterInputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a CipherInputStream from an InputStream and a
|
||||
* Cipher.
|
||||
* Constructs a {@code CipherInputStream} from an
|
||||
* {@code InputStream} and a {@code Cipher} object.
|
||||
* <br>Note: if the specified input stream or cipher is
|
||||
* null, a NullPointerException may be thrown later when
|
||||
* {@code null}, a {@code NullPointerException} may be thrown later when
|
||||
* they are used.
|
||||
* @param is the to-be-processed input stream
|
||||
* @param c an initialized Cipher object
|
||||
* @param c an initialized {@code Cipher} object
|
||||
*/
|
||||
public CipherInputStream(InputStream is, Cipher c) {
|
||||
super(is);
|
||||
|
@ -178,11 +180,12 @@ public class CipherInputStream extends FilterInputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a CipherInputStream from an InputStream without
|
||||
* specifying a Cipher. This has the effect of constructing a
|
||||
* CipherInputStream using a NullCipher.
|
||||
* <br>Note: if the specified input stream is null, a
|
||||
* NullPointerException may be thrown later when it is used.
|
||||
* Constructs a {@code CipherInputStream} from an
|
||||
* {@code InputStream} without specifying a {@code Cipher} object.
|
||||
* This has the effect of constructing a {@code CipherInputStream}
|
||||
* using a {@code NullCipher}.
|
||||
* <br>Note: if the specified input stream is {@code null}, a
|
||||
* {@code NullPointerException} may be thrown later when it is used.
|
||||
* @param is the to-be-processed input stream
|
||||
*/
|
||||
protected CipherInputStream(InputStream is) {
|
||||
|
@ -193,14 +196,14 @@ public class CipherInputStream extends FilterInputStream {
|
|||
|
||||
/**
|
||||
* Reads the next byte of data from this input stream. The value
|
||||
* byte is returned as an <code>int</code> in the range
|
||||
* <code>0</code> to <code>255</code>. If no byte is available
|
||||
* byte is returned as an {@code int} in the range
|
||||
* {@code 0} to {@code 255}. If no byte is available
|
||||
* because the end of the stream has been reached, the value
|
||||
* <code>-1</code> is returned. This method blocks until input data
|
||||
* {@code -1} is returned. This method blocks until input data
|
||||
* is available, the end of the stream is detected, or an exception
|
||||
* is thrown.
|
||||
*
|
||||
* @return the next byte of data, or <code>-1</code> if the end of the
|
||||
* @return the next byte of data, or {@code -1} if the end of the
|
||||
* stream is reached.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
|
@ -216,16 +219,16 @@ public class CipherInputStream extends FilterInputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads up to <code>b.length</code> bytes of data from this input
|
||||
* Reads up to {@code b.length} bytes of data from this input
|
||||
* stream into an array of bytes.
|
||||
* <p>
|
||||
* The <code>read</code> method of <code>InputStream</code> calls
|
||||
* the <code>read</code> method of three arguments with the arguments
|
||||
* <code>b</code>, <code>0</code>, and <code>b.length</code>.
|
||||
* The {@code read} method of {@code InputStream} calls
|
||||
* the {@code read} method of three arguments with the arguments
|
||||
* {@code b}, {@code 0}, and {@code b.length}.
|
||||
*
|
||||
* @param b the buffer into which the data is read.
|
||||
* @return the total number of bytes read into the buffer, or
|
||||
* <code>-1</code> is there is no more data because the end of
|
||||
* {@code -1} is there is no more data because the end of
|
||||
* the stream has been reached.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
* @see java.io.InputStream#read(byte[], int, int)
|
||||
|
@ -236,17 +239,17 @@ public class CipherInputStream extends FilterInputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads up to <code>len</code> bytes of data from this input stream
|
||||
* Reads up to {@code len} bytes of data from this input stream
|
||||
* into an array of bytes. This method blocks until some input is
|
||||
* available. If the first argument is <code>null,</code> up to
|
||||
* <code>len</code> bytes are read and discarded.
|
||||
* available. If the first argument is {@code null}, up to
|
||||
* {@code len} bytes are read and discarded.
|
||||
*
|
||||
* @param b the buffer into which the data is read.
|
||||
* @param off the start offset in the destination array
|
||||
* <code>buf</code>
|
||||
* {@code buf}
|
||||
* @param len the maximum number of bytes read.
|
||||
* @return the total number of bytes read into the buffer, or
|
||||
* <code>-1</code> if there is no more data because the end of
|
||||
* {@code -1} if there is no more data because the end of
|
||||
* the stream has been reached.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
* @see java.io.InputStream#read()
|
||||
|
@ -272,15 +275,15 @@ public class CipherInputStream extends FilterInputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Skips <code>n</code> bytes of input from the bytes that can be read
|
||||
* Skips {@code n} bytes of input from the bytes that can be read
|
||||
* from this input stream without blocking.
|
||||
*
|
||||
* <p>Fewer bytes than requested might be skipped.
|
||||
* The actual number of bytes skipped is equal to <code>n</code> or
|
||||
* The actual number of bytes skipped is equal to {@code n} or
|
||||
* the result of a call to
|
||||
* {@link #available() available},
|
||||
* whichever is smaller.
|
||||
* If <code>n</code> is less than zero, no bytes are skipped.
|
||||
* If {@code n} is less than zero, no bytes are skipped.
|
||||
*
|
||||
* <p>The actual number of bytes skipped is returned.
|
||||
*
|
||||
|
@ -303,8 +306,8 @@ public class CipherInputStream extends FilterInputStream {
|
|||
|
||||
/**
|
||||
* Returns the number of bytes that can be read from this input
|
||||
* stream without blocking. The <code>available</code> method of
|
||||
* <code>InputStream</code> returns <code>0</code>. This method
|
||||
* stream without blocking. The {@code available} method of
|
||||
* {@code InputStream} returns {@code 0}. This method
|
||||
* <B>should</B> be overridden by subclasses.
|
||||
*
|
||||
* @return the number of bytes that can be read from this input stream
|
||||
|
@ -320,8 +323,8 @@ public class CipherInputStream extends FilterInputStream {
|
|||
* Closes this input stream and releases any system resources
|
||||
* associated with the stream.
|
||||
* <p>
|
||||
* The <code>close</code> method of <code>CipherInputStream</code>
|
||||
* calls the <code>close</code> method of its underlying input
|
||||
* The {@code close} method of {@code CipherInputStream}
|
||||
* calls the {@code close} method of its underlying input
|
||||
* stream.
|
||||
*
|
||||
* @exception IOException if an I/O error occurs.
|
||||
|
@ -350,11 +353,11 @@ public class CipherInputStream extends FilterInputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests if this input stream supports the <code>mark</code>
|
||||
* and <code>reset</code> methods, which it does not.
|
||||
* Tests if this input stream supports the {@code mark}
|
||||
* and {@code reset} methods, which it does not.
|
||||
*
|
||||
* @return <code>false</code>, since this class does not support the
|
||||
* <code>mark</code> and <code>reset</code> methods.
|
||||
* @return {@code false}, since this class does not support the
|
||||
* {@code mark} and {@code reset} methods.
|
||||
* @see java.io.InputStream#mark(int)
|
||||
* @see java.io.InputStream#reset()
|
||||
*/
|
||||
|
|
|
@ -28,36 +28,38 @@ package javax.crypto;
|
|||
import java.io.*;
|
||||
|
||||
/**
|
||||
* A CipherOutputStream is composed of an OutputStream and a Cipher so
|
||||
* that write() methods first process the data before writing them out
|
||||
* to the underlying OutputStream. The cipher must be fully
|
||||
* initialized before being used by a CipherOutputStream.
|
||||
* A {@code CipherOutputStream} is composed of an {@code OutputStream}
|
||||
* and a {@code Cipher} object so that write() methods first process the data
|
||||
* before writing them out to the underlying {@code OutputStream}.
|
||||
* The {@code Cipher} object must be fully initialized before being used by a
|
||||
* {@code CipherOutputStream}.
|
||||
*
|
||||
* <p> For example, if the cipher is initialized for encryption, the
|
||||
* CipherOutputStream will attempt to encrypt data before writing out the
|
||||
* encrypted data.
|
||||
* <p> For example, if the {@code Cipher} object is initialized for encryption,
|
||||
* the {@code CipherOutputStream} will attempt to encrypt data before
|
||||
* writing out the encrypted data.
|
||||
*
|
||||
* <p> This class adheres strictly to the semantics, especially the
|
||||
* failure semantics, of its ancestor classes
|
||||
* java.io.OutputStream and java.io.FilterOutputStream. This class
|
||||
* has exactly those methods specified in its ancestor classes, and
|
||||
* {@code java.io.OutputStream} and
|
||||
* {@code java.io.FilterOutputStream}.
|
||||
* This class has exactly those methods specified in its ancestor classes, and
|
||||
* overrides them all. Moreover, this class catches all exceptions
|
||||
* that are not thrown by its ancestor classes. In particular, this
|
||||
* class catches BadPaddingException and other exceptions thrown by
|
||||
* class catches {@code BadPaddingException} and other exceptions thrown by
|
||||
* failed integrity checks during decryption. These exceptions are not
|
||||
* re-thrown, so the client will not be informed that integrity checks
|
||||
* failed. Because of this behavior, this class may not be suitable
|
||||
* for use with decryption in an authenticated mode of operation (e.g. GCM)
|
||||
* if the application requires explicit notification when authentication
|
||||
* fails. Such an application can use the Cipher API directly as an
|
||||
* alternative to using this class.
|
||||
* fails. Such an application can use the {@code Cipher} API directly as
|
||||
* an alternative to using this class.
|
||||
*
|
||||
* <p> It is crucial for a programmer using this class not to use
|
||||
* methods that are not defined or overridden in this class (such as a
|
||||
* new method or constructor that is later added to one of the super
|
||||
* classes), because the design and implementation of those methods
|
||||
* are unlikely to have considered security impact with regard to
|
||||
* CipherOutputStream.
|
||||
* {@code CipherOutputStream}.
|
||||
*
|
||||
* @author Li Gong
|
||||
* @see java.io.OutputStream
|
||||
|
@ -87,7 +89,7 @@ public class CipherOutputStream extends FilterOutputStream {
|
|||
|
||||
/**
|
||||
* Ensure obuffer is big enough for the next update or doFinal
|
||||
* operation, given the input length <code>inLen</code> (in bytes)
|
||||
* operation, given the input length {@code inLen} (in bytes)
|
||||
*
|
||||
* @param inLen the input length (in bytes)
|
||||
*/
|
||||
|
@ -100,14 +102,14 @@ public class CipherOutputStream extends FilterOutputStream {
|
|||
|
||||
/**
|
||||
*
|
||||
* Constructs a CipherOutputStream from an OutputStream and a
|
||||
* Cipher.
|
||||
* Constructs a {@code CipherOutputStream} from an
|
||||
* {@code OutputStream} and a {@code Cipher} object.
|
||||
* <br>Note: if the specified output stream or cipher is
|
||||
* null, a NullPointerException may be thrown later when
|
||||
* {@code null}, {@code a NullPointerException} may be thrown later when
|
||||
* they are used.
|
||||
*
|
||||
* @param os the OutputStream object
|
||||
* @param c an initialized Cipher object
|
||||
* @param os the {@code OutputStream} object
|
||||
* @param c an initialized {@code Cipher} object
|
||||
*/
|
||||
public CipherOutputStream(OutputStream os, Cipher c) {
|
||||
super(os);
|
||||
|
@ -116,13 +118,14 @@ public class CipherOutputStream extends FilterOutputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a CipherOutputStream from an OutputStream without
|
||||
* specifying a Cipher. This has the effect of constructing a
|
||||
* CipherOutputStream using a NullCipher.
|
||||
* <br>Note: if the specified output stream is null, a
|
||||
* NullPointerException may be thrown later when it is used.
|
||||
* Constructs a {@code CipherOutputStream} from an
|
||||
* {@code OutputStream} without specifying a {@code Cipher} object.
|
||||
* This has the effect of constructing a {@code CipherOutputStream}
|
||||
* using a {@code NullCipher}.
|
||||
* <br>Note: if the specified output stream is {@code null}, a
|
||||
* {@code NullPointerException} may be thrown later when it is used.
|
||||
*
|
||||
* @param os the OutputStream object
|
||||
* @param os the {@code OutputStream} object
|
||||
*/
|
||||
protected CipherOutputStream(OutputStream os) {
|
||||
super(os);
|
||||
|
@ -133,7 +136,7 @@ public class CipherOutputStream extends FilterOutputStream {
|
|||
/**
|
||||
* Writes the specified byte to this output stream.
|
||||
*
|
||||
* @param b the <code>byte</code>.
|
||||
* @param b the {@code byte}.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
|
@ -152,16 +155,16 @@ public class CipherOutputStream extends FilterOutputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Writes <code>b.length</code> bytes from the specified byte array
|
||||
* Writes {@code b.length} bytes from the specified byte array
|
||||
* to this output stream.
|
||||
* <p>
|
||||
* The <code>write</code> method of
|
||||
* <code>CipherOutputStream</code> calls the <code>write</code>
|
||||
* The {@code write} method of
|
||||
* {@code CipherOutputStream} calls the {@code write}
|
||||
* method of three arguments with the three arguments
|
||||
* <code>b</code>, <code>0</code>, and <code>b.length</code>.
|
||||
* {@code b}, {@code 0}, and {@code b.length}.
|
||||
*
|
||||
* @param b the data.
|
||||
* @exception NullPointerException if <code>b</code> is null.
|
||||
* @exception NullPointerException if {@code b} is {@code null}.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
* @see javax.crypto.CipherOutputStream#write(byte[], int, int)
|
||||
*/
|
||||
|
@ -171,8 +174,8 @@ public class CipherOutputStream extends FilterOutputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Writes <code>len</code> bytes from the specified byte array
|
||||
* starting at offset <code>off</code> to this output stream.
|
||||
* Writes {@code len} bytes from the specified byte array
|
||||
* starting at offset {@code off} to this output stream.
|
||||
*
|
||||
* @param b the data.
|
||||
* @param off the start offset in the data.
|
||||
|
@ -195,14 +198,15 @@ public class CipherOutputStream extends FilterOutputStream {
|
|||
|
||||
/**
|
||||
* Flushes this output stream by forcing any buffered output bytes
|
||||
* that have already been processed by the encapsulated cipher object
|
||||
* to be written out.
|
||||
* that have already been processed by the encapsulated {@code Cipher}
|
||||
* object to be written out.
|
||||
*
|
||||
* <p>Any bytes buffered by the encapsulated cipher
|
||||
* <p>Any bytes buffered by the encapsulated {@code Cipher} object
|
||||
* and waiting to be processed by it will not be written out. For example,
|
||||
* if the encapsulated cipher is a block cipher, and the total number of
|
||||
* bytes written using one of the <code>write</code> methods is less than
|
||||
* the cipher's block size, no bytes will be written out.
|
||||
* if the encapsulated {@code Cipher} object is a block cipher, and the
|
||||
* total number of bytes written using one of the {@code write}
|
||||
* methods is less than the cipher's block size, no bytes will be written
|
||||
* out.
|
||||
*
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
|
@ -217,14 +221,14 @@ public class CipherOutputStream extends FilterOutputStream {
|
|||
* Closes this output stream and releases any system resources
|
||||
* associated with this stream.
|
||||
* <p>
|
||||
* This method invokes the <code>doFinal</code> method of the encapsulated
|
||||
* cipher object, which causes any bytes buffered by the encapsulated
|
||||
* cipher to be processed. The result is written out by calling the
|
||||
* <code>flush</code> method of this output stream.
|
||||
* This method invokes the {@code doFinal} method of the encapsulated
|
||||
* {@code Cipher} object, which causes any bytes buffered by the
|
||||
* encapsulated {@code Cipher} object to be processed. The result is written
|
||||
* out by calling the {@code flush} method of this output stream.
|
||||
* <p>
|
||||
* This method resets the encapsulated cipher object to its initial state
|
||||
* and calls the <code>close</code> method of the underlying output
|
||||
* stream.
|
||||
* This method resets the encapsulated {@code Cipher} object to its
|
||||
* initial state and calls the {@code close} method of the underlying
|
||||
* output stream.
|
||||
*
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
|
|
|
@ -228,8 +228,8 @@ public abstract class CipherSpi {
|
|||
*
|
||||
* @param mode the cipher mode
|
||||
*
|
||||
* @throws NoSuchAlgorithmException if the requested cipher mode does
|
||||
* not exist
|
||||
* @throws NoSuchAlgorithmException if the requested cipher mode
|
||||
* does not exist
|
||||
*/
|
||||
protected abstract void engineSetMode(String mode)
|
||||
throws NoSuchAlgorithmException;
|
||||
|
@ -298,10 +298,11 @@ public abstract class CipherSpi {
|
|||
protected abstract AlgorithmParameters engineGetParameters();
|
||||
|
||||
/**
|
||||
* Initializes this cipher with a key and a source
|
||||
* Initializes this {@code CipherSpi} object with a key and a source
|
||||
* of randomness.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* <p>The {@code CipherSpi} object is initialized for one of the
|
||||
* following four operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending on
|
||||
* the value of {@code opmode}.
|
||||
*
|
||||
|
@ -325,13 +326,13 @@ public abstract class CipherSpi {
|
|||
* requires any random bytes (e.g., for parameter generation), it will get
|
||||
* them from {@code random}.
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* <p>Note that when a {@code CipherSpi} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a
|
||||
* {@code CipherSpi} object is equivalent to creating a new instance
|
||||
* of that {@code CipherSpi} object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of
|
||||
* the following:
|
||||
* @param opmode the operation mode of this {@code CipherSpi} object
|
||||
* (this is one of the following:
|
||||
* {@code ENCRYPT_MODE}, {@code DECRYPT_MODE},
|
||||
* {@code WRAP_MODE} or {@code UNWRAP_MODE})
|
||||
* @param key the encryption key
|
||||
|
@ -350,10 +351,11 @@ public abstract class CipherSpi {
|
|||
throws InvalidKeyException;
|
||||
|
||||
/**
|
||||
* Initializes this cipher with a key, a set of
|
||||
* Initializes this {@code CipherSpi} object with a key, a set of
|
||||
* algorithm parameters, and a source of randomness.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* <p>The {@code CipherSpi} object is initialized for one of the
|
||||
* following four operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending on
|
||||
* the value of {@code opmode}.
|
||||
*
|
||||
|
@ -377,15 +379,15 @@ public abstract class CipherSpi {
|
|||
* requires any random bytes (e.g., for parameter generation), it will get
|
||||
* them from {@code random}.
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that Cipher and initializing
|
||||
* it.
|
||||
* <p>Note that when a {@code CipherSpi} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a
|
||||
* {@code CipherSpi} object is equivalent to creating a new instance of that
|
||||
* {@code CipherSpi} object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of
|
||||
* the following:
|
||||
* @param opmode the operation mode of this {@code CipherSpi} object
|
||||
* (this is one of the following:
|
||||
* {@code ENCRYPT_MODE}, {@code DECRYPT_MODE},
|
||||
* {@code WRAP_MODE}> or {@code UNWRAP_MODE})
|
||||
* {@code WRAP_MODE}, or {@code UNWRAP_MODE})
|
||||
* @param key the encryption key
|
||||
* @param params the algorithm parameters
|
||||
* @param random the source of randomness
|
||||
|
@ -406,10 +408,11 @@ public abstract class CipherSpi {
|
|||
throws InvalidKeyException, InvalidAlgorithmParameterException;
|
||||
|
||||
/**
|
||||
* Initializes this cipher with a key, a set of
|
||||
* Initializes this {@code CipherSpi} object with a key, a set of
|
||||
* algorithm parameters, and a source of randomness.
|
||||
*
|
||||
* <p>The cipher is initialized for one of the following four operations:
|
||||
* <p>The {@code CipherSpi} object is initialized for one of the
|
||||
* following four operations:
|
||||
* encryption, decryption, key wrapping or key unwrapping, depending on
|
||||
* the value of {@code opmode}.
|
||||
*
|
||||
|
@ -433,15 +436,15 @@ public abstract class CipherSpi {
|
|||
* requires any random bytes (e.g., for parameter generation), it will get
|
||||
* them from {@code random}.
|
||||
*
|
||||
* <p>Note that when a {@code Cipher} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a cipher is
|
||||
* equivalent to creating a new instance of that cipher and initializing
|
||||
* it.
|
||||
* <p>Note that when a {@code CipherSpi} object is initialized, it loses all
|
||||
* previously-acquired state. In other words, initializing a
|
||||
* {@code CipherSpi} object is equivalent to creating a new instance of that
|
||||
* {@code CipherSpi} object and initializing it.
|
||||
*
|
||||
* @param opmode the operation mode of this cipher (this is one of
|
||||
* the following:
|
||||
* @param opmode the operation mode of this {@code CipherSpi} object
|
||||
* (this is one of the following:
|
||||
* {@code ENCRYPT_MODE}, {@code DECRYPT_MODE},
|
||||
* {@code WRAP_MODE} or {@code UNWRAP_MODE})
|
||||
* {@code WRAP_MODE}, or {@code UNWRAP_MODE})
|
||||
* @param key the encryption key
|
||||
* @param params the algorithm parameters
|
||||
* @param random the source of randomness
|
||||
|
@ -463,8 +466,8 @@ public abstract class CipherSpi {
|
|||
|
||||
/**
|
||||
* Continues a multiple-part encryption or decryption operation
|
||||
* (depending on how this cipher was initialized), processing another data
|
||||
* part.
|
||||
* (depending on how this {@code CipherSpi} object was initialized),
|
||||
* processing another data part.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, are processed,
|
||||
|
@ -483,8 +486,8 @@ public abstract class CipherSpi {
|
|||
|
||||
/**
|
||||
* Continues a multiple-part encryption or decryption operation
|
||||
* (depending on how this cipher was initialized), processing another data
|
||||
* part.
|
||||
* (depending on how this {@code CipherSpi} object was initialized),
|
||||
* processing another data part.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, are processed,
|
||||
|
@ -514,8 +517,8 @@ public abstract class CipherSpi {
|
|||
|
||||
/**
|
||||
* Continues a multiple-part encryption or decryption operation
|
||||
* (depending on how this cipher was initialized), processing another data
|
||||
* part.
|
||||
* (depending on how this {@code CipherSpi} object was initialized),
|
||||
* processing another data part.
|
||||
*
|
||||
* <p>All {@code input.remaining()} bytes starting at
|
||||
* {@code input.position()} are processed. The result is stored
|
||||
|
@ -555,8 +558,8 @@ public abstract class CipherSpi {
|
|||
/**
|
||||
* Encrypts or decrypts data in a single-part operation,
|
||||
* or finishes a multiple-part operation.
|
||||
* The data is encrypted or decrypted, depending on how this cipher was
|
||||
* initialized.
|
||||
* The data is encrypted or decrypted, depending on how this
|
||||
* {@code CipherSpi} object was initialized.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, and any input
|
||||
|
@ -567,15 +570,15 @@ public abstract class CipherSpi {
|
|||
* case of decryption.
|
||||
* The result is stored in a new buffer.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to
|
||||
* <p>Upon finishing, this method resets this {@code CipherSpi} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code engineInit}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code engineInit}) more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code CipherSpi} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* @param input the input buffer
|
||||
* @param inputOffset the offset in {@code input} where the input starts
|
||||
|
@ -588,12 +591,12 @@ public abstract class CipherSpi {
|
|||
* input length of the data processed by this cipher is not a multiple of
|
||||
* block size; or if this encryption algorithm is unable to
|
||||
* process the input data provided
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM or CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
* @throws BadPaddingException if this {@code CipherSpi} object is in
|
||||
* decryption mode, and (un)padding has been requested, but the decrypted
|
||||
* data is not bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this {@code CipherSpi} object is
|
||||
* decrypting in an AEAD mode (such as GCM or CCM), and the received
|
||||
* authentication tag does not match the calculated value
|
||||
*/
|
||||
protected abstract byte[] engineDoFinal(byte[] input, int inputOffset,
|
||||
int inputLen)
|
||||
|
@ -602,8 +605,8 @@ public abstract class CipherSpi {
|
|||
/**
|
||||
* Encrypts or decrypts data in a single-part operation,
|
||||
* or finishes a multiple-part operation.
|
||||
* The data is encrypted or decrypted, depending on how this cipher was
|
||||
* initialized.
|
||||
* The data is encrypted or decrypted, depending on how this
|
||||
* {@code CipherSpi} object was initialized.
|
||||
*
|
||||
* <p>The first {@code inputLen} bytes in the {@code input}
|
||||
* buffer, starting at {@code inputOffset} inclusive, and any input
|
||||
|
@ -618,15 +621,15 @@ public abstract class CipherSpi {
|
|||
* <p>If the {@code output} buffer is too small to hold the result,
|
||||
* a {@code ShortBufferException} is thrown.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to
|
||||
* <p>Upon finishing, this method resets this {@code CipherSpi} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code engineInit}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code engineInit}) more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code CipherSpi} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* @param input the input buffer
|
||||
* @param inputOffset the offset in {@code input} where the input
|
||||
|
@ -645,12 +648,13 @@ public abstract class CipherSpi {
|
|||
* process the input data provided
|
||||
* @throws ShortBufferException if the given output buffer is too small
|
||||
* to hold the result
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* @throws BadPaddingException if this {@code CipherSpi} object is in
|
||||
* decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM or CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
* @throws AEADBadTagException if this {@code CipherSpi} object is
|
||||
* decrypting in an AEAD mode (such as GCM or CCM), and the received
|
||||
* authentication tag does not match the calculated value
|
||||
*/
|
||||
protected abstract int engineDoFinal(byte[] input, int inputOffset,
|
||||
int inputLen, byte[] output,
|
||||
|
@ -661,8 +665,8 @@ public abstract class CipherSpi {
|
|||
/**
|
||||
* Encrypts or decrypts data in a single-part operation,
|
||||
* or finishes a multiple-part operation.
|
||||
* The data is encrypted or decrypted, depending on how this cipher was
|
||||
* initialized.
|
||||
* The data is encrypted or decrypted, depending on how this
|
||||
* {@code CipherSpi} object was initialized.
|
||||
*
|
||||
* <p>All {@code input.remaining()} bytes starting at
|
||||
* {@code input.position()} are processed.
|
||||
|
@ -678,15 +682,15 @@ public abstract class CipherSpi {
|
|||
* <p>If {@code output.remaining()} bytes are insufficient to
|
||||
* hold the result, a {@code ShortBufferException} is thrown.
|
||||
*
|
||||
* <p>Upon finishing, this method resets this cipher to the state
|
||||
* it was in when previously initialized via a call to
|
||||
* <p>Upon finishing, this method resets this {@code CipherSpi} object
|
||||
* to the state it was in when previously initialized via a call to
|
||||
* {@code engineInit}.
|
||||
* That is, the object is reset and available to encrypt or decrypt
|
||||
* (depending on the operation mode that was specified in the call to
|
||||
* {@code engineInit} more data.
|
||||
*
|
||||
* <p>Note: if any exception is thrown, this cipher may need to
|
||||
* be reset before it can be used again.
|
||||
* <p>Note: if any exception is thrown, this {@code CipherSpi} object
|
||||
* may need to be reset before it can be used again.
|
||||
*
|
||||
* <p>Subclasses should consider overriding this method if they can
|
||||
* process ByteBuffers more efficiently than byte arrays.
|
||||
|
@ -703,12 +707,12 @@ public abstract class CipherSpi {
|
|||
* process the input data provided
|
||||
* @throws ShortBufferException if there is insufficient space in the
|
||||
* output buffer
|
||||
* @throws BadPaddingException if this cipher is in decryption mode,
|
||||
* and (un)padding has been requested, but the decrypted data is not
|
||||
* bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this cipher is decrypting in an
|
||||
* AEAD mode (such as GCM or CCM), and the received authentication tag
|
||||
* does not match the calculated value
|
||||
* @throws BadPaddingException if this {@code CipherSpi} object is in
|
||||
* decryption mode, and (un)padding has been requested, but the decrypted
|
||||
* data is not bounded by the appropriate padding bytes
|
||||
* @throws AEADBadTagException if this {@code CipherSpi} object is
|
||||
* decrypting in an AEAD mode (such as GCM or CCM), and the received
|
||||
* authentication tag does not match the calculated value
|
||||
*
|
||||
* @throws NullPointerException if either parameter is {@code null}
|
||||
* @since 1.5
|
||||
|
@ -935,10 +939,10 @@ public abstract class CipherSpi {
|
|||
* @param offset the offset in {@code src} where the AAD input starts
|
||||
* @param len the number of AAD bytes
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized), does not accept AAD, or if
|
||||
* operating in either GCM or CCM mode and one of the {@code update}
|
||||
* methods has already been called for the active
|
||||
* @throws IllegalStateException if this {@code CipherSpi} object is in
|
||||
* a wrong state (e.g., has not been initialized), does not accept AAD,
|
||||
* or if operating in either GCM or CCM mode and one of the
|
||||
* {@code update} methods has already been called for the active
|
||||
* encryption/decryption operation
|
||||
* @throws UnsupportedOperationException if this method
|
||||
* has not been overridden by an implementation
|
||||
|
@ -968,10 +972,10 @@ public abstract class CipherSpi {
|
|||
*
|
||||
* @param src the buffer containing the AAD
|
||||
*
|
||||
* @throws IllegalStateException if this cipher is in a wrong state
|
||||
* (e.g., has not been initialized), does not accept AAD, or if
|
||||
* operating in either GCM or CCM mode and one of the {@code update}
|
||||
* methods has already been called for the active
|
||||
* @throws IllegalStateException if this {@code CipherSpi} object is in
|
||||
* a wrong state (e.g., has not been initialized), does not accept AAD,
|
||||
* or if operating in either GCM or CCM mode and one of the
|
||||
* {@code update} methods has already been called for the active
|
||||
* encryption/decryption operation
|
||||
* @throws UnsupportedOperationException if this method
|
||||
* has not been overridden by an implementation
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -60,20 +60,21 @@ final class CryptoAllPermission extends CryptoPermission {
|
|||
*
|
||||
* @param p the permission to check against.
|
||||
*
|
||||
* @return true if the specified permission is an
|
||||
* instance of CryptoPermission.
|
||||
* @return {@code true} if the specified permission is an
|
||||
* instance of {@code CryptoPermission}.
|
||||
*/
|
||||
public boolean implies(Permission p) {
|
||||
return (p instanceof CryptoPermission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks two CryptoAllPermission objects for equality.
|
||||
* Two CryptoAllPermission objects are always equal.
|
||||
* Checks two {@code CryptoAllPermission} objects for equality.
|
||||
* Two {@code CryptoAllPermission} objects are always equal.
|
||||
*
|
||||
* @param obj the object to test for equality with this object.
|
||||
*
|
||||
* @return true if <i>obj</i> is a CryptoAllPermission object.
|
||||
* @return {@code true} if <i>obj</i> is a
|
||||
* {@code CryptoAllPermission} object.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
return (obj == INSTANCE);
|
||||
|
@ -90,12 +91,11 @@ final class CryptoAllPermission extends CryptoPermission {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new PermissionCollection object for storing
|
||||
* CryptoAllPermission objects.
|
||||
* <p>
|
||||
* Returns a new {@code PermissionCollection} object for storing
|
||||
* {@code CryptoAllPermission} objects.
|
||||
*
|
||||
* @return a new PermissionCollection object suitable for
|
||||
* storing CryptoAllPermissions.
|
||||
* @return a new {@code PermissionCollection} object suitable for
|
||||
* storing {@code CryptoAllPermission} objects.
|
||||
*/
|
||||
public PermissionCollection newPermissionCollection() {
|
||||
return new CryptoAllPermissionCollection();
|
||||
|
@ -103,8 +103,8 @@ final class CryptoAllPermission extends CryptoPermission {
|
|||
}
|
||||
|
||||
/**
|
||||
* A CryptoAllPermissionCollection stores a collection
|
||||
* of CryptoAllPermission permissions.
|
||||
* A {@code CryptoAllPermissionCollection} stores a collection
|
||||
* of {@code CryptoAllPermission} objects.
|
||||
*
|
||||
* @see java.security.Permission
|
||||
* @see java.security.Permissions
|
||||
|
@ -123,18 +123,18 @@ final class CryptoAllPermissionCollection extends PermissionCollection
|
|||
private boolean all_allowed;
|
||||
|
||||
/**
|
||||
* Create an empty CryptoAllPermissions object.
|
||||
* Create an empty {@code CryptoAllPermission} object.
|
||||
*/
|
||||
CryptoAllPermissionCollection() {
|
||||
all_allowed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a permission to the CryptoAllPermissions.
|
||||
* Adds a permission to {@code CryptoAllPermission} object.
|
||||
*
|
||||
* @param permission the Permission object to add.
|
||||
* @param permission the {@code Permission} object to add.
|
||||
*
|
||||
* @exception SecurityException - if this CryptoAllPermissionCollection
|
||||
* @exception SecurityException if this {@code CryptoAllPermissionCollection}
|
||||
* object has been marked readonly
|
||||
*/
|
||||
public void add(Permission permission) {
|
||||
|
@ -152,10 +152,10 @@ final class CryptoAllPermissionCollection extends PermissionCollection
|
|||
* Check and see if this set of permissions implies the permissions
|
||||
* expressed in "permission".
|
||||
*
|
||||
* @param permission the Permission object to compare
|
||||
* @param permission the {@code Permission} object to compare
|
||||
*
|
||||
* @return true if the given permission is implied by this
|
||||
* CryptoAllPermissionCollection.
|
||||
* @return {@code true} if the given permission is implied by this
|
||||
* {@code CryptoAllPermissionCollection} object.
|
||||
*/
|
||||
public boolean implies(Permission permission) {
|
||||
if (!(permission instanceof CryptoPermission)) {
|
||||
|
@ -165,10 +165,10 @@ final class CryptoAllPermissionCollection extends PermissionCollection
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an enumeration of all the CryptoAllPermission
|
||||
* objects in the container.
|
||||
* Returns an enumeration of all the {@code CryptoAllPermission}
|
||||
* objects in the container.
|
||||
*
|
||||
* @return an enumeration of all the CryptoAllPermission objects.
|
||||
* @return an enumeration of all {@code CryptoAllPermission} objects.
|
||||
*/
|
||||
public Enumeration<Permission> elements() {
|
||||
Vector<Permission> v = new Vector<>(1);
|
||||
|
|
|
@ -35,9 +35,9 @@ import java.util.Vector;
|
|||
import javax.crypto.spec.*;
|
||||
|
||||
/**
|
||||
* The CryptoPermission class extends the
|
||||
* java.security.Permission class. A
|
||||
* CryptoPermission object is used to represent
|
||||
* The {@code CryptoPermission} class extends the
|
||||
* {@code java.security.Permission} class. A
|
||||
* {@code CryptoPermission} object is used to represent
|
||||
* the ability of an application/applet to use certain
|
||||
* algorithms with certain key sizes and other
|
||||
* restrictions in certain environments.
|
||||
|
@ -80,7 +80,7 @@ class CryptoPermission extends java.security.Permission {
|
|||
* key size.
|
||||
*
|
||||
* This constructor implies that the given algorithm can be
|
||||
* used with a key size up to <code>maxKeySize</code>.
|
||||
* used with a key size up to {@code maxKeySize}.
|
||||
*
|
||||
* @param alg the algorithm name.
|
||||
*
|
||||
|
@ -95,12 +95,12 @@ class CryptoPermission extends java.security.Permission {
|
|||
|
||||
/**
|
||||
* Constructor that takes an algorithm name, a maximum
|
||||
* key size, and an AlgorithmParameterSpec object.
|
||||
* key size, and an {@code AlgorithmParameterSpec} object.
|
||||
*
|
||||
* This constructor implies that the given algorithm can be
|
||||
* used with a key size up to <code>maxKeySize</code>, and
|
||||
* used with a key size up to {@code maxKeySize}, and
|
||||
* algorithm
|
||||
* parameters up to the limits set in <code>algParamSpec</code>.
|
||||
* parameters up to the limits set in {@code algParamSpec}.
|
||||
*
|
||||
* @param alg the algorithm name.
|
||||
*
|
||||
|
@ -144,7 +144,7 @@ class CryptoPermission extends java.security.Permission {
|
|||
* size, and the name of an exemption mechanism.
|
||||
*
|
||||
* This constructor implies that the given algorithm can be
|
||||
* used with a key size up to <code>maxKeySize</code>
|
||||
* used with a key size up to {@code maxKeySize}
|
||||
* provided that the
|
||||
* specified exemption mechanism is enforced.
|
||||
*
|
||||
|
@ -166,12 +166,12 @@ class CryptoPermission extends java.security.Permission {
|
|||
/**
|
||||
* Constructor that takes an algorithm name, a maximum key
|
||||
* size, the name of an exemption mechanism, and an
|
||||
* AlgorithmParameterSpec object.
|
||||
* {@code AlgorithmParameterSpec} object.
|
||||
*
|
||||
* This constructor implies that the given algorithm can be
|
||||
* used with a key size up to <code>maxKeySize</code>
|
||||
* used with a key size up to {@code maxKeySize}
|
||||
* and algorithm
|
||||
* parameters up to the limits set in <code>algParamSpec</code>
|
||||
* parameters up to the limits set in {@code algParamSpec}
|
||||
* provided that
|
||||
* the specified exemption mechanism is enforced.
|
||||
*
|
||||
|
@ -199,9 +199,9 @@ class CryptoPermission extends java.security.Permission {
|
|||
* Checks if the specified permission is "implied" by
|
||||
* this object.
|
||||
* <p>
|
||||
* More specifically, this method returns true if:
|
||||
* More specifically, this method returns {@code true} if:
|
||||
* <ul>
|
||||
* <li> <i>p</i> is an instance of CryptoPermission, and</li>
|
||||
* <li> <i>p</i> is an instance of {@code CryptoPermission}, and</li>
|
||||
* <li> <i>p</i>'s algorithm name equals or (in the case of wildcards)
|
||||
* is implied by this permission's algorithm name, and</li>
|
||||
* <li> <i>p</i>'s maximum allowable key size is less or
|
||||
|
@ -210,14 +210,14 @@ class CryptoPermission extends java.security.Permission {
|
|||
* implied by this permission's algorithm parameter spec, and</li>
|
||||
* <li> <i>p</i>'s exemptionMechanism equals or
|
||||
* is implied by this permission's
|
||||
* exemptionMechanism (a <code>null</code> exemption mechanism
|
||||
* exemptionMechanism (a {@code null} exemption mechanism
|
||||
* implies any other exemption mechanism).</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param p the permission to check against.
|
||||
*
|
||||
* @return true if the specified permission is equal to or
|
||||
* implied by this permission, false otherwise.
|
||||
* @return {@code true} if the specified permission is equal to or
|
||||
* implied by this permission, {@code false} otherwise.
|
||||
*/
|
||||
public boolean implies(Permission p) {
|
||||
if (!(p instanceof CryptoPermission cp))
|
||||
|
@ -244,15 +244,13 @@ class CryptoPermission extends java.security.Permission {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks two CryptoPermission objects for equality. Checks that
|
||||
* <code>obj</code> is a CryptoPermission, and has the same
|
||||
* algorithm name,
|
||||
* Checks two {@code CryptoPermission} objects for equality.
|
||||
* Checks that {@code obj} is a {@code CryptoPermission}
|
||||
* object, and has the same algorithm name,
|
||||
* exemption mechanism name, maximum allowable key size and
|
||||
* algorithm parameter spec
|
||||
* as this object.
|
||||
* <P>
|
||||
* algorithm parameter spec as this object.
|
||||
* @param obj the object to test for equality with this object.
|
||||
* @return true if <code>obj</code> is equal to this object.
|
||||
* @return {@code true} if {@code obj} is equal to this object.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this)
|
||||
|
@ -294,7 +292,7 @@ class CryptoPermission extends java.security.Permission {
|
|||
}
|
||||
|
||||
/**
|
||||
* There is no action defined for a CryptoPermission
|
||||
* There is no action defined for a {@code CryptoPermission}
|
||||
* object.
|
||||
*/
|
||||
public String getActions()
|
||||
|
@ -303,10 +301,10 @@ class CryptoPermission extends java.security.Permission {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new PermissionCollection object for storing
|
||||
* CryptoPermission objects.
|
||||
* Returns a new {@code PermissionCollection} object for storing
|
||||
* {@code CryptoPermission} objects.
|
||||
*
|
||||
* @return a new PermissionCollection object suitable for storing
|
||||
* @return a new {@code PermissionCollection} object suitable for storing
|
||||
* CryptoPermissions.
|
||||
*/
|
||||
|
||||
|
@ -316,7 +314,7 @@ class CryptoPermission extends java.security.Permission {
|
|||
|
||||
/**
|
||||
* Returns the algorithm name associated with
|
||||
* this CryptoPermission object.
|
||||
* this {@code CryptoPermission} object.
|
||||
*/
|
||||
final String getAlgorithm() {
|
||||
return alg;
|
||||
|
@ -324,7 +322,7 @@ class CryptoPermission extends java.security.Permission {
|
|||
|
||||
/**
|
||||
* Returns the exemption mechanism name
|
||||
* associated with this CryptoPermission
|
||||
* associated with this {@code CryptoPermission}
|
||||
* object.
|
||||
*/
|
||||
final String getExemptionMechanism() {
|
||||
|
@ -333,16 +331,16 @@ class CryptoPermission extends java.security.Permission {
|
|||
|
||||
/**
|
||||
* Returns the maximum allowable key size associated
|
||||
* with this CryptoPermission object.
|
||||
* with this {@code CryptoPermission} object.
|
||||
*/
|
||||
final int getMaxKeySize() {
|
||||
return maxKeySize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if there is a limitation on the
|
||||
* AlgorithmParameterSpec associated with this
|
||||
* CryptoPermission object and false if otherwise.
|
||||
* Returns {@code true} if there is a limitation on the
|
||||
* {@code AlgorithmParameterSpec} associated with this
|
||||
* {@code CryptoPermission} object and {@code false} if otherwise.
|
||||
*/
|
||||
final boolean getCheckParam() {
|
||||
return checkParam;
|
||||
|
@ -358,12 +356,13 @@ class CryptoPermission extends java.security.Permission {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a string describing this CryptoPermission. The convention is to
|
||||
* specify the class name, the algorithm name, the maximum allowable
|
||||
* key size, and the name of the exemption mechanism, in the following
|
||||
* Returns a string describing this {@code CryptoPermission} object.
|
||||
* The convention is to specify the class name, the algorithm name,
|
||||
* the maximum allowable key size, and the name of the exemption mechanism,
|
||||
* in the following
|
||||
* format: '("ClassName" "algorithm" "keysize" "exemption_mechanism")'.
|
||||
*
|
||||
* @return information about this CryptoPermission.
|
||||
* @return information about this {@code CryptoPermission} object.
|
||||
*/
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
|
@ -449,8 +448,8 @@ class CryptoPermission extends java.security.Permission {
|
|||
}
|
||||
|
||||
/**
|
||||
* A CryptoPermissionCollection stores a set of CryptoPermission
|
||||
* permissions.
|
||||
* A {@code CryptoPermissionCollection} object stores a set of
|
||||
* {@code CryptoPermission} objects.
|
||||
*
|
||||
* @see java.security.Permission
|
||||
* @see java.security.Permissions
|
||||
|
@ -475,12 +474,13 @@ final class CryptoPermissionCollection extends PermissionCollection
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a permission to the CryptoPermissionCollection.
|
||||
* Adds a permission to the {@code CryptoPermissionCollection} object.
|
||||
*
|
||||
* @param permission the Permission object to add.
|
||||
* @param permission the {@code Permission} object to add.
|
||||
*
|
||||
* @exception SecurityException - if this CryptoPermissionCollection
|
||||
* object has been marked <i>readOnly</i>.
|
||||
* @exception SecurityException if this
|
||||
* {@code CryptoPermissionCollection} object has been marked
|
||||
* <i>readOnly</i>.
|
||||
*/
|
||||
public void add(Permission permission) {
|
||||
if (isReadOnly())
|
||||
|
@ -494,13 +494,13 @@ final class CryptoPermissionCollection extends PermissionCollection
|
|||
}
|
||||
|
||||
/**
|
||||
* Check and see if this CryptoPermission object implies
|
||||
* the given Permission object.
|
||||
* Check and see if this {@code CryptoPermission} object implies
|
||||
* the given {@code Permission} object.
|
||||
*
|
||||
* @param permission the Permission object to compare
|
||||
* @param permission the {@code Permission} object to compare
|
||||
*
|
||||
* @return true if the given permission is implied by this
|
||||
* CryptoPermissionCollection, false if not.
|
||||
* @return {@code true} if the given permission is implied by this
|
||||
* {@code CryptoPermissionCollection}, {@code false} if not.
|
||||
*/
|
||||
public boolean implies(Permission permission) {
|
||||
if (!(permission instanceof CryptoPermission cp))
|
||||
|
@ -518,10 +518,10 @@ final class CryptoPermissionCollection extends PermissionCollection
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an enumeration of all the CryptoPermission objects
|
||||
* Returns an enumeration of all the {@code CryptoPermission} objects
|
||||
* in the container.
|
||||
*
|
||||
* @return an enumeration of all the CryptoPermission objects.
|
||||
* @return an enumeration of all the {@code CryptoPermission} objects.
|
||||
*/
|
||||
|
||||
public Enumeration<Permission> elements() {
|
||||
|
|
|
@ -43,17 +43,17 @@ import java.io.IOException;
|
|||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
/**
|
||||
* This class contains CryptoPermission objects, organized into
|
||||
* PermissionCollections according to algorithm names.
|
||||
* This class contains {@code CryptoPermission} objects, organized into
|
||||
* {@code PermissionCollection} objects according to algorithm names.
|
||||
*
|
||||
* <p>When the <code>add</code> method is called to add a
|
||||
* CryptoPermission, the CryptoPermission is stored in the
|
||||
* appropriate PermissionCollection. If no such
|
||||
* <p>When the {@code add} method is called to add a
|
||||
* {@code CryptoPermission}, the {@code CryptoPermission} is stored in the
|
||||
* appropriate {@code PermissionCollection}. If no such
|
||||
* collection exists yet, the algorithm name associated with
|
||||
* the CryptoPermission object is
|
||||
* determined and the <code>newPermissionCollection</code> method
|
||||
* is called on the CryptoPermission or CryptoAllPermission class to
|
||||
* create the PermissionCollection and add it to the Permissions object.
|
||||
* the {@code CryptoPermission} object is
|
||||
* determined and the {@code newPermissionCollection} method
|
||||
* is called on the {@code CryptoPermission} or {@code CryptoAllPermission} class to
|
||||
* create the {@code PermissionCollection} and add it to the {@code Permissions} object.
|
||||
*
|
||||
* @see javax.crypto.CryptoPermission
|
||||
* @see java.security.PermissionCollection
|
||||
|
@ -82,8 +82,8 @@ implements Serializable {
|
|||
private transient ConcurrentHashMap<String,PermissionCollection> perms;
|
||||
|
||||
/**
|
||||
* Creates a new CryptoPermissions object containing
|
||||
* no CryptoPermissionCollections.
|
||||
* Creates a new {@code CryptoPermissions} object containing
|
||||
* no {@code CryptoPermissionCollection} objects.
|
||||
*/
|
||||
CryptoPermissions() {
|
||||
perms = new ConcurrentHashMap<>(7);
|
||||
|
@ -91,7 +91,7 @@ implements Serializable {
|
|||
|
||||
/**
|
||||
* Populates the crypto policy from the specified
|
||||
* InputStream into this CryptoPermissions object.
|
||||
* {@code InputStream} into this {@code CryptoPermissions} object.
|
||||
*
|
||||
* @param in the InputStream to load from.
|
||||
*
|
||||
|
@ -110,29 +110,29 @@ implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if this CryptoPermissions object doesn't
|
||||
* contain any CryptoPermission objects; otherwise, returns
|
||||
* false.
|
||||
* Returns {@code true} if this {@code CryptoPermissions} object doesn't
|
||||
* contain any {@code CryptoPermission} objects; otherwise, returns
|
||||
* {@code false}.
|
||||
*/
|
||||
boolean isEmpty() {
|
||||
return perms.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a permission object to the PermissionCollection for the
|
||||
* algorithm returned by
|
||||
* <code>(CryptoPermission)permission.getAlgorithm()</code>.
|
||||
* Adds a permission object to the
|
||||
* {@code PermissionCollection} for the algorithm returned by
|
||||
* {@code (CryptoPermission)permission.getAlgorithm()}.
|
||||
*
|
||||
* This method creates
|
||||
* a new PermissionCollection object (and adds the permission to it)
|
||||
* if an appropriate collection does not yet exist. <p>
|
||||
* a new {@code PermissionCollection} object (and adds the
|
||||
* permission to it) if an appropriate collection does not yet exist.
|
||||
*
|
||||
* @param permission the Permission object to add.
|
||||
* @param permission the {@code Permission} object to add.
|
||||
*
|
||||
* @exception SecurityException if this CryptoPermissions object is
|
||||
* marked as readonly.
|
||||
* @exception SecurityException if this {@code CryptoPermissions}
|
||||
* object is marked as readonly.
|
||||
*
|
||||
* @see isReadOnly
|
||||
* @see PermissionCollection#isReadOnly
|
||||
*/
|
||||
@Override
|
||||
public void add(Permission permission) {
|
||||
|
@ -155,14 +155,14 @@ implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if this object's PermissionCollection for permissions
|
||||
* Checks if this object's {@code PermissionCollection} for permissions
|
||||
* of the specified permission's algorithm implies the specified
|
||||
* permission. Returns true if the checking succeeded.
|
||||
* permission. Returns {@code true} if the checking succeeded.
|
||||
*
|
||||
* @param permission the Permission object to check.
|
||||
* @param permission the {@code Permission} object to check.
|
||||
*
|
||||
* @return true if "permission" is implied by the permissions
|
||||
* in the PermissionCollection it belongs to, false if not.
|
||||
* @return {@code true} if {@code permission} is implied by the permissions
|
||||
* in the {@code PermissionCollection} it belongs to, {@code false} if not.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
|
@ -183,10 +183,9 @@ implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an enumeration of all the Permission objects in all the
|
||||
* PermissionCollections in this CryptoPermissions object.
|
||||
*
|
||||
* @return an enumeration of all the Permissions.
|
||||
* Returns an enumeration of all the {@code Permission} objects
|
||||
* in this {@code CryptoPermissions} object.
|
||||
* @return an enumeration of all the {@code Permission} objects.
|
||||
*/
|
||||
@Override
|
||||
public Enumeration<Permission> elements() {
|
||||
|
@ -196,12 +195,12 @@ implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a CryptoPermissions object which
|
||||
* Returns a {@code CryptoPermissions} object which
|
||||
* represents the minimum of the specified
|
||||
* CryptoPermissions object and this
|
||||
* CryptoPermissions object.
|
||||
* {@code CryptoPermissions} object and this
|
||||
* {@code CryptoPermissions} object.
|
||||
*
|
||||
* @param other the CryptoPermission
|
||||
* @param other the {@code CryptoPermission}
|
||||
* object to compare with this object.
|
||||
*/
|
||||
CryptoPermissions getMinimum(CryptoPermissions other) {
|
||||
|
@ -293,13 +292,13 @@ implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the minimum of the two given PermissionCollection
|
||||
* <code>thisPc</code> and <code>thatPc</code>.
|
||||
* Get the minimum of the two given {@code PermissionCollection}
|
||||
* {@code thisPc} and {@code thatPc}.
|
||||
*
|
||||
* @param thisPc the first given PermissionCollection
|
||||
* @param thisPc the first given {@code PermissionCollection}
|
||||
* object.
|
||||
*
|
||||
* @param thatPc the second given PermissionCollection
|
||||
* @param thatPc the second given {@code PermissionCollection}
|
||||
* object.
|
||||
*/
|
||||
private CryptoPermission[] getMinimum(PermissionCollection thisPc,
|
||||
|
@ -344,17 +343,18 @@ implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns all the CryptoPermission objects in the given
|
||||
* PermissionCollection object
|
||||
* whose maximum keysize no greater than <code>maxKeySize</code>.
|
||||
* For all CryptoPermission objects with a maximum keysize greater
|
||||
* than <code>maxKeySize</code>, this method constructs a
|
||||
* corresponding CryptoPermission object whose maximum keysize is
|
||||
* set to <code>maxKeySize</code>, and includes that in the result.
|
||||
* Returns all the {@code CryptoPermission} objects in the given
|
||||
* {@code PermissionCollection} object
|
||||
* whose maximum keysize no greater than {@code maxKeySize}.
|
||||
* For all {@code CryptoPermission} objects with a maximum keysize
|
||||
* greater than {@code maxKeySize}, this method constructs a
|
||||
* corresponding {@code CryptoPermission} object whose maximum
|
||||
* keysize is set to {@code maxKeySize}, and includes that in
|
||||
* the result.
|
||||
*
|
||||
* @param maxKeySize the given maximum key size.
|
||||
*
|
||||
* @param pc the given PermissionCollection object.
|
||||
* @param pc the given {@code PermissionCollection} object.
|
||||
*/
|
||||
private CryptoPermission[] getMinimum(int maxKeySize,
|
||||
PermissionCollection pc) {
|
||||
|
@ -387,9 +387,9 @@ implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the PermissionCollection for the
|
||||
* specified algorithm. Returns null if there
|
||||
* isn't such a PermissionCollection.
|
||||
* Returns the {@code PermissionCollection} for the
|
||||
* specified algorithm. Returns {@code null} if there
|
||||
* isn't such a {@code PermissionCollection}.
|
||||
*
|
||||
* @param alg the algorithm name.
|
||||
*/
|
||||
|
@ -412,13 +412,13 @@ implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the PermissionCollection for the algorithm
|
||||
* associated with the specified CryptoPermission
|
||||
* object. Creates such a PermissionCollection
|
||||
* if such a PermissionCollection does not
|
||||
* Returns the {@code PermissionCollection} for the algorithm
|
||||
* associated with the specified {@code CryptoPermission}
|
||||
* object. Creates such a {@code PermissionCollection}
|
||||
* if such a {@code PermissionCollection} does not
|
||||
* exist yet.
|
||||
*
|
||||
* @param cryptoPerm the CryptoPermission object.
|
||||
* @param cryptoPerm the {@code CryptoPermission} object.
|
||||
*/
|
||||
private PermissionCollection getPermissionCollection(
|
||||
CryptoPermission cryptoPerm) {
|
||||
|
|
|
@ -42,8 +42,9 @@ import java.lang.reflect.*;
|
|||
* JCE will be used.
|
||||
*
|
||||
* The jurisdiction policy file has the same syntax as JDK policy files except
|
||||
* that JCE has new permission classes called javax.crypto.CryptoPermission
|
||||
* and javax.crypto.CryptoAllPermission.
|
||||
* that JCE has new permission classes called
|
||||
* {@code javax.crypto.CryptoPermission} and
|
||||
* {@code javax.crypto.CryptoAllPermission}.
|
||||
*
|
||||
* The format of a permission entry in the jurisdiction policy file is:
|
||||
*
|
||||
|
@ -74,16 +75,16 @@ final class CryptoPolicyParser {
|
|||
private boolean allPermEntryFound = false;
|
||||
|
||||
/**
|
||||
* Creates a CryptoPolicyParser object.
|
||||
* Creates a {@code CryptoPolicyParser} object.
|
||||
*/
|
||||
CryptoPolicyParser() {
|
||||
grantEntries = new Vector<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a policy configuration using a Reader object. <p>
|
||||
* Reads a policy configuration using a {@code Reader} object. <p>
|
||||
*
|
||||
* @param policy the policy Reader object.
|
||||
* @param policy the policy {@code Reader} object.
|
||||
*
|
||||
* @exception ParsingException if the policy configuration
|
||||
* contains a syntax error.
|
||||
|
@ -537,8 +538,8 @@ final class CryptoPolicyParser {
|
|||
}
|
||||
|
||||
/**
|
||||
* Each grant entry in the policy configuration file is represented by a
|
||||
* GrantEntry object.
|
||||
* Each grant entry in the policy configuration file is represented by a
|
||||
* {@code GrantEntry} object.
|
||||
* <p>
|
||||
* For example, the entry
|
||||
* <pre>
|
||||
|
@ -588,7 +589,7 @@ final class CryptoPolicyParser {
|
|||
}
|
||||
|
||||
/**
|
||||
* Enumerate all the permission entries in this GrantEntry.
|
||||
* Enumerate all the permission entries in this {@code GrantEntry}.
|
||||
*/
|
||||
Enumeration<CryptoPermissionEntry> permissionElements(){
|
||||
return permissionEntries.elements();
|
||||
|
@ -598,7 +599,7 @@ final class CryptoPolicyParser {
|
|||
|
||||
/**
|
||||
* Each crypto permission entry in the policy configuration file is
|
||||
* represented by a CryptoPermissionEntry object.
|
||||
* represented by a {@code CryptoPermissionEntry} object.
|
||||
* <p>
|
||||
* For example, the entry
|
||||
* <pre>
|
||||
|
@ -692,7 +693,7 @@ final class CryptoPolicyParser {
|
|||
private static final long serialVersionUID = 7147241245566588374L;
|
||||
|
||||
/**
|
||||
* Constructs a ParsingException with the specified
|
||||
* Constructs a {@code ParsingException} with the specified
|
||||
* detail message.
|
||||
* @param msg the detail message.
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,7 @@ import sun.security.util.DerInputStream;
|
|||
import sun.security.util.DerOutputStream;
|
||||
|
||||
/**
|
||||
* This class implements the <code>EncryptedPrivateKeyInfo</code> type
|
||||
* This class implements the {@code EncryptedPrivateKeyInfo} type
|
||||
* as defined in PKCS #8.
|
||||
* <p>Its ASN.1 definition is as follows:
|
||||
*
|
||||
|
@ -70,11 +70,12 @@ public class EncryptedPrivateKeyInfo {
|
|||
private byte[] encoded;
|
||||
|
||||
/**
|
||||
* Constructs (i.e., parses) an <code>EncryptedPrivateKeyInfo</code> from
|
||||
* Constructs (i.e., parses) an {@code EncryptedPrivateKeyInfo} from
|
||||
* its ASN.1 encoding.
|
||||
* @param encoded the ASN.1 encoding of this object. The contents of
|
||||
* the array are copied to protect against subsequent modification.
|
||||
* @exception NullPointerException if the <code>encoded</code> is null.
|
||||
* @exception NullPointerException if the {@code encoded} is
|
||||
* {@code null}.
|
||||
* @exception IOException if error occurs when parsing the ASN.1 encoding.
|
||||
*/
|
||||
public EncryptedPrivateKeyInfo(byte[] encoded) throws IOException {
|
||||
|
@ -110,12 +111,12 @@ public class EncryptedPrivateKeyInfo {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs an <code>EncryptedPrivateKeyInfo</code> from the
|
||||
* Constructs an {@code EncryptedPrivateKeyInfo} from the
|
||||
* encryption algorithm name and the encrypted data.
|
||||
*
|
||||
* <p>Note: This constructor will use null as the value of the
|
||||
* <p>Note: This constructor will use {@code null} as the value of the
|
||||
* algorithm parameters. If the encryption algorithm has
|
||||
* parameters whose value is not null, a different constructor,
|
||||
* parameters whose value is not {@code null}, a different constructor,
|
||||
* e.g. EncryptedPrivateKeyInfo(AlgorithmParameters, byte[]),
|
||||
* should be used.
|
||||
*
|
||||
|
@ -124,11 +125,11 @@ public class EncryptedPrivateKeyInfo {
|
|||
* Java Security Standard Algorithm Names</a> document
|
||||
* for information about standard Cipher algorithm names.
|
||||
* @param encryptedData encrypted data. The contents of
|
||||
* <code>encryptedData</code> are copied to protect against subsequent
|
||||
* {@code encryptedData} are copied to protect against subsequent
|
||||
* modification when constructing this object.
|
||||
* @exception NullPointerException if <code>algName</code> or
|
||||
* <code>encryptedData</code> is null.
|
||||
* @exception IllegalArgumentException if <code>encryptedData</code>
|
||||
* @exception NullPointerException if {@code algName} or
|
||||
* {@code encryptedData} is {@code null}.
|
||||
* @exception IllegalArgumentException if {@code encryptedData}
|
||||
* is empty, i.e. 0-length.
|
||||
* @exception NoSuchAlgorithmException if the specified algName is
|
||||
* not supported.
|
||||
|
@ -156,23 +157,23 @@ public class EncryptedPrivateKeyInfo {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs an <code>EncryptedPrivateKeyInfo</code> from the
|
||||
* Constructs an {@code EncryptedPrivateKeyInfo} from the
|
||||
* encryption algorithm parameters and the encrypted data.
|
||||
*
|
||||
* @param algParams the algorithm parameters for the encryption
|
||||
* algorithm. <code>algParams.getEncoded()</code> should return
|
||||
* the ASN.1 encoded bytes of the <code>parameters</code> field
|
||||
* of the <code>AlgorithmIdentifier</code> component of the
|
||||
* <code>EncryptedPrivateKeyInfo</code> type.
|
||||
* algorithm. {@code algParams.getEncoded()} should return
|
||||
* the ASN.1 encoded bytes of the {@code parameters} field
|
||||
* of the {@code AlgorithmIdentifier} component of the
|
||||
* {@code EncryptedPrivateKeyInfo} type.
|
||||
* @param encryptedData encrypted data. The contents of
|
||||
* <code>encryptedData</code> are copied to protect against
|
||||
* {@code encryptedData} are copied to protect against
|
||||
* subsequent modification when constructing this object.
|
||||
* @exception NullPointerException if <code>algParams</code> or
|
||||
* <code>encryptedData</code> is null.
|
||||
* @exception IllegalArgumentException if <code>encryptedData</code>
|
||||
* @exception NullPointerException if {@code algParams} or
|
||||
* {@code encryptedData} is {@code null}.
|
||||
* @exception IllegalArgumentException if {@code encryptedData}
|
||||
* is empty, i.e. 0-length.
|
||||
* @exception NoSuchAlgorithmException if the specified algName of
|
||||
* the specified <code>algParams</code> parameter is not supported.
|
||||
* the specified {@code algParams} parameter is not supported.
|
||||
*/
|
||||
public EncryptedPrivateKeyInfo(AlgorithmParameters algParams,
|
||||
byte[] encryptedData) throws NoSuchAlgorithmException {
|
||||
|
@ -232,16 +233,16 @@ public class EncryptedPrivateKeyInfo {
|
|||
* Extract the enclosed PKCS8EncodedKeySpec object from the
|
||||
* encrypted data and return it.
|
||||
* <br>Note: In order to successfully retrieve the enclosed
|
||||
* PKCS8EncodedKeySpec object, <code>cipher</code> needs
|
||||
* PKCS8EncodedKeySpec object, {@code cipher} needs
|
||||
* to be initialized to either Cipher.DECRYPT_MODE or
|
||||
* Cipher.UNWRAP_MODE, with the same key and parameters used
|
||||
* for generating the encrypted data.
|
||||
*
|
||||
* @param cipher the initialized cipher object which will be
|
||||
* @param cipher the initialized {@code Cipher} object which will be
|
||||
* used for decrypting the encrypted data.
|
||||
* @return the PKCS8EncodedKeySpec object.
|
||||
* @exception NullPointerException if <code>cipher</code>
|
||||
* is null.
|
||||
* @exception NullPointerException if {@code cipher}
|
||||
* is {@code null}.
|
||||
* @exception InvalidKeySpecException if the given cipher is
|
||||
* inappropriate for the encrypted data or the encrypted
|
||||
* data is corrupted and cannot be decrypted.
|
||||
|
@ -291,11 +292,11 @@ public class EncryptedPrivateKeyInfo {
|
|||
* encrypted data and return it.
|
||||
* @param decryptKey key used for decrypting the encrypted data.
|
||||
* @return the PKCS8EncodedKeySpec object.
|
||||
* @exception NullPointerException if <code>decryptKey</code>
|
||||
* is null.
|
||||
* @exception NullPointerException if {@code decryptKey}
|
||||
* is {@code null}.
|
||||
* @exception NoSuchAlgorithmException if cannot find appropriate
|
||||
* cipher to decrypt the encrypted data.
|
||||
* @exception InvalidKeyException if <code>decryptKey</code>
|
||||
* @exception InvalidKeyException if {@code decryptKey}
|
||||
* cannot be used to decrypt the encrypted data or the decryption
|
||||
* result is not a valid PKCS8KeySpec.
|
||||
*
|
||||
|
@ -313,16 +314,16 @@ public class EncryptedPrivateKeyInfo {
|
|||
* Extract the enclosed PKCS8EncodedKeySpec object from the
|
||||
* encrypted data and return it.
|
||||
* @param decryptKey key used for decrypting the encrypted data.
|
||||
* @param providerName the name of provider whose Cipher
|
||||
* @param providerName the name of provider whose cipher
|
||||
* implementation will be used.
|
||||
* @return the PKCS8EncodedKeySpec object.
|
||||
* @exception NullPointerException if <code>decryptKey</code>
|
||||
* or <code>providerName</code> is null.
|
||||
* @exception NullPointerException if {@code decryptKey}
|
||||
* or {@code providerName} is {@code null}.
|
||||
* @exception NoSuchProviderException if no provider
|
||||
* <code>providerName</code> is registered.
|
||||
* {@code providerName} is registered.
|
||||
* @exception NoSuchAlgorithmException if cannot find appropriate
|
||||
* cipher to decrypt the encrypted data.
|
||||
* @exception InvalidKeyException if <code>decryptKey</code>
|
||||
* @exception InvalidKeyException if {@code decryptKey}
|
||||
* cannot be used to decrypt the encrypted data or the decryption
|
||||
* result is not a valid PKCS8KeySpec.
|
||||
*
|
||||
|
@ -349,14 +350,14 @@ public class EncryptedPrivateKeyInfo {
|
|||
* Extract the enclosed PKCS8EncodedKeySpec object from the
|
||||
* encrypted data and return it.
|
||||
* @param decryptKey key used for decrypting the encrypted data.
|
||||
* @param provider the name of provider whose Cipher implementation
|
||||
* @param provider the name of provider whose cipher implementation
|
||||
* will be used.
|
||||
* @return the PKCS8EncodedKeySpec object.
|
||||
* @exception NullPointerException if <code>decryptKey</code>
|
||||
* or <code>provider</code> is null.
|
||||
* @exception NullPointerException if {@code decryptKey}
|
||||
* or {@code provider} is {@code null}.
|
||||
* @exception NoSuchAlgorithmException if cannot find appropriate
|
||||
* cipher to decrypt the encrypted data in <code>provider</code>.
|
||||
* @exception InvalidKeyException if <code>decryptKey</code>
|
||||
* cipher to decrypt the encrypted data in {@code provider}.
|
||||
* @exception InvalidKeyException if {@code decryptKey}
|
||||
* cannot be used to decrypt the encrypted data or the decryption
|
||||
* result is not a valid PKCS8KeySpec.
|
||||
*
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ExemptionMechanism {
|
|||
private Key keyStored = null;
|
||||
|
||||
/**
|
||||
* Creates a ExemptionMechanism object.
|
||||
* Creates an {@code ExemptionMechanism} object.
|
||||
*
|
||||
* @param exmechSpi the delegate
|
||||
* @param provider the provider
|
||||
|
@ -87,28 +87,28 @@ public class ExemptionMechanism {
|
|||
|
||||
/**
|
||||
* Returns the exemption mechanism name of this
|
||||
* <code>ExemptionMechanism</code> object.
|
||||
* {@code ExemptionMechanism} object.
|
||||
*
|
||||
* <p>This is the same name that was specified in one of the
|
||||
* <code>getInstance</code> calls that created this
|
||||
* <code>ExemptionMechanism</code> object.
|
||||
* {@code getInstance} calls that created this
|
||||
* {@code ExemptionMechanism} object.
|
||||
*
|
||||
* @return the exemption mechanism name of this
|
||||
* <code>ExemptionMechanism</code> object.
|
||||
* {@code ExemptionMechanism} object.
|
||||
*/
|
||||
public final String getName() {
|
||||
return this.mechanism;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>ExemptionMechanism</code> object that implements the
|
||||
* Returns an {@code ExemptionMechanism} object that implements the
|
||||
* specified exemption mechanism algorithm.
|
||||
*
|
||||
* <p> 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.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code ExemptionMechanism} object encapsulating the
|
||||
* {@code ExemptionMechanismSpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -150,12 +150,12 @@ public class ExemptionMechanism {
|
|||
|
||||
|
||||
/**
|
||||
* Returns an <code>ExemptionMechanism</code> object that implements the
|
||||
* Returns an {@code ExemptionMechanism} object that implements the
|
||||
* specified exemption mechanism algorithm.
|
||||
*
|
||||
* <p> A new ExemptionMechanism object encapsulating the
|
||||
* ExemptionMechanismSpi implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* <p> A new {@code ExemptionMechanism} object encapsulating the
|
||||
* {@code ExemptionMechanismSpi} implementation from the specified
|
||||
* provider is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
|
@ -197,12 +197,12 @@ public class ExemptionMechanism {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>ExemptionMechanism</code> object that implements the
|
||||
* Returns an {@code ExemptionMechanism} object that implements the
|
||||
* specified exemption mechanism algorithm.
|
||||
*
|
||||
* <p> A new ExemptionMechanism object encapsulating the
|
||||
* ExemptionMechanismSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* <p> A new {@code ExemptionMechanism} object encapsulating the
|
||||
* {@code 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.
|
||||
*
|
||||
* @param algorithm the standard name of the requested exemption mechanism.
|
||||
|
@ -217,11 +217,11 @@ public class ExemptionMechanism {
|
|||
* @return the new {@code ExemptionMechanism} object
|
||||
*
|
||||
* @throws IllegalArgumentException if the {@code provider}
|
||||
* is null
|
||||
* is {@code null}
|
||||
*
|
||||
* @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi}
|
||||
* implementation for the specified algorithm is not available
|
||||
* from the specified {@code Provider object}
|
||||
* from the specified {@code Provider} object
|
||||
*
|
||||
* @exception NullPointerException if {@code algorithm} is {@code null}
|
||||
*
|
||||
|
@ -237,9 +237,9 @@ public class ExemptionMechanism {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the provider of this <code>ExemptionMechanism</code> object.
|
||||
* Returns the provider of this {@code ExemptionMechanism} object.
|
||||
*
|
||||
* @return the provider of this <code>ExemptionMechanism</code> object.
|
||||
* @return the provider of this {@code ExemptionMechanism} object.
|
||||
*/
|
||||
public final Provider getProvider() {
|
||||
return this.provider;
|
||||
|
@ -256,8 +256,8 @@ public class ExemptionMechanism {
|
|||
* @param key the key the crypto is going to use.
|
||||
*
|
||||
* @return whether the result blob of the same key has been generated
|
||||
* successfully by this exemption mechanism; false if <code>key</code>
|
||||
* is null.
|
||||
* successfully by this exemption mechanism; {@code false} if {@code key}
|
||||
* is {@code null}.
|
||||
*
|
||||
* @exception ExemptionMechanismException if problem(s) encountered
|
||||
* while determining whether the result blob has been generated successfully
|
||||
|
@ -278,7 +278,7 @@ public class ExemptionMechanism {
|
|||
* Returns the length in bytes that an output buffer would need to be in
|
||||
* order to hold the result of the next
|
||||
* {@link #genExemptionBlob(byte[]) genExemptionBlob}
|
||||
* operation, given the input length <code>inputLen</code> (in bytes).
|
||||
* operation, given the input length {@code inputLen} (in bytes).
|
||||
*
|
||||
* <p>The actual output length of the next
|
||||
* {@link #genExemptionBlob(byte[]) genExemptionBlob}
|
||||
|
@ -307,11 +307,11 @@ public class ExemptionMechanism {
|
|||
* Initializes this exemption mechanism with a key.
|
||||
*
|
||||
* <p>If this exemption mechanism requires any algorithm parameters
|
||||
* that cannot be derived from the given <code>key</code>, the
|
||||
* that cannot be derived from the given {@code 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 <code>InvalidKeyException</code> is raised.
|
||||
* specified by the caller, an {@code InvalidKeyException} is raised.
|
||||
*
|
||||
* @param key the key for this exemption mechanism
|
||||
*
|
||||
|
@ -335,11 +335,11 @@ public class ExemptionMechanism {
|
|||
* parameters.
|
||||
*
|
||||
* <p>If this exemption mechanism requires any algorithm parameters
|
||||
* and <code>params</code> is null, the underlying exemption
|
||||
* and {@code params} is {@code 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
|
||||
* <code>InvalidAlgorithmParameterException</code> is raised.
|
||||
* {@code InvalidAlgorithmParameterException} is raised.
|
||||
*
|
||||
* @param key the key for this exemption mechanism
|
||||
* @param params the algorithm parameters
|
||||
|
@ -367,11 +367,11 @@ public class ExemptionMechanism {
|
|||
* parameters.
|
||||
*
|
||||
* <p>If this exemption mechanism requires any algorithm parameters
|
||||
* and <code>params</code> is null, the underlying exemption mechanism
|
||||
* and {@code params} is {@code 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
|
||||
* <code>InvalidAlgorithmParameterException</code> is raised.
|
||||
* {@code InvalidAlgorithmParameterException} is raised.
|
||||
*
|
||||
* @param key the key for this exemption mechanism
|
||||
* @param params the algorithm parameters
|
||||
|
@ -417,17 +417,17 @@ public class ExemptionMechanism {
|
|||
|
||||
/**
|
||||
* Generates the exemption mechanism key blob, and stores the result in
|
||||
* the <code>output</code> buffer.
|
||||
* the {@code output} buffer.
|
||||
*
|
||||
* <p>If the <code>output</code> buffer is too small to hold the result,
|
||||
* a <code>ShortBufferException</code> is thrown. In this case, repeat this
|
||||
* <p>If the {@code output} buffer is too small to hold the result,
|
||||
* a {@code ShortBufferException} is thrown. In this case, repeat this
|
||||
* call with a larger output buffer. Use
|
||||
* {@link #getOutputSize(int) getOutputSize} to determine how big
|
||||
* the output buffer should be.
|
||||
*
|
||||
* @param output the buffer for the result
|
||||
*
|
||||
* @return the number of bytes stored in <code>output</code>
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @exception IllegalStateException if this exemption mechanism is in
|
||||
* a wrong state (e.g., has not been initialized).
|
||||
|
@ -450,20 +450,20 @@ public class ExemptionMechanism {
|
|||
|
||||
/**
|
||||
* Generates the exemption mechanism key blob, and stores the result in
|
||||
* the <code>output</code> buffer, starting at <code>outputOffset</code>
|
||||
* the {@code output} buffer, starting at {@code outputOffset}
|
||||
* inclusive.
|
||||
*
|
||||
* <p>If the <code>output</code> buffer is too small to hold the result,
|
||||
* a <code>ShortBufferException</code> is thrown. In this case, repeat this
|
||||
* <p>If the {@code output} buffer is too small to hold the result,
|
||||
* a {@code ShortBufferException} is thrown. In this case, repeat this
|
||||
* call with a larger output buffer. Use
|
||||
* {@link #getOutputSize(int) getOutputSize} to determine how big
|
||||
* the output buffer should be.
|
||||
*
|
||||
* @param output the buffer for the result
|
||||
* @param outputOffset the offset in <code>output</code> where the result
|
||||
* @param outputOffset the offset in {@code output} where the result
|
||||
* is stored
|
||||
*
|
||||
* @return the number of bytes stored in <code>output</code>
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @exception IllegalStateException if this exemption mechanism is in
|
||||
* a wrong state (e.g., has not been initialized).
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -39,17 +39,17 @@ public class ExemptionMechanismException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = 1572699429277957109L;
|
||||
|
||||
/**
|
||||
* Constructs a ExemptionMechanismException with no detailed message.
|
||||
* (A detailed message is a String that describes this particular
|
||||
* exception.)
|
||||
* Constructs an {@code ExemptionMechanismException} with no detailed
|
||||
* message. (A detailed message is a {@code String} that describes this
|
||||
* particular exception.)
|
||||
*/
|
||||
public ExemptionMechanismException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a ExemptionMechanismException with the specified
|
||||
* detailed message. (A detailed message is a String that describes
|
||||
* Constructs an {@code ExemptionMechanismException} with the specified
|
||||
* detailed message. (A detailed message is a {@code String} that describes
|
||||
* this particular exception.)
|
||||
*
|
||||
* @param msg the detailed message.
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.security.spec.AlgorithmParameterSpec;
|
|||
|
||||
/**
|
||||
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
|
||||
* for the <code>ExemptionMechanism</code> class.
|
||||
* for the {@code ExemptionMechanism} class.
|
||||
* All the abstract methods in this class must be implemented by each
|
||||
* cryptographic service provider who wishes to supply the implementation
|
||||
* of a particular exemption mechanism.
|
||||
|
@ -54,7 +54,7 @@ public abstract class ExemptionMechanismSpi {
|
|||
* Returns the length in bytes that an output buffer would need to be in
|
||||
* order to hold the result of the next
|
||||
* {@link #engineGenExemptionBlob(byte[], int) engineGenExemptionBlob}
|
||||
* operation, given the input length <code>inputLen</code> (in bytes).
|
||||
* operation, given the input length {@code inputLen} (in bytes).
|
||||
*
|
||||
* <p>The actual output length of the next
|
||||
* {@link #engineGenExemptionBlob(byte[], int) engineGenExemptionBlob}
|
||||
|
@ -70,11 +70,11 @@ public abstract class ExemptionMechanismSpi {
|
|||
* Initializes this exemption mechanism with a key.
|
||||
*
|
||||
* <p>If this exemption mechanism requires any algorithm parameters
|
||||
* that cannot be derived from the given <code>key</code>, the underlying
|
||||
* that cannot be derived from the given {@code 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
|
||||
* <code>InvalidKeyException</code> is raised.
|
||||
* {@code InvalidKeyException} is raised.
|
||||
*
|
||||
* @param key the key for this exemption mechanism
|
||||
*
|
||||
|
@ -91,11 +91,11 @@ public abstract class ExemptionMechanismSpi {
|
|||
* parameters.
|
||||
*
|
||||
* <p>If this exemption mechanism requires any algorithm parameters and
|
||||
* <code>params</code> is null, the underlying exemption mechanism
|
||||
* {@code 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
|
||||
* <code>InvalidAlgorithmParameterException</code> is raised.
|
||||
* {@code InvalidAlgorithmParameterException} is raised.
|
||||
*
|
||||
* @param key the key for this exemption mechanism
|
||||
* @param params the algorithm parameters
|
||||
|
@ -116,11 +116,11 @@ public abstract class ExemptionMechanismSpi {
|
|||
* parameters.
|
||||
*
|
||||
* <p>If this exemption mechanism requires any algorithm parameters
|
||||
* and <code>params</code> is null, the underlying exemption mechanism
|
||||
* and {@code 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
|
||||
* <code>InvalidAlgorithmParameterException</code> is raised.
|
||||
* {@code InvalidAlgorithmParameterException} is raised.
|
||||
*
|
||||
* @param key the key for this exemption mechanism
|
||||
* @param params the algorithm parameters
|
||||
|
@ -149,20 +149,20 @@ public abstract class ExemptionMechanismSpi {
|
|||
|
||||
/**
|
||||
* Generates the exemption mechanism key blob, and stores the result in
|
||||
* the <code>output</code> buffer, starting at <code>outputOffset</code>
|
||||
* the {@code output} buffer, starting at {@code outputOffset}
|
||||
* inclusive.
|
||||
*
|
||||
* <p>If the <code>output</code> buffer is too small to hold the result,
|
||||
* a <code>ShortBufferException</code> is thrown. In this case, repeat this
|
||||
* <p>If the {@code output} buffer is too small to hold the result,
|
||||
* a {@code ShortBufferException} is thrown. In this case, repeat this
|
||||
* call with a larger output buffer. Use
|
||||
* {@link #engineGetOutputSize(int) engineGetOutputSize} to determine
|
||||
* how big the output buffer should be.
|
||||
*
|
||||
* @param output the buffer for the result
|
||||
* @param outputOffset the offset in <code>output</code> where the result
|
||||
* @param outputOffset the offset in {@code output} where the result
|
||||
* is stored
|
||||
*
|
||||
* @return the number of bytes stored in <code>output</code>
|
||||
* @return the number of bytes stored in {@code output}
|
||||
*
|
||||
* @exception ShortBufferException if the given output buffer is too small
|
||||
* to hold the result.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -41,8 +41,8 @@ public class IllegalBlockSizeException
|
|||
private static final long serialVersionUID = -1965144811953540392L;
|
||||
|
||||
/**
|
||||
* Constructs an IllegalBlockSizeException with no detail message.
|
||||
* A detail message is a String that describes this particular
|
||||
* Constructs an {@code IllegalBlockSizeException} with no detail message.
|
||||
* A detail message is a {@code String} that describes this particular
|
||||
* exception.
|
||||
*/
|
||||
public IllegalBlockSizeException() {
|
||||
|
@ -50,7 +50,7 @@ public class IllegalBlockSizeException
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs an IllegalBlockSizeException with the specified
|
||||
* Constructs an {@code IllegalBlockSizeException} with the specified
|
||||
* detail message.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -105,7 +105,7 @@ public class KeyAgreement {
|
|||
private final Object lock;
|
||||
|
||||
/**
|
||||
* Creates a KeyAgreement object.
|
||||
* Creates a {@code KeyAgreement} object.
|
||||
*
|
||||
* @param keyAgreeSpi the delegate
|
||||
* @param provider the provider
|
||||
|
@ -143,11 +143,11 @@ public class KeyAgreement {
|
|||
* Returns a {@code KeyAgreement} object that implements the
|
||||
* specified key agreement algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new KeyAgreement object encapsulating the
|
||||
* KeyAgreementSpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code KeyAgreement} object encapsulating the
|
||||
* {@code KeyAgreementSpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -199,8 +199,8 @@ public class KeyAgreement {
|
|||
* Returns a {@code KeyAgreement} object that implements the
|
||||
* specified key agreement algorithm.
|
||||
*
|
||||
* <p> A new KeyAgreement object encapsulating the
|
||||
* KeyAgreementSpi implementation from the specified provider
|
||||
* <p> A new {@code KeyAgreement} object encapsulating the
|
||||
* {@code KeyAgreementSpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -246,9 +246,9 @@ public class KeyAgreement {
|
|||
* Returns a {@code KeyAgreement} object that implements the
|
||||
* specified key agreement algorithm.
|
||||
*
|
||||
* <p> A new KeyAgreement object encapsulating the
|
||||
* KeyAgreementSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* <p> A new {@code KeyAgreement} object encapsulating the
|
||||
* {@code KeyAgreementSpi} implementation from the specified
|
||||
* provider is returned. Note that the specified provider
|
||||
* does not have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the standard name of the requested key agreement
|
||||
|
@ -267,7 +267,7 @@ public class KeyAgreement {
|
|||
*
|
||||
* @throws NoSuchAlgorithmException if a {@code KeyAgreementSpi}
|
||||
* implementation for the specified algorithm is not available
|
||||
* from the specified Provider object
|
||||
* from the specified {@code Provider} object
|
||||
*
|
||||
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||
*
|
||||
|
@ -437,7 +437,8 @@ public class KeyAgreement {
|
|||
* implementation of the highest-priority
|
||||
* installed provider as the source of randomness.
|
||||
* (If none of the installed providers supply an implementation of
|
||||
* SecureRandom, a system-provided source of randomness will be used.)
|
||||
* {@code SecureRandom}, a system-provided source of randomness
|
||||
* will be used.)
|
||||
*
|
||||
* @param key the party's private information. For example, in the case
|
||||
* of the Diffie-Hellman key agreement, this would be the party's own
|
||||
|
@ -500,7 +501,8 @@ public class KeyAgreement {
|
|||
* implementation of the highest-priority
|
||||
* installed provider as the source of randomness.
|
||||
* (If none of the installed providers supply an implementation of
|
||||
* SecureRandom, a system-provided source of randomness will be used.)
|
||||
* {@code SecureRandom}, a system-provided source of randomness
|
||||
* will be used.)
|
||||
*
|
||||
* @param key the party's private information. For example, in the case
|
||||
* of the Diffie-Hellman key agreement, this would be the party's own
|
||||
|
@ -566,7 +568,7 @@ public class KeyAgreement {
|
|||
* @param lastPhase flag which indicates whether this is the last
|
||||
* phase of this key agreement.
|
||||
*
|
||||
* @return the (intermediate) key resulting from this phase, or null
|
||||
* @return the (intermediate) key resulting from this phase, or {@code null}
|
||||
* if this phase does not yield a key
|
||||
*
|
||||
* @exception InvalidKeyException if the given key is inappropriate for
|
||||
|
|
|
@ -30,27 +30,27 @@ import java.security.spec.*;
|
|||
|
||||
/**
|
||||
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
|
||||
* for the <code>KeyAgreement</code> class.
|
||||
* for the {@code KeyAgreement} class.
|
||||
* All the abstract methods in this class must be implemented by each
|
||||
* cryptographic service provider who wishes to supply the implementation
|
||||
* of a particular key agreement algorithm.
|
||||
*
|
||||
* <p> The keys involved in establishing a shared secret are created by one
|
||||
* of the
|
||||
* key generators (<code>KeyPairGenerator</code> or
|
||||
* <code>KeyGenerator</code>), a <code>KeyFactory</code>, or as a result from
|
||||
* key generators ({@code KeyPairGenerator} or
|
||||
* {@code KeyGenerator}), a {@code KeyFactory}, or as a result from
|
||||
* an intermediate phase of the key agreement protocol
|
||||
* ({@link #engineDoPhase(java.security.Key, boolean) engineDoPhase}).
|
||||
*
|
||||
* <p> For each of the correspondents in the key exchange,
|
||||
* <code>engineDoPhase</code>
|
||||
* {@code engineDoPhase}
|
||||
* needs to be called. For example, if the key exchange is with one other
|
||||
* party, <code>engineDoPhase</code> needs to be called once, with the
|
||||
* <code>lastPhase</code> flag set to <code>true</code>.
|
||||
* party, {@code engineDoPhase} needs to be called once, with the
|
||||
* {@code lastPhase} flag set to {@code true}.
|
||||
* If the key exchange is
|
||||
* with two other parties, <code>engineDoPhase</code> needs to be called twice,
|
||||
* the first time setting the <code>lastPhase</code> flag to
|
||||
* <code>false</code>, and the second time setting it to <code>true</code>.
|
||||
* with two other parties, {@code engineDoPhase} needs to be called twice,
|
||||
* the first time setting the {@code lastPhase} flag to
|
||||
* {@code false}, and the second time setting it to {@code true}.
|
||||
* There may be any number of parties involved in a key exchange.
|
||||
*
|
||||
* @author Jan Luehe
|
||||
|
@ -73,10 +73,10 @@ public abstract class KeyAgreementSpi {
|
|||
* parameters required for this key agreement.
|
||||
*
|
||||
* <p> If the key agreement algorithm requires random bytes, it gets them
|
||||
* from the given source of randomness, <code>random</code>.
|
||||
* from the given source of randomness, {@code random}.
|
||||
* However, if the underlying
|
||||
* algorithm implementation does not require any random bytes,
|
||||
* <code>random</code> is ignored.
|
||||
* {@code random} is ignored.
|
||||
*
|
||||
* @param key the party's private information. For example, in the case
|
||||
* of the Diffie-Hellman key agreement, this would be the party's own
|
||||
|
@ -121,8 +121,8 @@ public abstract class KeyAgreementSpi {
|
|||
* @param lastPhase flag which indicates whether this is the last
|
||||
* phase of this key agreement.
|
||||
*
|
||||
* @return the (intermediate) key resulting from this phase, or null if
|
||||
* this phase does not yield a key
|
||||
* @return the (intermediate) key resulting from this phase,
|
||||
* or {@code null} if this phase does not yield a key
|
||||
*
|
||||
* @exception InvalidKeyException if the given key is inappropriate for
|
||||
* this phase.
|
||||
|
@ -157,10 +157,10 @@ public abstract class KeyAgreementSpi {
|
|||
|
||||
/**
|
||||
* Generates the shared secret, and places it into the buffer
|
||||
* <code>sharedSecret</code>, beginning at <code>offset</code> inclusive.
|
||||
* {@code sharedSecret}, beginning at {@code offset} inclusive.
|
||||
*
|
||||
* <p>If the <code>sharedSecret</code> buffer is too small to hold the
|
||||
* result, a <code>ShortBufferException</code> is thrown.
|
||||
* <p>If the {@code sharedSecret} buffer is too small to hold the
|
||||
* result, a {@code ShortBufferException} is thrown.
|
||||
* In this case, this call should be repeated with a larger output buffer.
|
||||
*
|
||||
* <p>This method resets this {@code KeyAgreementSpi} object to the state
|
||||
|
@ -175,10 +175,10 @@ public abstract class KeyAgreementSpi {
|
|||
* subsequent operations.
|
||||
*
|
||||
* @param sharedSecret the buffer for the shared secret
|
||||
* @param offset the offset in <code>sharedSecret</code> where the
|
||||
* @param offset the offset in {@code sharedSecret} where the
|
||||
* shared secret will be stored
|
||||
*
|
||||
* @return the number of bytes placed into <code>sharedSecret</code>
|
||||
* @return the number of bytes placed into {@code sharedSecret}
|
||||
*
|
||||
* @exception IllegalStateException if this key agreement has not been
|
||||
* initialized or if {@code doPhase} has not been called to supply the
|
||||
|
|
|
@ -41,9 +41,9 @@ import sun.security.util.Debug;
|
|||
* <p>Key generators are constructed using one of the {@code getInstance}
|
||||
* class methods of this class.
|
||||
*
|
||||
* <p>KeyGenerator objects are reusable, i.e., after a key has been
|
||||
* generated, the same KeyGenerator object can be re-used to generate further
|
||||
* keys.
|
||||
* <p>{@code KeyGenerator} objects are reusable, i.e., after a key has been
|
||||
* generated, the same {@code KeyGenerator} object can be re-used
|
||||
* to generate further keys.
|
||||
*
|
||||
* <p>There are two ways to generate a key: in an algorithm-independent
|
||||
* manner, and in an algorithm-specific manner.
|
||||
|
@ -55,9 +55,9 @@ import sun.security.util.Debug;
|
|||
* <i>source of randomness</i>.
|
||||
* There is an
|
||||
* {@link #init(int, java.security.SecureRandom) init}
|
||||
* method in this KeyGenerator class that takes these two universally
|
||||
* method in this {@code KeyGenerator} class that takes these two universally
|
||||
* shared types of arguments. There is also one that takes just a
|
||||
* {@code keysize} argument, and uses the SecureRandom implementation
|
||||
* {@code keysize} argument, and uses the {@code SecureRandom} implementation
|
||||
* of the highest-priority installed provider as the source of randomness
|
||||
* (or a system-provided source of randomness if none of the installed
|
||||
* providers supply a SecureRandom implementation), and one that takes just a
|
||||
|
@ -80,17 +80,17 @@ import sun.security.util.Debug;
|
|||
* providers supply a SecureRandom implementation).
|
||||
* </ul>
|
||||
*
|
||||
* <p>In case the client does not explicitly initialize the KeyGenerator
|
||||
* <p>In case the client does not explicitly initialize the {@code KeyGenerator}
|
||||
* (via a call to an {@code init} method), each provider must
|
||||
* supply (and document) a default initialization.
|
||||
* See the Keysize Restriction sections of the
|
||||
* {@extLink security_guide_jdk_providers JDK Providers}
|
||||
* document for information on the KeyGenerator defaults used by
|
||||
* document for information on the {@code KeyGenerator} defaults used by
|
||||
* JDK providers.
|
||||
* However, note that defaults may vary across different providers.
|
||||
* Additionally, the default value for a provider may change in a future
|
||||
* version. Therefore, it is recommended to explicitly initialize the
|
||||
* KeyGenerator instead of relying on provider-specific defaults.
|
||||
* {@code KeyGenerator} instead of relying on provider-specific defaults.
|
||||
*
|
||||
* <p> Every implementation of the Java platform is required to support the
|
||||
* following standard {@code KeyGenerator} algorithms with the keysizes in
|
||||
|
@ -147,7 +147,7 @@ public class KeyGenerator {
|
|||
private SecureRandom initRandom;
|
||||
|
||||
/**
|
||||
* Creates a KeyGenerator object.
|
||||
* Creates a {@code KeyGenerator} object.
|
||||
*
|
||||
* @param keyGenSpi the delegate
|
||||
* @param provider the provider
|
||||
|
@ -204,11 +204,11 @@ public class KeyGenerator {
|
|||
* Returns a {@code KeyGenerator} object that generates secret keys
|
||||
* for the specified algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new KeyGenerator object encapsulating the
|
||||
* KeyGeneratorSpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code KeyGenerator} object encapsulating the
|
||||
* {@code KeyGeneratorSpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -247,8 +247,8 @@ public class KeyGenerator {
|
|||
* Returns a {@code KeyGenerator} object that generates secret keys
|
||||
* for the specified algorithm.
|
||||
*
|
||||
* <p> A new KeyGenerator object encapsulating the
|
||||
* KeyGeneratorSpi implementation from the specified provider
|
||||
* <p> A new {@code KeyGenerator} object encapsulating the
|
||||
* {@code KeyGeneratorSpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -293,9 +293,9 @@ public class KeyGenerator {
|
|||
* Returns a {@code KeyGenerator} object that generates secret keys
|
||||
* for the specified algorithm.
|
||||
*
|
||||
* <p> A new KeyGenerator object encapsulating the
|
||||
* KeyGeneratorSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* <p> A new {@code KeyGenerator} object encapsulating the
|
||||
* {@code KeyGeneratorSpi} implementation from the specified provider
|
||||
* object is returned. Note that the specified provider object
|
||||
* does not have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the standard name of the requested key algorithm.
|
||||
|
@ -343,8 +343,8 @@ public class KeyGenerator {
|
|||
/**
|
||||
* Update the active spi of this class and return the next
|
||||
* implementation for failover. If no more implementations are
|
||||
* available, this method returns null. However, the active spi of
|
||||
* this class is never set to null.
|
||||
* available, this method returns {@code null}. However, the active spi of
|
||||
* this class is never set to {@code null}.
|
||||
*/
|
||||
private KeyGeneratorSpi nextSpi(KeyGeneratorSpi oldSpi,
|
||||
boolean reinit) {
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.security.spec.*;
|
|||
|
||||
/**
|
||||
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
|
||||
* for the <code>KeyGenerator</code> class.
|
||||
* for the {@code KeyGenerator} class.
|
||||
* All the abstract methods in this class must be implemented by each
|
||||
* cryptographic service provider who wishes to supply the implementation
|
||||
* of a key generator for a particular algorithm.
|
||||
|
@ -74,7 +74,7 @@ public abstract class KeyGeneratorSpi {
|
|||
* @param params the key generation parameters
|
||||
* @param random the source of randomness for this key generator
|
||||
*
|
||||
* @exception InvalidAlgorithmParameterException if <code>params</code> is
|
||||
* @exception InvalidAlgorithmParameterException if {@code params} is
|
||||
* inappropriate for this key generator
|
||||
*/
|
||||
protected abstract void engineInit(AlgorithmParameterSpec params,
|
||||
|
|
|
@ -142,11 +142,11 @@ public class Mac implements Cloneable {
|
|||
* Returns a {@code Mac} object that implements the
|
||||
* specified MAC algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new Mac object encapsulating the
|
||||
* MacSpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code Mac} object encapsulating the
|
||||
* {@code MacSpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -195,8 +195,8 @@ public class Mac implements Cloneable {
|
|||
* Returns a {@code Mac} object that implements the
|
||||
* specified MAC algorithm.
|
||||
*
|
||||
* <p> A new Mac object encapsulating the
|
||||
* MacSpi implementation from the specified provider
|
||||
* <p> A new {@code Mac} object encapsulating the
|
||||
* {@code MacSpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -239,9 +239,9 @@ public class Mac implements Cloneable {
|
|||
* Returns a {@code Mac} object that implements the
|
||||
* specified MAC algorithm.
|
||||
*
|
||||
* <p> A new Mac object encapsulating the
|
||||
* MacSpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* <p> A new {@code Mac} object encapsulating the
|
||||
* {@code MacSpi} implementation from the specified provider
|
||||
* is returned. Note that the specified provider
|
||||
* does not have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the standard name of the requested MAC algorithm.
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.nio.ByteBuffer;
|
|||
|
||||
/**
|
||||
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
|
||||
* for the <code>Mac</code> class.
|
||||
* for the {@code Mac} class.
|
||||
* All the abstract methods in this class must be implemented by each
|
||||
* cryptographic service provider who wishes to supply the implementation
|
||||
* of a particular MAC algorithm.
|
||||
|
@ -82,18 +82,18 @@ public abstract class MacSpi {
|
|||
protected abstract void engineUpdate(byte input);
|
||||
|
||||
/**
|
||||
* Processes the first <code>len</code> bytes in <code>input</code>,
|
||||
* starting at <code>offset</code> inclusive.
|
||||
* Processes the first {@code len} bytes in {@code input},
|
||||
* starting at {@code offset} inclusive.
|
||||
*
|
||||
* @param input the input buffer.
|
||||
* @param offset the offset in <code>input</code> where the input starts.
|
||||
* @param offset the offset in {@code input} where the input starts.
|
||||
* @param len the number of bytes to process.
|
||||
*/
|
||||
protected abstract void engineUpdate(byte[] input, int offset, int len);
|
||||
|
||||
/**
|
||||
* Processes <code>input.remaining()</code> bytes in the ByteBuffer
|
||||
* <code>input</code>, starting at <code>input.position()</code>.
|
||||
* Processes {@code input.remaining()} bytes in the ByteBuffer
|
||||
* {@code input}, starting at {@code input.position()}.
|
||||
* Upon return, the buffer's position will be equal to its limit;
|
||||
* its limit will not have changed.
|
||||
*
|
||||
|
@ -146,7 +146,7 @@ public abstract class MacSpi {
|
|||
* @return a clone if the implementation is cloneable.
|
||||
*
|
||||
* @exception CloneNotSupportedException if this is called
|
||||
* on an implementation that does not support <code>Cloneable</code>.
|
||||
* on an implementation that does not support {@code Cloneable}.
|
||||
*/
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
if (this instanceof Cloneable) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -42,8 +42,8 @@ public class NoSuchPaddingException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = -4572885201200175466L;
|
||||
|
||||
/**
|
||||
* Constructs a NoSuchPaddingException with no detail
|
||||
* message. A detail message is a String that describes this
|
||||
* Constructs a {@code NoSuchPaddingException} with no detail
|
||||
* message. A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*/
|
||||
public NoSuchPaddingException() {
|
||||
|
@ -51,7 +51,7 @@ public class NoSuchPaddingException extends GeneralSecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a NoSuchPaddingException with the specified
|
||||
* Constructs a {@code NoSuchPaddingException} with the specified
|
||||
* detail message.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -26,7 +26,7 @@
|
|||
package javax.crypto;
|
||||
|
||||
/**
|
||||
* The NullCipher class is a class that provides an
|
||||
* The {@code NullCipher} class is a class that provides an
|
||||
* "identity cipher" -- one that does not transform the plain text. As
|
||||
* a consequence, the ciphertext is identical to the plaintext. All
|
||||
* initialization methods do nothing, while the blocksize is set to 1
|
||||
|
@ -39,7 +39,7 @@ package javax.crypto;
|
|||
public class NullCipher extends Cipher {
|
||||
|
||||
/**
|
||||
* Creates a NullCipher object.
|
||||
* Creates a {@code NullCipher} object.
|
||||
*/
|
||||
public NullCipher() {
|
||||
super(new NullCipherSpi(), null);
|
||||
|
|
|
@ -51,10 +51,10 @@ final class ProviderVerifier {
|
|||
private CryptoPermissions appPerms = null;
|
||||
|
||||
/**
|
||||
* Creates a ProviderVerifier object to verify the given URL.
|
||||
* Creates a {@code ProviderVerifier} object to verify the given URL.
|
||||
*
|
||||
* @param jarURL the JAR file to be verified.
|
||||
* @param savePerms if true, save the permissions allowed by the
|
||||
* @param savePerms if {@code true}, save the permissions allowed by the
|
||||
* exemption mechanism
|
||||
*/
|
||||
ProviderVerifier(URL jarURL, boolean savePerms) {
|
||||
|
@ -62,11 +62,11 @@ final class ProviderVerifier {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a ProviderVerifier object to verify the given URL.
|
||||
* Creates a {@code ProviderVerifier} object to verify the given URL.
|
||||
*
|
||||
* @param jarURL the JAR file to be verified
|
||||
* @param provider the corresponding provider.
|
||||
* @param savePerms if true, save the permissions allowed by the
|
||||
* @param savePerms if {@code true}, save the permissions allowed by the
|
||||
* exemption mechanism
|
||||
*/
|
||||
ProviderVerifier(URL jarURL, Provider provider, boolean savePerms) {
|
||||
|
@ -154,7 +154,7 @@ final class ProviderVerifier {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given provider is JDK trusted crypto provider
|
||||
* Returns {@code true} if the given provider is JDK trusted crypto provider
|
||||
* if the implementation supports fast-path verification.
|
||||
*/
|
||||
static boolean isTrustedCryptoProvider(Provider provider) {
|
||||
|
@ -165,8 +165,9 @@ final class ProviderVerifier {
|
|||
* Returns the permissions which are bundled with the JAR file,
|
||||
* aka the "cryptoperms" file.
|
||||
*
|
||||
* NOTE: if this ProviderVerifier instance is constructed with "savePerms"
|
||||
* equal to false, then this method would always return null.
|
||||
* NOTE: if this {@code ProviderVerifier} instance is constructed
|
||||
* with "savePerms" equal to {@code false}, then this method would always
|
||||
* return {@code null}.
|
||||
*/
|
||||
CryptoPermissions getPermissions() {
|
||||
return appPerms;
|
||||
|
|
|
@ -40,17 +40,17 @@ import java.util.Arrays;
|
|||
* This class enables a programmer to create an object and protect its
|
||||
* confidentiality with a cryptographic algorithm.
|
||||
*
|
||||
* <p> Given any Serializable object, one can create a SealedObject
|
||||
* that encapsulates the original object, in serialized
|
||||
* <p> Given any {@code Serializable} object, one can create a
|
||||
* {@code SealedObject} that encapsulates the original object, in serialized
|
||||
* format (i.e., a "deep copy"), and seals (encrypts) its serialized contents,
|
||||
* using a cryptographic algorithm such as AES, to protect its
|
||||
* confidentiality. The encrypted content can later be decrypted (with
|
||||
* the corresponding algorithm using the correct decryption key) and
|
||||
* de-serialized, yielding the original object.
|
||||
*
|
||||
* <p> Note that the Cipher object must be fully initialized with the
|
||||
* correct algorithm, key, padding scheme, etc., before being applied
|
||||
* to a SealedObject.
|
||||
* <p> Note that the {@code Cipher} object must be fully initialized with
|
||||
* the correct algorithm, key, padding scheme, etc., before being applied
|
||||
* to a {@code SealedObject}.
|
||||
*
|
||||
* <p> The original object that was sealed can be recovered in two different
|
||||
* ways:
|
||||
|
@ -58,9 +58,9 @@ import java.util.Arrays;
|
|||
* <ul>
|
||||
*
|
||||
* <li>by using the {@link #getObject(javax.crypto.Cipher) getObject}
|
||||
* method that takes a <code>Cipher</code> object.
|
||||
* method that takes a {@code Cipher} object.
|
||||
*
|
||||
* <p> This method requires a fully initialized <code>Cipher</code> object,
|
||||
* <p> This method requires a fully initialized {@code Cipher} object,
|
||||
* initialized with the
|
||||
* exact same algorithm, key, padding scheme, etc., that were used to seal the
|
||||
* object.
|
||||
|
@ -73,9 +73,9 @@ import java.util.Arrays;
|
|||
*
|
||||
* <li>by using one of the
|
||||
* {@link #getObject(java.security.Key) getObject} methods
|
||||
* that take a <code>Key</code> object.
|
||||
* that take a {@code Key} object.
|
||||
*
|
||||
* <p> In this approach, the <code>getObject</code> method creates a cipher
|
||||
* <p> In this approach, the {@code getObject} method creates a cipher
|
||||
* object for the appropriate decryption algorithm and initializes it with the
|
||||
* given decryption key and the algorithm parameters (if any) that were stored
|
||||
* in the sealed object.
|
||||
|
@ -119,28 +119,29 @@ public class SealedObject implements Serializable {
|
|||
private String paramsAlg = null;
|
||||
|
||||
/**
|
||||
* The cryptographic parameters used by the sealing Cipher,
|
||||
* The cryptographic parameters used by the sealing {@code Cipher} object,
|
||||
* encoded in the default format.
|
||||
* <p>
|
||||
* That is, <code>cipher.getParameters().getEncoded()</code>.
|
||||
* That is, {@code Cipher.getParameters().getEncoded()}.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
protected byte[] encodedParams = null;
|
||||
|
||||
/**
|
||||
* Constructs a SealedObject from any Serializable object.
|
||||
* Constructs a {@code SealedObject} from any {@code Serializable} object.
|
||||
*
|
||||
* <p>The given object is serialized, and its serialized contents are
|
||||
* encrypted using the given Cipher, which must be fully initialized.
|
||||
* encrypted using the given {@code Cipher} object, which must be fully
|
||||
* initialized.
|
||||
*
|
||||
* <p>Any algorithm parameters that may be used in the encryption
|
||||
* operation are stored inside the new <code>SealedObject</code>.
|
||||
* operation are stored inside the new {@code SealedObject}.
|
||||
*
|
||||
* @param object the object to be sealed; can be null.
|
||||
* @param object the object to be sealed; can be {@code null}.
|
||||
* @param c the cipher used to seal the object.
|
||||
*
|
||||
* @exception NullPointerException if the given cipher is null.
|
||||
* @exception NullPointerException if the given cipher is {@code null}.
|
||||
* @exception IOException if an error occurs during serialization
|
||||
* @exception IllegalBlockSizeException if the given cipher is a block
|
||||
* cipher, no padding has been requested, and the total input length
|
||||
|
@ -190,10 +191,12 @@ public class SealedObject implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a SealedObject object from the passed-in SealedObject.
|
||||
* Constructs a {@code SealedObject} object from the passed-in
|
||||
* {@code SealedObject}.
|
||||
*
|
||||
* @param so a SealedObject object
|
||||
* @exception NullPointerException if the given sealed object is null.
|
||||
* @param so a {@code SealedObject} object
|
||||
* @exception NullPointerException if the given sealed object
|
||||
* is {@code null}.
|
||||
*/
|
||||
protected SealedObject(SealedObject so) {
|
||||
this.encryptedContent = so.encryptedContent.clone();
|
||||
|
@ -221,11 +224,13 @@ public class SealedObject implements Serializable {
|
|||
* <p>This method creates a cipher for the algorithm that had been used in
|
||||
* the sealing operation.
|
||||
* If the default provider package provides an implementation of that
|
||||
* algorithm, an instance of Cipher containing that implementation is used.
|
||||
* algorithm, a {@code Cipher} object containing that
|
||||
* implementation is used.
|
||||
* If the algorithm is not available in the default package, other
|
||||
* packages are searched.
|
||||
* The Cipher object is initialized for decryption, using the given
|
||||
* <code>key</code> and the parameters (if any) that had been used in the
|
||||
* The {@code Cipher} object is initialized for decryption,
|
||||
* using the given
|
||||
* {@code key} and the parameters (if any) that had been used in the
|
||||
* sealing operation.
|
||||
*
|
||||
* <p>The encapsulated object is unsealed and de-serialized, before it is
|
||||
|
@ -242,7 +247,7 @@ public class SealedObject implements Serializable {
|
|||
* object is not available.
|
||||
* @exception InvalidKeyException if the given key cannot be used to unseal
|
||||
* the object (e.g., it has the wrong algorithm).
|
||||
* @exception NullPointerException if <code>key</code> is null.
|
||||
* @exception NullPointerException if {@code key} is null.
|
||||
*/
|
||||
public final Object getObject(Key key)
|
||||
throws IOException, ClassNotFoundException, NoSuchAlgorithmException,
|
||||
|
@ -267,15 +272,16 @@ public class SealedObject implements Serializable {
|
|||
/**
|
||||
* Retrieves the original (encapsulated) object.
|
||||
*
|
||||
* <p>The encapsulated object is unsealed (using the given Cipher,
|
||||
* assuming that the Cipher is already properly initialized) and
|
||||
* de-serialized, before it is returned.
|
||||
* <p>The encapsulated object is unsealed (using the given
|
||||
* {@code Cipher} object,
|
||||
* assuming that the {@code Cipher} object is already properly initialized)
|
||||
* and de-serialized, before it is returned.
|
||||
*
|
||||
* @param c the cipher used to unseal the object
|
||||
*
|
||||
* @return the original object.
|
||||
*
|
||||
* @exception NullPointerException if the given cipher is null.
|
||||
* @exception NullPointerException if the given cipher is {@code null}.
|
||||
* @exception IOException if an error occurs during de-serialization
|
||||
* @exception ClassNotFoundException if an error occurs during
|
||||
* de-serialization
|
||||
|
@ -300,9 +306,10 @@ public class SealedObject implements Serializable {
|
|||
*
|
||||
* <p>This method creates a cipher for the algorithm that had been used in
|
||||
* the sealing operation, using an implementation of that algorithm from
|
||||
* the given <code>provider</code>.
|
||||
* The Cipher object is initialized for decryption, using the given
|
||||
* <code>key</code> and the parameters (if any) that had been used in the
|
||||
* the given {@code provider}.
|
||||
* The {@code Cipher} object is initialized for decryption,
|
||||
* using the given
|
||||
* {@code key} and the parameters (if any) that had been used in the
|
||||
* sealing operation.
|
||||
*
|
||||
* <p>The encapsulated object is unsealed and de-serialized, before it is
|
||||
|
@ -314,7 +321,7 @@ public class SealedObject implements Serializable {
|
|||
*
|
||||
* @return the original object.
|
||||
*
|
||||
* @exception IllegalArgumentException if the given provider is null
|
||||
* @exception IllegalArgumentException if the given provider is {@code null}
|
||||
* or empty.
|
||||
* @exception IOException if an error occurs during de-serialization.
|
||||
* @exception ClassNotFoundException if an error occurs during
|
||||
|
@ -325,7 +332,7 @@ public class SealedObject implements Serializable {
|
|||
* configured.
|
||||
* @exception InvalidKeyException if the given key cannot be used to unseal
|
||||
* the object (e.g., it has the wrong algorithm).
|
||||
* @exception NullPointerException if <code>key</code> is null.
|
||||
* @exception NullPointerException if {@code key} is null.
|
||||
*/
|
||||
public final Object getObject(Key key, String provider)
|
||||
throws IOException, ClassNotFoundException, NoSuchAlgorithmException,
|
||||
|
@ -412,12 +419,12 @@ public class SealedObject implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Restores the state of the SealedObject from a stream.
|
||||
* Restores the state of the {@code SealedObject} from a stream.
|
||||
*
|
||||
* @param s the object input stream.
|
||||
* @throws IOException if an I/O error occurs
|
||||
* @throws ClassNotFoundException if a serialized class cannot be loaded
|
||||
* @throws NullPointerException if s is null
|
||||
* @throws NullPointerException if s is {@code null}
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
|
|
|
@ -95,7 +95,7 @@ public class SecretKeyFactory {
|
|||
private Iterator<Service> serviceIterator;
|
||||
|
||||
/**
|
||||
* Creates a SecretKeyFactory object.
|
||||
* Creates a {@code SecretKeyFactory} object.
|
||||
*
|
||||
* @param keyFacSpi the delegate
|
||||
* @param provider the provider
|
||||
|
@ -124,11 +124,11 @@ public class SecretKeyFactory {
|
|||
* Returns a {@code SecretKeyFactory} object that converts
|
||||
* secret keys of the specified algorithm.
|
||||
*
|
||||
* <p> This method traverses the list of registered security Providers,
|
||||
* starting with the most preferred Provider.
|
||||
* A new SecretKeyFactory object encapsulating the
|
||||
* SecretKeyFactorySpi implementation from the first
|
||||
* Provider that supports the specified algorithm is returned.
|
||||
* <p> This method traverses the list of registered security providers,
|
||||
* starting with the most preferred provider.
|
||||
* A new {@code SecretKeyFactory} object encapsulating the
|
||||
* {@code SecretKeyFactorySpi} implementation from the first
|
||||
* provider that supports the specified algorithm is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
|
@ -168,8 +168,8 @@ public class SecretKeyFactory {
|
|||
* Returns a {@code SecretKeyFactory} object that converts
|
||||
* secret keys of the specified algorithm.
|
||||
*
|
||||
* <p> A new SecretKeyFactory object encapsulating the
|
||||
* SecretKeyFactorySpi implementation from the specified provider
|
||||
* <p> A new {@code SecretKeyFactory} object encapsulating the
|
||||
* {@code SecretKeyFactorySpi} implementation from the specified provider
|
||||
* is returned. The specified provider must be registered
|
||||
* in the security provider list.
|
||||
*
|
||||
|
@ -215,9 +215,9 @@ public class SecretKeyFactory {
|
|||
* Returns a {@code SecretKeyFactory} object that converts
|
||||
* secret keys of the specified algorithm.
|
||||
*
|
||||
* <p> A new SecretKeyFactory object encapsulating the
|
||||
* SecretKeyFactorySpi implementation from the specified Provider
|
||||
* object is returned. Note that the specified Provider object
|
||||
* <p> A new {@code SecretKeyFactory} object encapsulating the
|
||||
* {@code SecretKeyFactorySpi} implementation from the specified provider
|
||||
* object is returned. Note that the specified provider object
|
||||
* does not have to be registered in the provider list.
|
||||
*
|
||||
* @param algorithm the standard name of the requested secret-key
|
||||
|
@ -281,8 +281,8 @@ public class SecretKeyFactory {
|
|||
/**
|
||||
* Update the active spi of this class and return the next
|
||||
* implementation for failover. If no more implementations are
|
||||
* available, this method returns null. However, the active spi of
|
||||
* this class is never set to null.
|
||||
* available, this method returns {@code null}. However, the active spi of
|
||||
* this class is never set to {@code null}.
|
||||
*/
|
||||
private SecretKeyFactorySpi nextSpi(SecretKeyFactorySpi oldSpi) {
|
||||
synchronized (lock) {
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.security.spec.*;
|
|||
|
||||
/**
|
||||
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
|
||||
* for the <code>SecretKeyFactory</code> class.
|
||||
* for the {@code SecretKeyFactory} class.
|
||||
* All the abstract methods in this class must be implemented by each
|
||||
* cryptographic service provider who wishes to supply the implementation
|
||||
* of a secret-key factory for a particular algorithm.
|
||||
|
@ -38,9 +38,9 @@ import java.security.spec.*;
|
|||
* <P> A provider should document all the key specifications supported by its
|
||||
* secret key factory.
|
||||
* For example, the DES secret-key factory supplied by the "SunJCE" provider
|
||||
* supports <code>DESKeySpec</code> as a transparent representation of DES
|
||||
* supports {@code DESKeySpec} as a transparent representation of DES
|
||||
* keys, and that provider's secret-key factory for Triple DES keys supports
|
||||
* <code>DESedeKeySpec</code> as a transparent representation of Triple DES
|
||||
* {@code DESedeKeySpec} as a transparent representation of Triple DES
|
||||
* keys.
|
||||
*
|
||||
* @author Jan Luehe
|
||||
|
@ -59,7 +59,7 @@ public abstract class SecretKeyFactorySpi {
|
|||
public SecretKeyFactorySpi() {}
|
||||
|
||||
/**
|
||||
* Generates a <code>SecretKey</code> object from the
|
||||
* Generates a {@code SecretKey} object from the
|
||||
* provided key specification (key material).
|
||||
*
|
||||
* @param keySpec the specification (key material) of the secret key
|
||||
|
@ -86,9 +86,9 @@ public abstract class SecretKeyFactorySpi {
|
|||
*
|
||||
* @exception InvalidKeySpecException if the requested key specification is
|
||||
* inappropriate for the given key (e.g., the algorithms associated with
|
||||
* <code>key</code> and <code>keySpec</code> do not match, or
|
||||
* <code>key</code> references a key on a cryptographic hardware device
|
||||
* whereas <code>keySpec</code> is the specification of a software-based
|
||||
* {@code key} and {@code keySpec} do not match, or
|
||||
* {@code key} references a key on a cryptographic hardware device
|
||||
* whereas {@code keySpec} is the specification of a software-based
|
||||
* key), or the given key cannot be dealt with
|
||||
* (e.g., the given key has an algorithm or format not supported by this
|
||||
* secret-key factory).
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -42,8 +42,8 @@ public class ShortBufferException extends GeneralSecurityException {
|
|||
private static final long serialVersionUID = 8427718640832943747L;
|
||||
|
||||
/**
|
||||
* Constructs a ShortBufferException with no detail
|
||||
* message. A detail message is a String that describes this
|
||||
* Constructs a {@code ShortBufferException} with no detail
|
||||
* message. A detail message is a {@code String} that describes this
|
||||
* particular exception.
|
||||
*/
|
||||
public ShortBufferException() {
|
||||
|
@ -51,7 +51,7 @@ public class ShortBufferException extends GeneralSecurityException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a ShortBufferException with the specified
|
||||
* Constructs a {@code ShortBufferException} with the specified
|
||||
* detail message.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue