Lines Matching defs:key

36  * This class implements the DES-EDE key factory of the Sun provider.
51 * Generates a <code>SecretKey</code> object from the provided key
52 * specification (key material).
54 * @param keySpec the specification (key material) of the secret key
56 * @return the secret key
58 * @exception InvalidKeySpecException if the given key specification
59 * is inappropriate for this key factory to produce a public key.
72 ("Inappropriate key specification");
80 * Returns a specification (key material) of the given key
83 * @param key the key
85 * @param keySpec the requested format in which the key material shall be
88 * @return the underlying key specification (key material) in the
91 * @exception InvalidKeySpecException if the requested key specification is
92 * inappropriate for the given key, or the given key cannot be processed
93 * (e.g., the given key has an unrecognized algorithm or format).
95 protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
99 if ((key instanceof SecretKey)
100 && (key.getAlgorithm().equalsIgnoreCase("DESede"))
101 && (key.getFormat().equalsIgnoreCase("RAW"))) {
103 // Check if requested key spec is amongst the valid ones
105 return new DESedeKeySpec(key.getEncoded());
109 ("Inappropriate key specification");
114 ("Inappropriate key format/algorithm");
117 throw new InvalidKeySpecException("Secret key has wrong size");
124 * <code>SecretKey</code> object of this key factory.
126 * @param key the key whose provider is unknown or untrusted
128 * @return the translated key
130 * @exception InvalidKeyException if the given key cannot be processed by
131 * this key factory.
133 protected SecretKey engineTranslateKey(SecretKey key)
138 if ((key != null)
139 && (key.getAlgorithm().equalsIgnoreCase("DESede"))
140 && (key.getFormat().equalsIgnoreCase("RAW"))) {
141 // Check if key originates from this factory
142 if (key instanceof com.sun.crypto.provider.DESedeKey) {
143 return key;
145 // Convert key to spec
147 = (DESedeKeySpec)engineGetKeySpec(key,
149 // Create key from spec, and return it
154 ("Inappropriate key format/algorithm");
158 throw new InvalidKeyException("Cannot translate key");