Lines Matching refs:key

34  * This class specifies a secret key in a provider-independent fashion.
41 * a byte array and have no key parameters associated with them, e.g., DES or
55 * The secret key.
59 private byte[] key;
62 * The name of the algorithm associated with this key.
69 * Constructs a secret key from the given byte array.
72 * secret key of the specified algorithm. For example, if the algorithm is
73 * DES, this constructor does not check if <code>key</code> is 8 bytes
76 * <i>key specification</i> class (in this case:
80 * @param key the key material of the secret key. The contents of
82 * @param algorithm the name of the secret-key algorithm to be associated
83 * with the given key material.
89 * is null or <code>key</code> is null or empty.
91 public SecretKeySpec(byte[] key, String algorithm) {
92 if (key == null || algorithm == null) {
95 if (key.length == 0) {
96 throw new IllegalArgumentException("Empty key");
98 this.key = key.clone();
103 * Constructs a secret key from the given byte array, using the first
104 * <code>len</code> bytes of <code>key</code>, starting at
107 * <p> The bytes that constitute the secret key are
108 * those between <code>key[offset]</code> and
109 * <code>key[offset+len-1]</code> inclusive.
112 * secret key of the specified algorithm. For example, if the algorithm is
113 * DES, this constructor does not check if <code>key</code> is 8 bytes
115 * In order for those checks to be performed, an algorithm-specific key
120 * @param key the key material of the secret key. The first
124 * @param offset the offset in <code>key</code> where the key material
126 * @param len the length of the key material.
127 * @param algorithm the name of the secret-key algorithm to be associated
128 * with the given key material.
134 * is null or <code>key</code> is null, empty, or too short,
135 * i.e. {@code key.length-offset<len}.
138 * <code>key</code>.
140 public SecretKeySpec(byte[] key, int offset, int len, String algorithm) {
141 if (key == null || algorithm == null) {
144 if (key.length == 0) {
145 throw new IllegalArgumentException("Empty key");
147 if (key.length-offset < len) {
154 this.key = new byte[len];
155 System.arraycopy(key, offset, this.key, 0, len);
160 * Returns the name of the algorithm associated with this secret key.
162 * @return the secret key algorithm.
169 * Returns the name of the encoding format for this secret key.
178 * Returns the key material of this secret key.
180 * @return the key material. Returns a new array
184 return this.key.clone();
193 for (int i = 1; i < this.key.length; i++) {
194 retval += this.key[i] * i;
207 * same case-insensitive algorithm name and key encoding.
232 return MessageDigest.isEqual(this.key, thatKey);