📄 ideakeyspec.java
字号:
package au.net.aba.crypto.spec;
/*
* $Id: IDEAKeySpec.java,v 1.4 1998/10/05 05:47:55 dgh Exp $
* $Author: dgh $
*
* Copyright (C) 1996-1998 Australian Business Access Pty Ltd.
* All rights reserved.
*
* Use, modification, copying and distribution of this software is subject the
* terms and conditions of the ABA Public Licence. See the file
* "PUBLIC_LICENCE" for additional information.
*
* If you have not received a copy of the Public Licence, you must destroy all
* copies of this file immediately.
*
* $Source: /aba/CVSROOT/jdk1.1/src/au.net.aba/crypto/spec/IDEAKeySpec.java,v $
* $Revision: 1.4 $
* $Date: 1998/10/05 05:47:55 $
* $State: Exp $
*/
import java.security.spec.KeySpec;
import java.security.InvalidKeyException;
/**
* A class that provides a specification for a IDEA key.
*/
public class IDEAKeySpec implements KeySpec
{
public final static String ident = "$Id: IDEAKeySpec.java,v 1.4 1998/10/05 05:47:55 dgh Exp $";
private byte[] ideaKey;
public static final int IDEA_KEY_LEN = 16;
/**
* Uses the first 16 bytes in key as the IDEA key
*
* @param key the byte array to use as key material.
* @exception InvalidKeyException if the key material is too short.
*/
public IDEAKeySpec(
byte[] key)
throws InvalidKeyException
{
this(key, 0);
}
/**
* Uses the first 16 bytes in key, beginning at offset, as the IDEA key
*
* @param key the byte array to use as key material.
* @param offset the offset to start at.
* @exception InvalidKeyException if the key material is too short.
*/
public IDEAKeySpec(
byte[] key,
int offset)
throws InvalidKeyException
{
if (key.length - offset < IDEA_KEY_LEN)
{
throw new InvalidKeyException("Key too short");
}
ideaKey = new byte[IDEA_KEY_LEN];
System.arraycopy(key, offset, ideaKey, 0, IDEA_KEY_LEN);
}
/**
* Returns the IDEA key.
*
* @return the bytes making up the key.
*/
public byte[] getKey()
{
return ideaKey;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -