次の方法で共有


ValueAsnReader.ReadNamedBitListValue メソッド

定義

オーバーロード

名前 説明
ReadNamedBitListValue(Type, Nullable<Asn1Tag>)

指定したタグを持つ NamedBitList として次の値を読み取り、FlagsAttributeで指定された [flagsEnumType] 列挙型に変換します。

ReadNamedBitListValue<TFlagsEnum>(Nullable<Asn1Tag>)

指定したタグを持つ NamedBitList として次の値を読み取り、FlagsAttributeで指定された [TFlagsEnum] 列挙型に変換します。

ReadNamedBitListValue(Type, Nullable<Asn1Tag>)

ソース:
AsnDecoder.NamedBitList.cs

指定したタグを持つ NamedBitList として次の値を読み取り、FlagsAttributeで指定された [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

パラメーター

flagsEnumType
Type

変換先の型を表す Type オブジェクト。

expectedTag
Nullable<Asn1Tag>

読み取る前に確認するタグ。

返品

flagsEnumTypeに変換された NamedBitList 値。

例外

次の値に正しいタグがありません。

-又は-

現在のエンコード規則では、長さのエンコードは無効です。

-又は-

コンテンツは、現在のエンコード規則では無効です。

-又は-

エンコードされた値が大きすぎて、 flagsEnumType 値に収まりません。

flagsEnumType は列挙型ではありません。

 -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.

flagsEnumTypenull です

こちらもご覧ください

適用対象

ReadNamedBitListValue<TFlagsEnum>(Nullable<Asn1Tag>)

ソース:
AsnDecoder.NamedBitList.cs

指定したタグを持つ NamedBitList として次の値を読み取り、FlagsAttributeで指定された [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

型パラメーター

TFlagsEnum

変換先の列挙型。

パラメーター

expectedTag
Nullable<Asn1Tag>

読み取る前に確認するタグ。

返品

TFlagsEnum

TFlagsEnumに変換された NamedBitList 値。

例外

次の値に正しいタグがありません。

-又は-

現在のエンコード規則では、長さのエンコードは無効です。

-又は-

コンテンツは、現在のエンコード規則では無効です。

-又は-

エンコードされた値が大きすぎて、 TFlagsEnum 値に収まりません。

TFlagsEnum は列挙型ではありません。

 -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.

注釈

このメソッドによって実行されるビットアラインメントは、値の最初のバイトの最上位ビットを TFlagsEnumの最下位ビットとして解釈し、ビットは最初のバイトの最下位ビットまで値が増加し、2 番目のバイトの最上位ビットが続くなどです。 このスキームでは、次の ASN.1 型宣言と 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),
}

この例では RFC 3280 (4.2.1.3) の KeyUsage NamedBitList を使用していますが、この列挙型の例では System.Security.Cryptography.X509Certificates.X509KeyUsageFlags とは異なる値を使用しています。

適用対象