SignedCms.Decode 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
解碼已編碼 SignedCms 的訊息。
多載
| 名稱 | Description |
|---|---|
| Decode(Byte[]) |
解碼已編碼 SignedCms 的訊息。 |
| Decode(ReadOnlySpan<Byte>) |
Decode(Byte[])
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
解碼已編碼 SignedCms 的訊息。
public:
void Decode(cli::array <System::Byte> ^ encodedMessage);
public void Decode(byte[] encodedMessage);
member this.Decode : byte[] -> unit
Public Sub Decode (encodedMessage As Byte())
參數
- encodedMessage
- Byte[]
一個位元組數陣列,代表待解碼的 CMS/PKCS#7 訊息編碼。
例外狀況
encodedMessage 是 null。
encodedMessage 無法成功解碼。
範例
以下範例展示了該方法在驗證訊息簽名Decode過程中的位置SignedCms。 在此範例中,訊息內容並非分離,因此訊息內容包含在訊息中 SignedCms 。
// Create a new, nondetached SignedCms message.
SignedCms signedCms = new SignedCms();
// encodedMessage is the encoded message received from
// the sender.
signedCms.Decode(encodedMessage);
// Verify the signature without validating the
// certificate.
signedCms.CheckSignature(true);
' Create a new, nondetached SignedCms message.
Dim signedCms As New SignedCms()
' encodedMessage is the encoded message received from
' the sender.
signedCms.Decode(encodedMessage)
' Verify the signature without validating the
' certificate.
signedCms.CheckSignature(True)
以下範例展示了該方法在驗證訊息簽名Decode過程中的位置SignedCms。 在此範例中,訊息內容是分離的,因此訊息內容必須獨立 SignedCms 於訊息本身進行驗證。
// Create a ContentInfo object from the inner content obtained
// independently from encodedMessage.
ContentInfo contentInfo = new ContentInfo(innerContent);
// Create a new, detached SignedCms message.
SignedCms signedCms = new SignedCms(contentInfo, true);
// encodedMessage is the encoded message received from
// the sender.
signedCms.Decode(encodedMessage);
// Verify the signature without validating the
// certificate.
signedCms.CheckSignature(true);
' Create a ContentInfo object from the inner content obtained
' independently from encodedMessage.
Dim contentInfo As New ContentInfo(innerContent)
' Create a new, detached SignedCms message.
Dim signedCms As New SignedCms(contentInfo, True)
' encodedMessage is the encoded message received from
' the sender.
signedCms.Decode(encodedMessage)
' Verify the signature without validating the
' certificate.
signedCms.CheckSignature(True)
備註
此方法利用成功解碼所得資訊,重置物件的所有成員變數。
另請參閱
適用於
Decode(ReadOnlySpan<Byte>)
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
- 來源:
- SignedCms.cs
public:
void Decode(ReadOnlySpan<System::Byte> encodedMessage);
public void Decode(ReadOnlySpan<byte> encodedMessage);
member this.Decode : ReadOnlySpan<byte> -> unit
Public Sub Decode (encodedMessage As ReadOnlySpan(Of Byte))
參數
- encodedMessage
- ReadOnlySpan<Byte>
一個只讀的位元組區段,代表待解碼的 CMS/PKCS#7 訊息。
例外狀況
encodedMessage 無法成功解碼。