Condividi tramite


ValueAsnReader.ReadNamedBitListValue Metodo

Definizione

Overload

Nome Descrizione
ReadNamedBitListValue(Type, Nullable<Asn1Tag>)

Legge il valore successivo come NamedBitList con un tag specificato, convertendolo nell'enumerazione [FlagsAttribute] specificata da flagsEnumType.

ReadNamedBitListValue<TFlagsEnum>(Nullable<Asn1Tag>)

Legge il valore successivo come NamedBitList con un tag specificato, convertendolo nell'enumerazione [FlagsAttribute] specificata da TFlagsEnum.

ReadNamedBitListValue(Type, Nullable<Asn1Tag>)

Origine:
AsnDecoder.NamedBitList.cs

Legge il valore successivo come NamedBitList con un tag specificato, convertendolo nell'enumerazione [FlagsAttribute] specificata da flagsEnumType.

public Enum ReadNamedBitListValue(Type flagsEnumType, System.Formats.Asn1.Asn1Tag? expectedTag = default);
member this.ReadNamedBitListValue : Type * Nullable<System.Formats.Asn1.Asn1Tag> -> Enum
Public Function ReadNamedBitListValue (flagsEnumType As Type, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As Enum

Parametri

flagsEnumType
Type

Oggetto type che rappresenta il tipo di destinazione.

expectedTag
Nullable<Asn1Tag>

Tag da verificare prima della lettura.

Valori restituiti

Valore NamedBitList convertito in .flagsEnumType

Eccezioni

Il valore successivo non ha il tag corretto.

oppure

La codifica della lunghezza non è valida nelle regole di codifica correnti.

oppure

Il contenuto non è valido nelle regole di codifica correnti.

oppure

Il valore codificato è troppo grande per adattarsi a un flagsEnumType valore.

flagsEnumType non è un tipo di enumerazione.

 -or-

 <code data-dev-comment-type="paramref">flagsEnumType</code> was not declared with <xref data-throw-if-not-resolved="true" uid="System.FlagsAttribute"></xref>

 -or-

 <code data-dev-comment-type="paramref">expectedTag</code>.<xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.Asn1Tag.TagClass"></xref> is
 <xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.TagClass.Universal"></xref>, but
 <code data-dev-comment-type="paramref">expectedTag</code>.<xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.Asn1Tag.TagValue"></xref> is not correct for
 the method.

flagsEnumType è null

Vedi anche

Si applica a

ReadNamedBitListValue<TFlagsEnum>(Nullable<Asn1Tag>)

Origine:
AsnDecoder.NamedBitList.cs

Legge il valore successivo come NamedBitList con un tag specificato, convertendolo nell'enumerazione [FlagsAttribute] specificata da TFlagsEnum.

public TFlagsEnum ReadNamedBitListValue<TFlagsEnum>(System.Formats.Asn1.Asn1Tag? expectedTag = default) where TFlagsEnum : Enum;
member this.ReadNamedBitListValue : Nullable<System.Formats.Asn1.Asn1Tag> -> 'FlagsEnum (requires 'FlagsEnum :> Enum)
Public Function ReadNamedBitListValue(Of TFlagsEnum As Enum) (Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As TFlagsEnum

Parametri di tipo

TFlagsEnum

Tipo di enumerazione di destinazione.

Parametri

expectedTag
Nullable<Asn1Tag>

Tag da verificare prima della lettura.

Valori restituiti

TFlagsEnum

Valore NamedBitList convertito in .TFlagsEnum

Eccezioni

Il valore successivo non ha il tag corretto.

oppure

La codifica della lunghezza non è valida nelle regole di codifica correnti.

oppure

Il contenuto non è valido nelle regole di codifica correnti.

oppure

Il valore codificato è troppo grande per adattarsi a un TFlagsEnum valore.

TFlagsEnum non è un tipo di enumerazione.

 -or-

 <code data-dev-comment-type="typeparamref">TFlagsEnum</code> was not declared with <xref data-throw-if-not-resolved="true" uid="System.FlagsAttribute"></xref>

 -or-

 <code data-dev-comment-type="paramref">expectedTag</code>.<xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.Asn1Tag.TagClass"></xref> is
 <xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.TagClass.Universal"></xref>, but
 <code data-dev-comment-type="paramref">expectedTag</code>.<xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.Asn1Tag.TagValue"></xref> is not correct for
 the method.

Commenti

L'allineamento dei bit eseguito da questo metodo consiste nell'interpretare il bit più significativo nel primo byte del valore come bit meno significativo in TFlagsEnum, con bit che aumentano in valore fino al bit meno significativo del primo byte, procedendo con il bit più significativo del secondo byte e così via. In questo schema è possibile usare insieme la dichiarazione di tipo ASN.1 seguente e l'enumerazione C#:

KeyUsage ::= BIT STRING {
  digitalSignature   (0),
  nonRepudiation     (1),
  keyEncipherment    (2),
  dataEncipherment   (3),
  keyAgreement       (4),
  keyCertSign        (5),
  cRLSign            (6),
  encipherOnly       (7),
  decipherOnly       (8) }
[Flags]
enum KeyUsage
{
    None              = 0,
    DigitalSignature  = 1 << (0),
    NonRepudiation    = 1 << (1),
    KeyEncipherment   = 1 << (2),
    DataEncipherment  = 1 << (3),
    KeyAgreement      = 1 << (4),
    KeyCertSign       = 1 << (5),
    CrlSign           = 1 << (6),
    EncipherOnly      = 1 << (7),
    DecipherOnly      = 1 << (8),
}

Mentre l'esempio qui usa KeyUsage NamedBitList da RFC 3280 (4.2.1.3), l'enumerazione di esempio usa valori diversi da System.Security.Cryptography.X509Certificates.X509KeyUsageFlags.

Si applica a