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);
[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);
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")>]
static member EncodeOID : string -> byte[]
static member EncodeOID : string -> byte[]
Public Shared Function EncodeOID (str As String) As Byte()

參數

str
String

用OID來編碼。

傳回

Byte[]

一個包含編碼 OID 的位元組陣列。

屬性

例外狀況

參數 strnull

編碼 OID 時發生錯誤。

範例

以下程式碼範例示範如何呼叫 EncodeOID 該方法來編碼指定的物件識別碼。 此程式碼範例是本類別更大範例 CryptoConfig 的一部分。

// 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)

適用於

另請參閱