package iaik.pkcs.pkcs11.wrapper;

/**
 * class CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the
 * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE mechanisms.
 * <p>
 * <B>PKCS#11 structure:</B>
 * 
 * <PRE>
 * typedef struct CK_X9_42_DH2_DERIVE_PARAMS {
 *   CK_X9_42_DH_KDF_TYPE kdf;
 *   CK_ULONG ulOtherInfoLen;
 *   CK_BYTE_PTR pOtherInfo;
 *   CK_ULONG ulPublicDataLen;
 *   CK_BYTE_PTR pPublicData;
 *   CK_ULONG ulPrivateDataLen;
 *   CK_OBJECT_HANDLE hPrivateData;
 *   CK_ULONG ulPublicDataLen2;
 *   CK_BYTE_PTR pPublicData2;
 * } CK_X9_42_DH2_DERIVE_PARAMS;
 * </PRE>
 * 
 * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
 */
public class CK_X9_42_DHMQV_DERIVE_PARAMS {

	/**
	 * <B>PKCS#11:</B>
	 * 
	 * <PRE>
	 * CK_X9_42_DH_KDF_TYPE kdf;
	 * </PRE>
	 * 
	 * .
	 */
	public long kdf;

	/**
	 * <B>PKCS#11:</B>
	 * 
	 * <PRE>
	 * CK_ULONG ulOtherInfoLen;
	 * CK_BYTE_PTR pOtherInfo;
	 * </PRE>
	 * 
	 * .
	 */
	public byte[] pOtherInfo;

	/**
	 * <B>PKCS#11:</B>
	 * 
	 * <PRE>
	 * CK_ULONG ulPublicDataLen;
	 * CK_BYTE_PTR pPublicData;
	 * </PRE>
	 * 
	 * .
	 */
	public byte[] pPublicData;

	/**
	 * <B>PKCS#11:</B>
	 * 
	 * <PRE>
	 * CK_ULONG ulPrivateDataLen;
	 * </PRE>
	 * 
	 * .
	 */
	public long ulPrivateDataLen;

	/**
	 * <B>PKCS#11:</B>
	 * 
	 * <PRE>
	 * CK_OBJECT_HANDLE hPrivateData;
	 * </PRE>
	 * 
	 * .
	 */
	public long hPrivateData;

	/**
	 * <B>PKCS#11:</B>
	 * 
	 * <PRE>
	 * CK_ULONG ulPublicDataLen2;
	 * CK_BYTE_PTR pPublicData2;
	 * </PRE>
	 * 
	 * .
	 */
	public byte[] pPublicData2;

	/**
	 * <B>PKCS#11:</B>
	 * 
	 * <PRE>
	 * CK_OBJECT_HANDLE publicKey;
	 * </PRE>
	 * 
	 * .
	 */
	public long hPublicKey;

	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		StringBuffer buffer = new StringBuffer();

		buffer.append(Constants.INDENT);
		buffer.append("kdf: 0x");
		buffer.append(Functions.toFullHexString(kdf));
		buffer.append(Constants.NEWLINE);

		buffer.append(Constants.INDENT);
		buffer.append("pOtherInfoLen: ");
		buffer.append(pOtherInfo.length);
		buffer.append(Constants.NEWLINE);

		buffer.append(Constants.INDENT);
		buffer.append("pOtherInfo: ");
		buffer.append(Functions.toHexString(pOtherInfo));
		buffer.append(Constants.NEWLINE);

		buffer.append(Constants.INDENT);
		buffer.append("pPublicDataLen: ");
		buffer.append(pPublicData.length);
		buffer.append(Constants.NEWLINE);

		buffer.append(Constants.INDENT);
		buffer.append("pPublicData: ");
		buffer.append(Functions.toHexString(pPublicData));
		buffer.append(Constants.NEWLINE);

		buffer.append(Constants.INDENT);
		buffer.append("ulPrivateDataLen: ");
		buffer.append(ulPrivateDataLen);
		buffer.append(Constants.NEWLINE);

		buffer.append(Constants.INDENT);
		buffer.append("hPrivateData: ");
		buffer.append(hPrivateData);
		buffer.append(Constants.NEWLINE);

		buffer.append(Constants.INDENT);
		buffer.append("pPublicDataLen2: ");
		buffer.append(pPublicData2.length);
		buffer.append(Constants.NEWLINE);

		buffer.append(Constants.INDENT);
		buffer.append("pPublicData2: ");
		buffer.append(Functions.toHexString(pPublicData2));
		buffer.append(Constants.NEWLINE);

		buffer.append(Constants.INDENT);
		buffer.append("hPublicKey: ");
		buffer.append(hPublicKey);

		return buffer.toString();
	}

}
