JavaTM Platform
Standard Ed. 6

java.security
�� SignatureSpi

java.lang.Object
  �̳��� java.security.SignatureSpi
ֱ����֪���ࣺ
Signature

public abstract class SignatureSpi
extends Object

����Ϊ Signature �ඨ���������ṩ�߽ӿ� (SPI)���������ṩ����ǩ���㷨���ܡ�����ǩ��������֤�������ݵ���ʵ�Ժ������ԡ�

�����е����г��󷽷���������ÿ����Ҫ�ṩʵ���ض�ǩ���㷨�ļ��ܷ����ṩ��ʵ�֡�

������
Signature

�ֶ�ժҪ
protected  SecureRandom appRandom
          Ӧ�ó���ָ�������Դ��
 
���췽��ժҪ
SignatureSpi()
           
 
����ժҪ
 Object clone()
          �����ʵ�ֿ��Ը��ƣ��򷵻�һ��������
protected abstract  Object engineGetParameter(String param)
          �ѹ�ʱ��  
protected  AlgorithmParameters engineGetParameters()
          �˷��������ṩ����д���Է������ǩ���������ʹ�õIJ����������ǩ������δʹ���κβ������򷵻� null��
protected abstract  void engineInitSign(PrivateKey privateKey)
          ͨ������ǩ��������ָ��˽Կ��ʼ����ǩ������
protected  void engineInitSign(PrivateKey privateKey, SecureRandom random)
          ͨ������ǩ��������ָ��˽Կ�����Դ��ʼ����ǩ������
protected abstract  void engineInitVerify(PublicKey publicKey)
          ͨ��������֤������ָ����Կ��ʼ����ǩ������
protected  void engineSetParameter(AlgorithmParameterSpec params)
          �˷��������ṩ����д���Ա�ʹ��ָ���IJ������ó�ʼ����ǩ�����档
protected abstract  void engineSetParameter(String param, Object value)
          �ѹ�ʱ�� �� engineSetParameter ȡ����
protected abstract  byte[] engineSign()
          ��������Ϊֹ���и��µ����ݵ�ǩ���ֽڡ�
protected  int engineSign(byte[] outbuf, int offset, int len)
          ��ɴ�ǩ������������ offset ��ʼ���õ���ǩ���ֽڱ������ṩ�Ļ����� outbuf �С�
protected abstract  void engineUpdate(byte b)
          ʹ��ָ�����ֽڸ���Ҫǩ������֤�����ݡ�
protected abstract  void engineUpdate(byte[] b, int off, int len)
          ʹ��ָ���� byte ���飬��ָ����ƫ������ʼ����Ҫǩ������֤�����ݡ�
protected  void engineUpdate(ByteBuffer input)
          ʹ��ָ���� ByteBuffer ����Ҫǩ������֤�����ݡ�
protected abstract  boolean engineVerify(byte[] sigBytes)
          ��֤�����ǩ����
protected  boolean engineVerify(byte[] sigBytes, int offset, int length)
          ��ָ���� byte �����У���ָ����ƫ��������ʼ����֤�����ǩ����
 
���� java.lang.Object �̳еķ���
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

�ֶ���ϸ��Ϣ

appRandom

protected SecureRandom appRandom
Ӧ�ó���ָ�������Դ��

���췽����ϸ��Ϣ

SignatureSpi

public SignatureSpi()
������ϸ��Ϣ

engineInitVerify

protected abstract void engineInitVerify(PublicKey publicKey)
                                  throws InvalidKeyException
ͨ��������֤������ָ����Կ��ʼ����ǩ������

������
publicKey - ��ǩ��������֤�ı�ʶ�Ĺ�Կ��
�׳���
InvalidKeyException - �����Կδ�õ���ȷ���롢������ʧ�ȵȡ�

engineInitSign

protected abstract void engineInitSign(PrivateKey privateKey)
                                throws InvalidKeyException
ͨ������ǩ��������ָ��˽Կ��ʼ����ǩ������

������
privateKey - ��������ǩ���ı�ʶ��˽Կ��
�׳���
InvalidKeyException - �����Կδ�õ���ȷ���롢������ʧ�ȵȡ�

engineInitSign

protected void engineInitSign(PrivateKey privateKey,
                              SecureRandom random)
                       throws InvalidKeyException
ͨ������ǩ��������ָ��˽Կ�����Դ��ʼ����ǩ������

�ѽ��˾��巽�����ӵ�����ǰ������ij������С���Ϊ�����ݣ�������Ϊ���󷽷�����

������
privateKey - ��������ǩ���ı�ʶ��˽Կ��
random - ���Դ
�׳���
InvalidKeyException - �����Կδ�õ���ȷ���롢������ʧ�ȵȡ�

engineUpdate

protected abstract void engineUpdate(byte b)
                              throws SignatureException
ʹ��ָ�����ֽڸ���Ҫǩ������֤�����ݡ�

������
b - ���ڸ��µ��ֽڡ�
�׳���
SignatureException - �������δ�õ���ȷ��ʼ����

engineUpdate

protected abstract void engineUpdate(byte[] b,
                                     int off,
                                     int len)
                              throws SignatureException
ʹ��ָ���� byte ���飬��ָ����ƫ������ʼ����Ҫǩ������֤�����ݡ�

������
b - byte ����
off - byte ���鿪ʼ����ƫ����
len - Ҫʹ�õ��ֽ�������ƫ������ʼ�����㣩
�׳���
SignatureException - �������δ�õ���ȷ��ʼ��

engineUpdate

protected void engineUpdate(ByteBuffer input)
ʹ��ָ���� ByteBuffer ����Ҫǩ������֤�����ݡ������� data.position() ����ʼ�� data.remaining() �ֽڡ�����ʱ����������λ�ý����������ƣ������Ʋ�δ�ı䡣

������
input - the ByteBuffer
�����°汾��ʼ��
1.5

engineSign

protected abstract byte[] engineSign()
                              throws SignatureException
��������Ϊֹ���и��µ����ݵ�ǩ���ֽڡ�ǩ���ĸ�ʽȡ���ڵײ�ǩ��������

���أ�
ǩ�����������ǩ���ֽڡ�
�׳���
SignatureException - �������δ�õ���ȷ��ʼ�������ߴ�ǩ���㷨�޷��������ṩ���������ݡ�

engineSign

protected int engineSign(byte[] outbuf,
                         int offset,
                         int len)
                  throws SignatureException
��ɴ�ǩ������������ offset ��ʼ���õ���ǩ���ֽڱ������ṩ�Ļ����� outbuf �С�ǩ���ĸ�ʽȡ���ڻ���ǩ��������

��ǩ��ʵ�ֽ����������õ����ʼ״̬�������е�һ�� engineInitSign ��������֮��������״̬�������ҿ�������ʹ�ø�ǩ��ʵ�֣���ͬһ��˽Կ���ɽ�����ǩ���� �˷���Ӧ��һ�����󷽷��������ڶ����Ƽ����Կ��ǣ��������������巽��������ṩ��Ӧ��д�˷�����

������
outbuf - ���ǩ������Ļ�������
offset - ���洢ǩ���� outbuf ��ƫ������
len - outbuf �з����ǩ�����ֽ�������Ĭ��ʵ�ֺ� SUN �ṩ���Ȳ����ز���ժҪ������˲�����ֵС��ʵ��ǩ�����ȣ��˷������׳�һ�� SignatureException�������ֵ���ڻ����ʵ��ǩ�����ȣ��򽫺��Դ˲�����
���أ�
���� outbuf �е��ֽ���
�׳���
SignatureException - �������δ�õ���ȷ��ʼ�������ߴ�ǩ���㷨�޷��������ṩ���������ݣ����� len С��ʵ��ǩ�����ȡ�
�����°汾��ʼ��
1.2

engineVerify

protected abstract boolean engineVerify(byte[] sigBytes)
                                 throws SignatureException
��֤�����ǩ����

������
sigBytes - Ҫ��֤��ǩ���ֽڡ�
���أ�
���ǩ���õ���֤���򷵻� true�����򽫷��� false��
�׳���
SignatureException - �������δ�õ���ȷ��ʼ���������ǩ��δ����ȷ��������ʹ��󣬻��ߴ�ǩ���㷨�޷��������ṩ���������ݵȵȡ�

engineVerify

protected boolean engineVerify(byte[] sigBytes,
                               int offset,
                               int length)
                        throws SignatureException
��ָ���� byte �����У���ָ����ƫ��������ʼ����֤�����ǩ����

ע������Ӧ��д��Ĭ��ʵ�֡�

������
sigBytes - Ҫ��֤��ǩ���ֽڡ�
offset - byte ��������ʼ����ƫ������
length - Ҫʹ�õ��ֽ�������ƫ������ʼ�����㣩��
���أ�
���ǩ���õ���֤���򷵻� true�����򽫷��� false��
�׳���
SignatureException - �������δ�õ���ȷ��ʼ���������ǩ��δ����ȷ��������ʹ��󣬻��ߴ�ǩ���㷨�޷��������ṩ���������ݵȵȡ�
�����°汾��ʼ��
1.4

engineSetParameter

@Deprecated
protected abstract void engineSetParameter(String param,
                                                      Object value)
                                    throws InvalidParameterException
�ѹ�ʱ�� �� engineSetParameter ȡ����

��ָ�����㷨��������Ϊָ����ֵ���˷����ṩ��һ��ͨ�û��ƣ�ͨ�����������ô˶���ĸ��ֲ����������������㷨���κο����ò������������С��ǩ�����ɵ����Դλ������ʵ��������߱�ʾ�Ƿ�ִ�о��嵫��ѡ�ļ��㡣ÿ����������Ҫͳһ�ġ��ض����㷨����������������ʱ��δָ�����ַ�����

������
param - �������ַ�����ʾ����
value - ����ֵ��
�׳���
InvalidParameterException - ��� param �Ǵ��㷨�������Ч�����������Ѿ����ò������Ҳ����������ã����߷����˰�ȫ�쳣�ȵȡ�

engineSetParameter

protected void engineSetParameter(AlgorithmParameterSpec params)
                           throws InvalidAlgorithmParameterException

�˷��������ṩ����д���Ա�ʹ��ָ���IJ������ó�ʼ����ǩ�����档

������
params - ����
�׳���
UnsupportedOperationException - ����ṩ��δ��д�˷���
InvalidAlgorithmParameterException - ����ṩ��δ��д�˷�������ָ���IJ������ʺϴ�ǩ������

engineGetParameters

protected AlgorithmParameters engineGetParameters()

�˷��������ṩ����д���Է������ǩ���������ʹ�õIJ����������ǩ������δʹ���κβ������򷵻� null��

���صIJ���������������ʼ����ǩ������IJ�����ͬ�������ǩ��������Ҫ�㷨������ȴδʹ���κβ������г�ʼ�����򷵻صIJ������ܻ�����ɵײ�ǩ��ʵ��ʹ�õ�Ĭ�Ϻ�������ɵIJ���ֵ����ϡ�

���أ�
���ǩ������һ��ʹ�õIJ����������ǩ������δʹ���κβ������򷵻� null
�׳���
UnsupportedOperationException - ����ṩ��δ��д�˷���
�����°汾��ʼ��
1.4

engineGetParameter

@Deprecated
protected abstract Object engineGetParameter(String param)
                                      throws InvalidParameterException
�ѹ�ʱ�� 

��ȡָ���㷨������ֵ���˷����ṩ��һ��ͨ�û��ƣ�ͨ�����ܹ���ȡ�˶���ĸ��ֲ����������������㷨���κο����ò������������С��ǩ�����ɵ����Դλ������ʵ��������߱�ʾ�Ƿ�ִ�о��嵫��ѡ�ļ��㡣ÿ����������Ҫͳһ�ġ��ض����㷨����������������ʱ��δָ�����ַ�����

������
param - �������ַ������ơ�
���أ�
��ʾ����ֵ�Ķ������û�У��򷵻� null��
�׳���
InvalidParameterException - ��� param �Ǵ��������Ч���������߳��Ի�ȡ�˲���ʱ�����������쳣��

clone

public Object clone()
             throws CloneNotSupportedException
�����ʵ�ֿ��Ը��ƣ��򷵻�һ��������

���ǣ�
�� Object �е� clone
���أ�
�����ʵ�ֿ��Ը��ƣ��򷵻�һ��������
�׳���
CloneNotSupportedException - �������һ����֧�� Cloneable ��ʵ�֡�
������
Cloneable

JavaTM Platform
Standard Ed. 6

�ύ��������
�йظ���� API �ο����ϺͿ�����Ա�ĵ�������� Java SE ������Ա�ĵ������ĵ���������ϸ�ġ����򿪷���Ա���������Լ�������������ﶨ�塢ʹ�ü��ɺ͹�������ʾ����

��Ȩ���� 2007 Sun Microsystems, Inc. ��������Ȩ���� ����������֤��������������ĵ����·ַ�������