|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.security.SignatureSpi
public abstract class SignatureSpi
此類別為 Signature 類別定義了服務提供者介面 (SPI),可用來提供數位簽章演算法功能。數位簽章用來保證數字資料的真實性和完整性。
此類別中的所有抽象方法都必須由每個想要提供實作特定簽章演算法的加密服務提供者實作。
Signature| 欄位摘要 | |
|---|---|
protected SecureRandom |
appRandom
應用程序指定的隨機源。 |
| 建構子摘要 | |
|---|---|
SignatureSpi()
|
|
| 方法摘要 | |
|---|---|
Object |
clone()
如果此實作可以複製,則返回一個副本。 |
protected abstract Object |
engineGetParameter(String param)
已過時。 |
protected AlgorithmParameters |
engineGetParameters()
此方法將由提供者覆寫,以返回與此簽章引擎配合使用的參數,如果此簽章引擎未使用任何參數,則返回 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)
此方法將由提供者覆寫,以便使用指定的參數設置初始化此簽章引擎。 |
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 |
| 欄位詳細資訊 |
|---|
protected SecureRandom appRandom
| 建構子詳細資訊 |
|---|
public SignatureSpi()
| 方法詳細資訊 |
|---|
protected abstract void engineInitVerify(PublicKey publicKey)
throws InvalidKeyException
publicKey - 其簽章將被驗證的標識的公鑰。
InvalidKeyException - 如果密鑰未得到正確編碼、參數丟失等等。
protected abstract void engineInitSign(PrivateKey privateKey)
throws InvalidKeyException
privateKey - 將產生其簽章的標識的私鑰。
InvalidKeyException - 如果密鑰未得到正確編碼、參數丟失等等。
protected void engineInitSign(PrivateKey privateKey,
SecureRandom random)
throws InvalidKeyException
已將此具體方法添加到了先前定義過的抽象類別中。(為向後相容,它不能為抽象方法)。
privateKey - 將產生其簽章的標識的私鑰。random - 隨機源
InvalidKeyException - 如果密鑰未得到正確編碼、參數丟失等等。
protected abstract void engineUpdate(byte b)
throws SignatureException
b - 用於更新的位元組。
SignatureException - 如果引擎未得到正確初始化。
protected abstract void engineUpdate(byte[] b,
int off,
int len)
throws SignatureException
b - byte 陣列off - byte 陣列開始處的偏移量len - 要使用的位元組數(從偏移量開始處計算)
SignatureException - 如果引擎未得到正確初始化protected void engineUpdate(ByteBuffer input)
data.position() 處開始的 data.remaining() 位元組。返回時,緩衝區的位置將等於其限制;其限制並未改變。
input - the ByteBuffer
protected abstract byte[] engineSign()
throws SignatureException
SignatureException - 如果引擎未得到正確初始化,或者此簽章演算法無法處理所提供的輸入資料。
protected int engineSign(byte[] outbuf,
int offset,
int len)
throws SignatureException
offset 開始將得到的簽章位元組保存在提供的緩衝區 outbuf 中。簽章的格式取決於基本簽章方案。
此簽章實作將被重新設置到其初始狀態(對其中的一種 engineInitSign 方法調用之後所處的狀態),並且可以重新使用該簽章實作,用同一個私鑰產生將來的簽章。
此方法應是一個抽象方法,但出於二進制相容性考慮,允許它保留具體方法。因此提供者應覆寫此方法。
outbuf - 輸出簽章結果的緩衝區。offset - 到存儲簽章的 outbuf 的偏移量。len - outbuf 中分派給簽章的位元組數。此預設實作和 SUN 提供者勻不返回部分摘要。如果此參數的值小於實際簽章長度,此方法將拋出一個 SignatureException。如果其值大於或等於實際簽章長度,則將忽略此參數。
outbuf 中的位元組數
SignatureException - 如果引擎未得到正確初始化,或者此簽章演算法無法處理所提供的輸入資料,或者 len 小於實際簽章長度。
protected abstract boolean engineVerify(byte[] sigBytes)
throws SignatureException
sigBytes - 要驗證的簽章位元組。
SignatureException - 如果引擎未得到正確初始化,或傳入的簽章未被正確編碼或型別錯誤,或者此簽章演算法無法處理所提供的輸入資料等等。
protected boolean engineVerify(byte[] sigBytes,
int offset,
int length)
throws SignatureException
註:子類別應改寫此預設實作。
sigBytes - 要驗證的簽章位元組。offset - byte 陣列中起始處的偏移量。length - 要使用的位元組數(從偏移量起始處計算)。
SignatureException - 如果引擎未得到正確初始化,或傳入的簽章未被正確編碼或型別錯誤,或者此簽章演算法無法處理所提供的輸入資料等等。
@Deprecated
protected abstract void engineSetParameter(String param,
Object value)
throws InvalidParameterException
engineSetParameter 取代。
param - 參數的字元串標示符。value - 參數值。
InvalidParameterException - 如果 param 是此演算法引擎的無效參數,或者已經設置參數並且不能重新設置,或者發生了安全異常等等。
protected void engineSetParameter(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException
此方法將由提供者覆寫,以便使用指定的參數設置初始化此簽章引擎。
params - 參數
UnsupportedOperationException - 如果提供者未覆寫此方法
InvalidAlgorithmParameterException - 如果提供者未覆寫此方法並且指定的參數不適合此簽章引擎protected AlgorithmParameters engineGetParameters()
此方法將由提供者覆寫,以返回與此簽章引擎配合使用的參數,如果此簽章引擎未使用任何參數,則返回 null。
返回的參數可能與用來初始化此簽章引擎的參數相同;如果此簽章引擎需要演算法參數但卻未使用任何參數進行初始化,則返回的參數可能會包含由底層簽章實作使用的預設和隨機產生的參數值的組合。
UnsupportedOperationException - 如果提供者未覆寫此方法
@Deprecated
protected abstract Object engineGetParameter(String param)
throws InvalidParameterException
param - 參數的字元串名稱。
InvalidParameterException - 如果 param 是此引擎的無效參數,或者嘗試獲取此參數時發生了其他異常。
public Object clone()
throws CloneNotSupportedException
Object 中的 cloneCloneNotSupportedException - 如果調用一個不支持 Cloneable 的實作。Cloneable
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。