CryptoConfig.EncodeOID(String) Metod

Definition

Varning

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

Kodar den angivna objektidentifieraren (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()

Parametrar

str
String

Den OID som ska kodas.

Returer

Byte[]

En bytematris som innehåller den kodade OID:en.

Attribut

Undantag

Parametern str är null.

Ett fel uppstod när OID kodades.

Exempel

I följande kodexempel visas hur du anropar EncodeOID metoden för att koda den angivna objektidentifieraren. Det här kodexemplet är en del av ett större exempel för CryptoConfig klassen.

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

Gäller för

Se även