/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* KeyGenerator for the TLS PRF. Note that although the PRF is used in a number
* of places during the handshake, this class is usually only used to calculate
* the Finished messages. The reason is that for those other uses more specific
* PKCS#11 mechanisms have been defined (CKM_SSL3_MASTER_KEY_DERIVE, etc.).
*
* <p>This class supports the CKM_TLS_PRF mechanism from PKCS#11 v2.20 and
* the older NSS private mechanism.
*
* @author Andreas Sterbenz
* @since 1.6
*/
"TlsPrfGenerator must be initialized using a TlsPrfParameterSpec";
// token instance
// algorithm name
// mechanism id
private final long mechanism;
throws PKCS11Exception {
super();
}
throw new InvalidParameterException(MSG);
}
if (params instanceof TlsPrfParameterSpec == false) {
throw new InvalidAlgorithmParameterException(MSG);
}
}
try {
} catch (InvalidKeyException e) {
throw new InvalidAlgorithmParameterException("init() failed", e);
}
}
// SecretKeySpec does not allow zero length keys, so we define our own class.
public byte[] getEncoded() {
return new byte[0];
}
return "RAW";
}
public String getAlgorithm() {
return "Generic";
}
};
throw new InvalidParameterException(MSG);
}
throw new IllegalStateException("TlsPrfGenerator must be initialized");
}
if (mechanism == CKM_NSS_TLS_PRF_GENERAL) {
try {
} catch (PKCS11Exception e) {
throw new ProviderException("Could not calculate PRF", e);
} finally {
}
}
// mechanism == CKM_TLS_PRF
try {
// ignore keyID, returned PRF bytes are in 'out'
} catch (PKCS11Exception e) {
throw new ProviderException("Could not calculate PRF", e);
} finally {
}
}
}