CryptoConfig.EncodeOID(String) 方法

定义

对指定的对象标识符 (OID) 进行编码。Encodes the specified object identifier (OID).

public:
 static cli::array <System::Byte> ^ EncodeOID(System::String ^ str);
public static byte[] EncodeOID (string str);
static member EncodeOID : string -> byte[]
Public Shared Function EncodeOID (str As String) As Byte()

参数

str
String

要进行编码的 OID。The OID to encode.

返回

Byte[]

包含编码 OID 的字节数组。A byte array containing the encoded OID.

例外

str 参数为 nullThe str parameter is null.

对 OID 进行编码时出现错误。An error occurred while encoding the OID.

示例

下面的代码示例演示如何调用 EncodeOID 方法对指定的对象标识符进行编码。The following code example demonstrates how to call the EncodeOID method to encode the specified object identifier. 此代码示例是为类提供的更大示例的一部分 CryptoConfigThis code example is part of a larger example provided for the CryptoConfig class.

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)

适用于