CryptoConfig.EncodeOID(String) 方法

定义

注意

EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.

对指定的对象标识符 (OID) 进行编码。

public:
 static cli::array <System::Byte> ^ EncodeOID(System::String ^ str);
public static byte[] EncodeOID (string str);
[System.Obsolete("EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.", DiagnosticId="SYSLIB0031", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static byte[] EncodeOID (string str);
static member EncodeOID : string -> byte[]
[<System.Obsolete("EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.", DiagnosticId="SYSLIB0031", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member EncodeOID : string -> byte[]
Public Shared Function EncodeOID (str As String) As Byte()

参数

str
String

要进行编码的 OID。

返回

Byte[]

包含编码 OID 的字节数组。

属性

例外

str 参数为 null

对 OID 进行编码时出现错误。

示例

下面的代码示例演示如何调用 EncodeOID 方法来对指定的对象标识符进行编码。 此代码示例是为 CryptoConfig 类提供的一个更大示例的一部分。

array<Byte>^encodedMessage = CryptoConfig::EncodeOID( sha1Oid );
// This example uses the SHA1 algorithm.
// Due to collision problems with SHA1, Microsoft recommends SHA256 or better.
byte[] encodedMessage = CryptoConfig.EncodeOID(sha1Oid);
' This example uses the SHA1 algorithm.
' Due to collision problems with SHA1, Microsoft recommends SHA256 or better.
Dim encodedMessage() As Byte = cryptoConfig.EncodeOID(sha1Oid)

适用于

另请参阅