Table of Contents

Class OdfOpenPgpCryptographyProvider

Namespace
OdfKit.Core
Assembly
OdfKit.dll

Provides the OdfOpenPgpCryptographyProvider API. 以 IOdfOpenPgpKeyProvider 為基礎,實作 ODF 1.3 OpenPGP 加密模式的

public sealed class OdfOpenPgpCryptographyProvider : IOdfCryptographyProvider
Inheritance
OdfOpenPgpCryptographyProvider
Implements
Inherited Members

Constructors

OdfOpenPgpCryptographyProvider(IOdfOpenPgpKeyProvider)

Performs odf open pgp cryptography provider. 初始化 OdfOpenPgpCryptographyProvider 類別的新執行個體。

public OdfOpenPgpCryptographyProvider(IOdfOpenPgpKeyProvider keyProvider)

Parameters

keyProvider IOdfOpenPgpKeyProvider

負責 Session Key 加解密的 OpenPGP 金鑰提供者

Exceptions

ArgumentNullException

keyProvider 為 null 時擲出

Methods

CanHandle(OdfEncryptionInfo)

Returns whether this instance is handle is allowed. 傳回是否可 Handle。

public bool CanHandle(OdfEncryptionInfo info)

Parameters

info OdfEncryptionInfo

加密資訊的詳細資料

Returns

bool

若可以處理,則為 true ;否則為 false

Decrypt(byte[], OdfEncryptionInfo, OdfLoadOptions)

Performs the Decrypt operation. 執行 Decrypt 作業。

public byte[] Decrypt(byte[] ciphertext, OdfEncryptionInfo info, OdfLoadOptions loadOptions)

Parameters

ciphertext byte[]

要解密的密文位元組陣列

info OdfEncryptionInfo

用於解密的加密資訊

loadOptions OdfLoadOptions

載入文件的選項,包含金鑰或密碼

Returns

byte[]

解密後的明文位元組陣列

Encrypt(byte[], string, OdfSaveOptions, out OdfEncryptionInfo)

Performs the Encrypt operation. 執行 Encrypt 作業。

public byte[] Encrypt(byte[] plaintext, string entryPath, OdfSaveOptions saveOptions, out OdfEncryptionInfo info)

Parameters

plaintext byte[]

要加密的明文位元組陣列

entryPath string

該封裝項目的路徑

saveOptions OdfSaveOptions

儲存文件的選項,包含金鑰或密碼

info OdfEncryptionInfo

輸出產生的加密資訊

Returns

byte[]

加密後的密文位元組陣列