Uredi

Deli z drugimi prek


CryptoConfig.EncodeOID(String) Method

Definition

Caution

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

Encodes the specified object identifier (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()

Parameters

str
String

The OID to encode.

Returns

Byte[]

A byte array containing the encoded OID.

Attributes

Exceptions

The str parameter is null.

An error occurred while encoding the OID.

Examples

The following code example demonstrates how to call the EncodeOID method to encode the specified object identifier. This 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)

Applies to

See also