Home | History | Annotate | Download | only in spec

Lines Matching refs:key

31  * A key specification for a <code>SecretKey</code> and also a secret key
42 private final byte[] key;
46 * Creates a new <code>SecretKeySpec</code> for the specified key data and
49 * @param key
50 * the key data.
54 * if the key data or the algorithm name is null or if the key
57 public SecretKeySpec(byte[] key, String algorithm) {
58 if (key == null) {
59 throw new IllegalArgumentException("key == null");
61 if (key.length == 0) {
62 throw new IllegalArgumentException("key.length == 0");
69 this.key = new byte[key.length];
70 System.arraycopy(key, 0, this.key, 0, key.length);
74 * Creates a new <code>SecretKeySpec</code> for the key data from the
75 * specified buffer <code>key</code> starting at <code>offset</code> with
78 * @param key
79 * the key data.
83 * the size of the key data.
87 * if the key data or the algorithm name is null, the key data
89 * specify a valid chunk in the buffer <code>key</code>.
93 public SecretKeySpec(byte[] key, int offset, int len, String algorithm) {
94 if (key == null) {
95 throw new IllegalArgumentException("key == null");
97 if (key.length == 0) {
98 throw new IllegalArgumentException("key.length == 0");
103 if (key.length - offset < len) {
104 throw new IllegalArgumentException("key too short");
110 this.key = new byte[len];
111 System.arraycopy(key, offset, this.key, 0, len);
124 * Returns the name of the format used to encode the key.
133 * Returns the encoded form of this secret key.
135 * @return the encoded form of this secret key.
138 byte[] result = new byte[key.length];
139 System.arraycopy(key, 0, result, 0, key.length);
151 for (byte element : key) {
163 * @return true if the algorithm name and key of both object are equal,
176 && (Arrays.equals(key, ks.key));