SignedCms.Decode 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Decode(Byte[]) |
对已编码的 SignedCms 消息进行解码。 |
Decode(ReadOnlySpan<Byte>) |
Decode(Byte[])
- Source:
- SignedCms.cs
- Source:
- SignedCms.cs
- Source:
- SignedCms.cs
- Source:
- SignedCms.cs
- Source:
- 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
无法成功解码。
示例
以下示例演示方法在验证邮件签名SignedCms的过程中的位置Decode。 在此示例中,消息内容未分离,因此消息内容包含在消息中 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)
以下示例演示方法在验证邮件签名SignedCms的过程中的位置Decode。 在此示例中,消息内容是分离的,因此必须独立于 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>)
- Source:
- SignedCms.cs
- Source:
- SignedCms.cs
- Source:
- SignedCms.cs
- Source:
- SignedCms.cs
- Source:
- 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
无法成功解码。