OIDとは? わかりやすく解説

Oid クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

暗号オブジェクト識別子表します。このクラス継承できません。

名前空間: System.Security.Cryptography
アセンブリ: System (system.dll 内)
構文構文

解説解説
使用例使用例

Oid クラス使用するコード例次に示します

Imports System
Imports System.Security.Cryptography


Public Class OidSample
   Shared msg As String
   Public Shared Sub Main()
      ' Assign values to strings.
      Dim Value1 As String
 = "1.2.840.113549.1.1.1"
      Dim Name1 As String
 = "3DES"
      Dim Value2 As String
 = "1.3.6.1.4.1.311.20.2"
      Dim InvalidName As String
 = "This name is not a valid name"
      Dim InvalidValue As String
 = "1.1.1.1.1.1.1.1"
      
      ' Create new Oid objects using the specified values.
      ' Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
      Dim o1 As New Oid(Value1)
      Dim o2 As New Oid(Name1)
      
      ' Create a new Oid object using the specified Value and Friendly
 Name properties.
      ' Note that the two are not compared to determine if the Value
 is associated 
      '  with the Friendly Name.
      Dim o3 As New Oid(Value2,
 InvalidName)
      
      'Create a new Oid object using the specified Value. Note that
 if the value
      '  is invalid or not known, no value is assigned to the Friendly
 Name property.
      Dim o4 As New Oid(InvalidValue)
      
      'Write out the property information of the Oid objects.
    msg = "Oid1: Automatically assigned Friendly Name: "
 & o1.FriendlyName & ", " & o1.Value
    MsgBox(msg)
      'Console.WriteLine("Oid1: Automatically assigned Friendly
 Name: {0}, {1}", o1.FriendlyName, o1.Value)


      'Console.WriteLine("Oid2: Automatically assigned Value: {0},
 {1}", o2.FriendlyName, o2.Value)
    msg = "Oid2: Automatically assigned Value: " &
 o2.FriendlyName & ", " & o2.Value
    MsgBox(msg)


      'Console.WriteLine("Oid3: Name and Value not compared: {0},
 {1}", o3.FriendlyName, o3.Value)
    msg = "Oid3: Name and Value not compared: " &
 o3.FriendlyName & ", " & o3.Value
    MsgBox(msg)



     ' Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}",
 o4.FriendlyName, o4.Value, Environment.NewLine)
    msg = "Oid4: Invalid Value used: " & o4.FriendlyName
 & ", " & o4.Value
    MsgBox(msg)
 

     
      'Create an Oid collection and add several Oid objects.
      Dim oc As New OidCollection()
      oc.Add(o1)
      oc.Add(o2)
      oc.Add(o3)
     ' Console.WriteLine("Number of Oids in the collection: {0}",
 oc.Count)
      ' Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine)

    msg = "Number of Oids in the collection: " &
 oc.Count
    MsgBox(msg)
    msg = "Is synchronized: " & oc.IsSynchronized
    MsgBox(msg)

      
      'Create an enumerator for moving through the collection.
      Dim oe As OidEnumerator = oc.GetEnumerator()
      'You must execute a MoveNext() to get to the first item in the
 collection.
      oe.MoveNext()
      ' Write out Oids in the collection.
      'Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "First Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      oe.MoveNext()
     ' Console.WriteLine("Second Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "Second Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      'Return index in the collection to the beginning.
      oe.Reset()
   End Sub 'Main
End Class 'OidSample
using System;
using System.Security.Cryptography;
public class OidSample
{
    public static void Main()
    {
        // Assign values to strings.
        string Value1 = "1.2.840.113549.1.1.1";
        string Name1 = "3DES";
        string Value2 = "1.3.6.1.4.1.311.20.2";
        string InvalidName = "This name is not a valid name";
        string InvalidValue = "1.1.1.1.1.1.1.1";

        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
        Oid o1 = new Oid(Value1);
        Oid o2 = new Oid(Name1);

        // Create a new Oid object using the specified Value and Friendly
 Name properties.
        // Note that the two are not compared to determine if the Value
 is associated 
        //  with the Friendly Name.
        Oid o3 = new Oid(Value2, InvalidName);

        //Create a new Oid object using the specified Value. Note that
 if the value
        //  is invalid or not known, no value is assigned to the Friendly
 Name property.
        Oid o4 = new Oid(InvalidValue);

        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}", o1.FriendlyName, o1.Value);
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 o2.FriendlyName, o2.Value);
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 o3.FriendlyName, o3.Value);
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName,
 o4.Value, Environment.NewLine);

        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", oc.Count);
        Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine);

        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName,oe.Current.Value);
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
 oe.Current.FriendlyName, oe.Current.Value);
        //Return index in the collection to the beginning.
        oe.Reset();
    }
}
#using <system.dll>

using namespace System;
using namespace System::Security::Cryptography;
int main()
{
   
   // Assign values to strings.
   String^ Value1 = "1.2.840.113549.1.1.1";
   String^ Name1 = "3DES";
   String^ Value2 = "1.3.6.1.4.1.311.20.2";
   String^ InvalidName = "This name is not a valid name";
   String^ InvalidValue = "1.1.1.1.1.1.1.1";
   
   // Create new Oid objects using the specified values.
   // Note that the corresponding Value or Friendly Name property is
 automatically added to the object.
   Oid ^ o1 = gcnew Oid( Value1 );
   Oid ^ o2 = gcnew Oid( Name1 );
   
   // Create a new Oid object using the specified Value and Friendly
 Name properties.
   // Note that the two are not compared to determine if the Value is
 associated 
   //  with the Friendly Name.
   Oid ^ o3 = gcnew Oid( Value2,InvalidName );
   
   //Create a new Oid object using the specified Value. Note that if
 the value
   //  is invalid or not known, no value is assigned to the Friendly
 Name property.
   Oid ^ o4 = gcnew Oid( InvalidValue );
   
   //Write out the property information of the Oid objects.
   Console::WriteLine( "Oid1: Automatically assigned Friendly Name: {0}, {1}",
 o1->FriendlyName, o1->Value );
   Console::WriteLine( "Oid2: Automatically assigned Value: {0}, {1}",
 o2->FriendlyName, o2->Value );
   Console::WriteLine( "Oid3: Name and Value not compared: {0}, {1}", o3->FriendlyName,
 o3->Value );
   Console::WriteLine( "Oid4: Invalid Value used: {0}, {1} {2}", o4->FriendlyName,
 o4->Value, Environment::NewLine );
   
   //Create an Oid collection and add several Oid objects.
   OidCollection ^ oc = gcnew OidCollection;
   oc->Add( o1 );
   oc->Add( o2 );
   oc->Add( o3 );
   Console::WriteLine( "Number of Oids in the collection:
 {0}", oc->Count );
   Console::WriteLine( "Is synchronized: {0} {1}", oc->IsSynchronized,
 Environment::NewLine );
   
   //Create an enumerator for moving through the collection.
   OidEnumerator ^ oe = oc->GetEnumerator();
   
   //You must execute a MoveNext() to get to the first item in the collection.
   oe->MoveNext();
   
   // Write out Oids in the collection.
   Console::WriteLine( "First Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   oe->MoveNext();
   Console::WriteLine( "Second Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   
   //Return index in the collection to the beginning.
   oe->Reset();
}

import System.*;
import System.Security.Cryptography.*;

public class OidSample
{
    public static void main(String
 args[])
    {
        // Assign values to strings.
        String value1 = "1.2.840.113549.1.1.1";
        String name1 = "3DES";
        String value2 = "1.3.6.1.4.1.311.20.2";
        String invalidName = "This name is not a valid name";
        String invalidValue = "1.1.1.1.1.1.1.1";
        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 
        // is automatically added to the object.
        Oid o1 = new Oid(value1);
        Oid o2 = new Oid(name1);
        // Create a new Oid object using the specified Value and Friendly
 
        // Name properties.
        // Note that the two are not compared to determine if the Value
 is 
        // associated with the Friendly Name.
        Oid o3 = new Oid(value2, invalidName);
        // Create a new Oid object using the specified Value. Note that
 if the
        // value is invalid or not known, no value is assigned to the
 Friendly 
        // Name property.
        Oid o4 = new Oid(invalidValue);
        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}",
            o1.get_FriendlyName(), o1.get_Value());
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 
            o2.get_FriendlyName(), o2.get_Value());
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 
            o3.get_FriendlyName(), o3.get_Value());
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", 
            o4.get_FriendlyName(), o4.get_Value(), Environment.get_NewLine());
        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", 
            System.Convert.ToString(oc.get_Count()));
        Console.WriteLine("Is synchronized: {0} {1}", 
            System.Convert.ToString(oc.get_IsSynchronized()), 
            Environment.get_NewLine());
        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the
        //collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 
            oe.get_Current().get_FriendlyName(), 
            oe.get_Current().get_Value());
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
            oe.get_Current().get_FriendlyName(), oe.get_Current().get_Value());
        //Return index in the collection to the beginning.
        oe.Reset();
    } //main
} //OidSample
継承階層継承階層
System.Object
  System.Security.Cryptography.Oid
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Oid メンバ
System.Security.Cryptography 名前空間

Oid コンストラクタ ()

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

Oid クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: System (system.dll 内)
構文構文

解説解説

これは、既定コンストラクタです。

使用例使用例

Oid クラス使用するコード例次に示します

Imports System
Imports System.Security.Cryptography


Public Class OidSample
   Shared msg As String
   Public Shared Sub Main()
      ' Assign values to strings.
      Dim Value1 As String
 = "1.2.840.113549.1.1.1"
      Dim Name1 As String
 = "3DES"
      Dim Value2 As String
 = "1.3.6.1.4.1.311.20.2"
      Dim InvalidName As String
 = "This name is not a valid name"
      Dim InvalidValue As String
 = "1.1.1.1.1.1.1.1"
      
      ' Create new Oid objects using the specified values.
      ' Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
      Dim o1 As New Oid(Value1)
      Dim o2 As New Oid(Name1)
      
      ' Create a new Oid object using the specified Value and Friendly
 Name properties.
      ' Note that the two are not compared to determine if the Value
 is associated 
      '  with the Friendly Name.
      Dim o3 As New Oid(Value2,
 InvalidName)
      
      'Create a new Oid object using the specified Value. Note that
 if the value
      '  is invalid or not known, no value is assigned to the Friendly
 Name property.
      Dim o4 As New Oid(InvalidValue)
      
      'Write out the property information of the Oid objects.
    msg = "Oid1: Automatically assigned Friendly Name: "
 & o1.FriendlyName & ", " & o1.Value
    MsgBox(msg)
      'Console.WriteLine("Oid1: Automatically assigned Friendly
 Name: {0}, {1}", o1.FriendlyName, o1.Value)


      'Console.WriteLine("Oid2: Automatically assigned Value: {0},
 {1}", o2.FriendlyName, o2.Value)
    msg = "Oid2: Automatically assigned Value: " &
 o2.FriendlyName & ", " & o2.Value
    MsgBox(msg)


      'Console.WriteLine("Oid3: Name and Value not compared: {0},
 {1}", o3.FriendlyName, o3.Value)
    msg = "Oid3: Name and Value not compared: " &
 o3.FriendlyName & ", " & o3.Value
    MsgBox(msg)



     ' Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}",
 o4.FriendlyName, o4.Value, Environment.NewLine)
    msg = "Oid4: Invalid Value used: " & o4.FriendlyName
 & ", " & o4.Value
    MsgBox(msg)
 

     
      'Create an Oid collection and add several Oid objects.
      Dim oc As New OidCollection()
      oc.Add(o1)
      oc.Add(o2)
      oc.Add(o3)
     ' Console.WriteLine("Number of Oids in the collection: {0}",
 oc.Count)
      ' Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine)

    msg = "Number of Oids in the collection: " &
 oc.Count
    MsgBox(msg)
    msg = "Is synchronized: " & oc.IsSynchronized
    MsgBox(msg)

      
      'Create an enumerator for moving through the collection.
      Dim oe As OidEnumerator = oc.GetEnumerator()
      'You must execute a MoveNext() to get to the first item in the
 collection.
      oe.MoveNext()
      ' Write out Oids in the collection.
      'Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "First Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      oe.MoveNext()
     ' Console.WriteLine("Second Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "Second Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      'Return index in the collection to the beginning.
      oe.Reset()
   End Sub 'Main
End Class 'OidSample
using System;
using System.Security.Cryptography;
public class OidSample
{
    public static void Main()
    {
        // Assign values to strings.
        string Value1 = "1.2.840.113549.1.1.1";
        string Name1 = "3DES";
        string Value2 = "1.3.6.1.4.1.311.20.2";
        string InvalidName = "This name is not a valid name";
        string InvalidValue = "1.1.1.1.1.1.1.1";

        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
        Oid o1 = new Oid(Value1);
        Oid o2 = new Oid(Name1);

        // Create a new Oid object using the specified Value and Friendly
 Name properties.
        // Note that the two are not compared to determine if the Value
 is associated 
        //  with the Friendly Name.
        Oid o3 = new Oid(Value2, InvalidName);

        //Create a new Oid object using the specified Value. Note that
 if the value
        //  is invalid or not known, no value is assigned to the Friendly
 Name property.
        Oid o4 = new Oid(InvalidValue);

        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}", o1.FriendlyName, o1.Value);
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 o2.FriendlyName, o2.Value);
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 o3.FriendlyName, o3.Value);
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName,
 o4.Value, Environment.NewLine);

        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", oc.Count);
        Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine);

        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName,oe.Current.Value);
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
 oe.Current.FriendlyName, oe.Current.Value);
        //Return index in the collection to the beginning.
        oe.Reset();
    }
}
#using <system.dll>

using namespace System;
using namespace System::Security::Cryptography;
int main()
{
   
   // Assign values to strings.
   String^ Value1 = "1.2.840.113549.1.1.1";
   String^ Name1 = "3DES";
   String^ Value2 = "1.3.6.1.4.1.311.20.2";
   String^ InvalidName = "This name is not a valid name";
   String^ InvalidValue = "1.1.1.1.1.1.1.1";
   
   // Create new Oid objects using the specified values.
   // Note that the corresponding Value or Friendly Name property is
 automatically added to the object.
   Oid ^ o1 = gcnew Oid( Value1 );
   Oid ^ o2 = gcnew Oid( Name1 );
   
   // Create a new Oid object using the specified Value and Friendly
 Name properties.
   // Note that the two are not compared to determine if the Value is
 associated 
   //  with the Friendly Name.
   Oid ^ o3 = gcnew Oid( Value2,InvalidName );
   
   //Create a new Oid object using the specified Value. Note that if
 the value
   //  is invalid or not known, no value is assigned to the Friendly
 Name property.
   Oid ^ o4 = gcnew Oid( InvalidValue );
   
   //Write out the property information of the Oid objects.
   Console::WriteLine( "Oid1: Automatically assigned Friendly Name: {0}, {1}",
 o1->FriendlyName, o1->Value );
   Console::WriteLine( "Oid2: Automatically assigned Value: {0}, {1}",
 o2->FriendlyName, o2->Value );
   Console::WriteLine( "Oid3: Name and Value not compared: {0}, {1}", o3->FriendlyName,
 o3->Value );
   Console::WriteLine( "Oid4: Invalid Value used: {0}, {1} {2}", o4->FriendlyName,
 o4->Value, Environment::NewLine );
   
   //Create an Oid collection and add several Oid objects.
   OidCollection ^ oc = gcnew OidCollection;
   oc->Add( o1 );
   oc->Add( o2 );
   oc->Add( o3 );
   Console::WriteLine( "Number of Oids in the collection:
 {0}", oc->Count );
   Console::WriteLine( "Is synchronized: {0} {1}", oc->IsSynchronized,
 Environment::NewLine );
   
   //Create an enumerator for moving through the collection.
   OidEnumerator ^ oe = oc->GetEnumerator();
   
   //You must execute a MoveNext() to get to the first item in the collection.
   oe->MoveNext();
   
   // Write out Oids in the collection.
   Console::WriteLine( "First Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   oe->MoveNext();
   Console::WriteLine( "Second Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   
   //Return index in the collection to the beginning.
   oe->Reset();
}

import System.*;
import System.Security.Cryptography.*;

public class OidSample
{
    public static void main(String
 args[])
    {
        // Assign values to strings.
        String value1 = "1.2.840.113549.1.1.1";
        String name1 = "3DES";
        String value2 = "1.3.6.1.4.1.311.20.2";
        String invalidName = "This name is not a valid name";
        String invalidValue = "1.1.1.1.1.1.1.1";
        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 
        // is automatically added to the object.
        Oid o1 = new Oid(value1);
        Oid o2 = new Oid(name1);
        // Create a new Oid object using the specified Value and Friendly
 
        // Name properties.
        // Note that the two are not compared to determine if the Value
 is 
        // associated with the Friendly Name.
        Oid o3 = new Oid(value2, invalidName);
        // Create a new Oid object using the specified Value. Note that
 if the
        // value is invalid or not known, no value is assigned to the
 Friendly 
        // Name property.
        Oid o4 = new Oid(invalidValue);
        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}",
            o1.get_FriendlyName(), o1.get_Value());
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 
            o2.get_FriendlyName(), o2.get_Value());
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 
            o3.get_FriendlyName(), o3.get_Value());
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", 
            o4.get_FriendlyName(), o4.get_Value(), Environment.get_NewLine());
        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", 
            System.Convert.ToString(oc.get_Count()));
        Console.WriteLine("Is synchronized: {0} {1}", 
            System.Convert.ToString(oc.get_IsSynchronized()), 
            Environment.get_NewLine());
        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the
        //collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 
            oe.get_Current().get_FriendlyName(), 
            oe.get_Current().get_Value());
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
            oe.get_Current().get_FriendlyName(), oe.get_Current().get_Value());
        //Return index in the collection to the beginning.
        oe.Reset();
    } //main
} //OidSample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Oid クラス
Oid メンバ
System.Security.Cryptography 名前空間

Oid コンストラクタ (String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

Oid オブジェクト文字列値を使用してOid クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: System (system.dll 内)
構文構文

解説解説
使用例使用例

Oid クラス使用するコード例次に示します

Imports System
Imports System.Security.Cryptography


Public Class OidSample
   Shared msg As String
   Public Shared Sub Main()
      ' Assign values to strings.
      Dim Value1 As String
 = "1.2.840.113549.1.1.1"
      Dim Name1 As String
 = "3DES"
      Dim Value2 As String
 = "1.3.6.1.4.1.311.20.2"
      Dim InvalidName As String
 = "This name is not a valid name"
      Dim InvalidValue As String
 = "1.1.1.1.1.1.1.1"
      
      ' Create new Oid objects using the specified values.
      ' Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
      Dim o1 As New Oid(Value1)
      Dim o2 As New Oid(Name1)
      
      ' Create a new Oid object using the specified Value and Friendly
 Name properties.
      ' Note that the two are not compared to determine if the Value
 is associated 
      '  with the Friendly Name.
      Dim o3 As New Oid(Value2,
 InvalidName)
      
      'Create a new Oid object using the specified Value. Note that
 if the value
      '  is invalid or not known, no value is assigned to the Friendly
 Name property.
      Dim o4 As New Oid(InvalidValue)
      
      'Write out the property information of the Oid objects.
    msg = "Oid1: Automatically assigned Friendly Name: "
 & o1.FriendlyName & ", " & o1.Value
    MsgBox(msg)
      'Console.WriteLine("Oid1: Automatically assigned Friendly
 Name: {0}, {1}", o1.FriendlyName, o1.Value)


      'Console.WriteLine("Oid2: Automatically assigned Value: {0},
 {1}", o2.FriendlyName, o2.Value)
    msg = "Oid2: Automatically assigned Value: " &
 o2.FriendlyName & ", " & o2.Value
    MsgBox(msg)


      'Console.WriteLine("Oid3: Name and Value not compared: {0},
 {1}", o3.FriendlyName, o3.Value)
    msg = "Oid3: Name and Value not compared: " &
 o3.FriendlyName & ", " & o3.Value
    MsgBox(msg)



     ' Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}",
 o4.FriendlyName, o4.Value, Environment.NewLine)
    msg = "Oid4: Invalid Value used: " & o4.FriendlyName
 & ", " & o4.Value
    MsgBox(msg)
 

     
      'Create an Oid collection and add several Oid objects.
      Dim oc As New OidCollection()
      oc.Add(o1)
      oc.Add(o2)
      oc.Add(o3)
     ' Console.WriteLine("Number of Oids in the collection: {0}",
 oc.Count)
      ' Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine)

    msg = "Number of Oids in the collection: " &
 oc.Count
    MsgBox(msg)
    msg = "Is synchronized: " & oc.IsSynchronized
    MsgBox(msg)

      
      'Create an enumerator for moving through the collection.
      Dim oe As OidEnumerator = oc.GetEnumerator()
      'You must execute a MoveNext() to get to the first item in the
 collection.
      oe.MoveNext()
      ' Write out Oids in the collection.
      'Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "First Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      oe.MoveNext()
     ' Console.WriteLine("Second Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "Second Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      'Return index in the collection to the beginning.
      oe.Reset()
   End Sub 'Main
End Class 'OidSample
using System;
using System.Security.Cryptography;
public class OidSample
{
    public static void Main()
    {
        // Assign values to strings.
        string Value1 = "1.2.840.113549.1.1.1";
        string Name1 = "3DES";
        string Value2 = "1.3.6.1.4.1.311.20.2";
        string InvalidName = "This name is not a valid name";
        string InvalidValue = "1.1.1.1.1.1.1.1";

        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
        Oid o1 = new Oid(Value1);
        Oid o2 = new Oid(Name1);

        // Create a new Oid object using the specified Value and Friendly
 Name properties.
        // Note that the two are not compared to determine if the Value
 is associated 
        //  with the Friendly Name.
        Oid o3 = new Oid(Value2, InvalidName);

        //Create a new Oid object using the specified Value. Note that
 if the value
        //  is invalid or not known, no value is assigned to the Friendly
 Name property.
        Oid o4 = new Oid(InvalidValue);

        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}", o1.FriendlyName, o1.Value);
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 o2.FriendlyName, o2.Value);
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 o3.FriendlyName, o3.Value);
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName,
 o4.Value, Environment.NewLine);

        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", oc.Count);
        Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine);

        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName,oe.Current.Value);
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
 oe.Current.FriendlyName, oe.Current.Value);
        //Return index in the collection to the beginning.
        oe.Reset();
    }
}
#using <system.dll>

using namespace System;
using namespace System::Security::Cryptography;
int main()
{
   
   // Assign values to strings.
   String^ Value1 = "1.2.840.113549.1.1.1";
   String^ Name1 = "3DES";
   String^ Value2 = "1.3.6.1.4.1.311.20.2";
   String^ InvalidName = "This name is not a valid name";
   String^ InvalidValue = "1.1.1.1.1.1.1.1";
   
   // Create new Oid objects using the specified values.
   // Note that the corresponding Value or Friendly Name property is
 automatically added to the object.
   Oid ^ o1 = gcnew Oid( Value1 );
   Oid ^ o2 = gcnew Oid( Name1 );
   
   // Create a new Oid object using the specified Value and Friendly
 Name properties.
   // Note that the two are not compared to determine if the Value is
 associated 
   //  with the Friendly Name.
   Oid ^ o3 = gcnew Oid( Value2,InvalidName );
   
   //Create a new Oid object using the specified Value. Note that if
 the value
   //  is invalid or not known, no value is assigned to the Friendly
 Name property.
   Oid ^ o4 = gcnew Oid( InvalidValue );
   
   //Write out the property information of the Oid objects.
   Console::WriteLine( "Oid1: Automatically assigned Friendly Name: {0}, {1}",
 o1->FriendlyName, o1->Value );
   Console::WriteLine( "Oid2: Automatically assigned Value: {0}, {1}",
 o2->FriendlyName, o2->Value );
   Console::WriteLine( "Oid3: Name and Value not compared: {0}, {1}", o3->FriendlyName,
 o3->Value );
   Console::WriteLine( "Oid4: Invalid Value used: {0}, {1} {2}", o4->FriendlyName,
 o4->Value, Environment::NewLine );
   
   //Create an Oid collection and add several Oid objects.
   OidCollection ^ oc = gcnew OidCollection;
   oc->Add( o1 );
   oc->Add( o2 );
   oc->Add( o3 );
   Console::WriteLine( "Number of Oids in the collection:
 {0}", oc->Count );
   Console::WriteLine( "Is synchronized: {0} {1}", oc->IsSynchronized,
 Environment::NewLine );
   
   //Create an enumerator for moving through the collection.
   OidEnumerator ^ oe = oc->GetEnumerator();
   
   //You must execute a MoveNext() to get to the first item in the collection.
   oe->MoveNext();
   
   // Write out Oids in the collection.
   Console::WriteLine( "First Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   oe->MoveNext();
   Console::WriteLine( "Second Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   
   //Return index in the collection to the beginning.
   oe->Reset();
}

import System.*;
import System.Security.Cryptography.*;

public class OidSample
{
    public static void main(String
 args[])
    {
        // Assign values to strings.
        String value1 = "1.2.840.113549.1.1.1";
        String name1 = "3DES";
        String value2 = "1.3.6.1.4.1.311.20.2";
        String invalidName = "This name is not a valid name";
        String invalidValue = "1.1.1.1.1.1.1.1";
        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 
        // is automatically added to the object.
        Oid o1 = new Oid(value1);
        Oid o2 = new Oid(name1);
        // Create a new Oid object using the specified Value and Friendly
 
        // Name properties.
        // Note that the two are not compared to determine if the Value
 is 
        // associated with the Friendly Name.
        Oid o3 = new Oid(value2, invalidName);
        // Create a new Oid object using the specified Value. Note that
 if the
        // value is invalid or not known, no value is assigned to the
 Friendly 
        // Name property.
        Oid o4 = new Oid(invalidValue);
        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}",
            o1.get_FriendlyName(), o1.get_Value());
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 
            o2.get_FriendlyName(), o2.get_Value());
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 
            o3.get_FriendlyName(), o3.get_Value());
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", 
            o4.get_FriendlyName(), o4.get_Value(), Environment.get_NewLine());
        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", 
            System.Convert.ToString(oc.get_Count()));
        Console.WriteLine("Is synchronized: {0} {1}", 
            System.Convert.ToString(oc.get_IsSynchronized()), 
            Environment.get_NewLine());
        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the
        //collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 
            oe.get_Current().get_FriendlyName(), 
            oe.get_Current().get_Value());
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
            oe.get_Current().get_FriendlyName(), oe.get_Current().get_Value());
        //Return index in the collection to the beginning.
        oe.Reset();
    } //main
} //OidSample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Oid クラス
Oid メンバ
System.Security.Cryptography 名前空間

Oid コンストラクタ (Oid)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

Oid オブジェクト指定してOid クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    oid As Oid _
)
Dim oid As Oid

Dim instance As New Oid(oid)
public Oid (
    Oid oid
)
public:
Oid (
    Oid^ oid
)
public Oid (
    Oid oid
)
public function Oid (
    oid : Oid
)

パラメータ

oid

新しオブジェクト識別子作成するために使用されるオブジェクト識別子情報

解説解説
使用例使用例

Oid クラス使用するコード例次に示します

Imports System
Imports System.Security.Cryptography


Public Class OidSample
   Shared msg As String
   Public Shared Sub Main()
      ' Assign values to strings.
      Dim Value1 As String
 = "1.2.840.113549.1.1.1"
      Dim Name1 As String
 = "3DES"
      Dim Value2 As String
 = "1.3.6.1.4.1.311.20.2"
      Dim InvalidName As String
 = "This name is not a valid name"
      Dim InvalidValue As String
 = "1.1.1.1.1.1.1.1"
      
      ' Create new Oid objects using the specified values.
      ' Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
      Dim o1 As New Oid(Value1)
      Dim o2 As New Oid(Name1)
      
      ' Create a new Oid object using the specified Value and Friendly
 Name properties.
      ' Note that the two are not compared to determine if the Value
 is associated 
      '  with the Friendly Name.
      Dim o3 As New Oid(Value2,
 InvalidName)
      
      'Create a new Oid object using the specified Value. Note that
 if the value
      '  is invalid or not known, no value is assigned to the Friendly
 Name property.
      Dim o4 As New Oid(InvalidValue)
      
      'Write out the property information of the Oid objects.
    msg = "Oid1: Automatically assigned Friendly Name: "
 & o1.FriendlyName & ", " & o1.Value
    MsgBox(msg)
      'Console.WriteLine("Oid1: Automatically assigned Friendly
 Name: {0}, {1}", o1.FriendlyName, o1.Value)


      'Console.WriteLine("Oid2: Automatically assigned Value: {0},
 {1}", o2.FriendlyName, o2.Value)
    msg = "Oid2: Automatically assigned Value: " &
 o2.FriendlyName & ", " & o2.Value
    MsgBox(msg)


      'Console.WriteLine("Oid3: Name and Value not compared: {0},
 {1}", o3.FriendlyName, o3.Value)
    msg = "Oid3: Name and Value not compared: " &
 o3.FriendlyName & ", " & o3.Value
    MsgBox(msg)



     ' Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}",
 o4.FriendlyName, o4.Value, Environment.NewLine)
    msg = "Oid4: Invalid Value used: " & o4.FriendlyName
 & ", " & o4.Value
    MsgBox(msg)
 

     
      'Create an Oid collection and add several Oid objects.
      Dim oc As New OidCollection()
      oc.Add(o1)
      oc.Add(o2)
      oc.Add(o3)
     ' Console.WriteLine("Number of Oids in the collection: {0}",
 oc.Count)
      ' Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine)

    msg = "Number of Oids in the collection: " &
 oc.Count
    MsgBox(msg)
    msg = "Is synchronized: " & oc.IsSynchronized
    MsgBox(msg)

      
      'Create an enumerator for moving through the collection.
      Dim oe As OidEnumerator = oc.GetEnumerator()
      'You must execute a MoveNext() to get to the first item in the
 collection.
      oe.MoveNext()
      ' Write out Oids in the collection.
      'Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "First Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      oe.MoveNext()
     ' Console.WriteLine("Second Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "Second Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      'Return index in the collection to the beginning.
      oe.Reset()
   End Sub 'Main
End Class 'OidSample
using System;
using System.Security.Cryptography;
public class OidSample
{
    public static void Main()
    {
        // Assign values to strings.
        string Value1 = "1.2.840.113549.1.1.1";
        string Name1 = "3DES";
        string Value2 = "1.3.6.1.4.1.311.20.2";
        string InvalidName = "This name is not a valid name";
        string InvalidValue = "1.1.1.1.1.1.1.1";

        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
        Oid o1 = new Oid(Value1);
        Oid o2 = new Oid(Name1);

        // Create a new Oid object using the specified Value and Friendly
 Name properties.
        // Note that the two are not compared to determine if the Value
 is associated 
        //  with the Friendly Name.
        Oid o3 = new Oid(Value2, InvalidName);

        //Create a new Oid object using the specified Value. Note that
 if the value
        //  is invalid or not known, no value is assigned to the Friendly
 Name property.
        Oid o4 = new Oid(InvalidValue);

        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}", o1.FriendlyName, o1.Value);
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 o2.FriendlyName, o2.Value);
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 o3.FriendlyName, o3.Value);
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName,
 o4.Value, Environment.NewLine);

        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", oc.Count);
        Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine);

        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName,oe.Current.Value);
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
 oe.Current.FriendlyName, oe.Current.Value);
        //Return index in the collection to the beginning.
        oe.Reset();
    }
}
#using <system.dll>

using namespace System;
using namespace System::Security::Cryptography;
int main()
{
   
   // Assign values to strings.
   String^ Value1 = "1.2.840.113549.1.1.1";
   String^ Name1 = "3DES";
   String^ Value2 = "1.3.6.1.4.1.311.20.2";
   String^ InvalidName = "This name is not a valid name";
   String^ InvalidValue = "1.1.1.1.1.1.1.1";
   
   // Create new Oid objects using the specified values.
   // Note that the corresponding Value or Friendly Name property is
 automatically added to the object.
   Oid ^ o1 = gcnew Oid( Value1 );
   Oid ^ o2 = gcnew Oid( Name1 );
   
   // Create a new Oid object using the specified Value and Friendly
 Name properties.
   // Note that the two are not compared to determine if the Value is
 associated 
   //  with the Friendly Name.
   Oid ^ o3 = gcnew Oid( Value2,InvalidName );
   
   //Create a new Oid object using the specified Value. Note that if
 the value
   //  is invalid or not known, no value is assigned to the Friendly
 Name property.
   Oid ^ o4 = gcnew Oid( InvalidValue );
   
   //Write out the property information of the Oid objects.
   Console::WriteLine( "Oid1: Automatically assigned Friendly Name: {0}, {1}",
 o1->FriendlyName, o1->Value );
   Console::WriteLine( "Oid2: Automatically assigned Value: {0}, {1}",
 o2->FriendlyName, o2->Value );
   Console::WriteLine( "Oid3: Name and Value not compared: {0}, {1}", o3->FriendlyName,
 o3->Value );
   Console::WriteLine( "Oid4: Invalid Value used: {0}, {1} {2}", o4->FriendlyName,
 o4->Value, Environment::NewLine );
   
   //Create an Oid collection and add several Oid objects.
   OidCollection ^ oc = gcnew OidCollection;
   oc->Add( o1 );
   oc->Add( o2 );
   oc->Add( o3 );
   Console::WriteLine( "Number of Oids in the collection:
 {0}", oc->Count );
   Console::WriteLine( "Is synchronized: {0} {1}", oc->IsSynchronized,
 Environment::NewLine );
   
   //Create an enumerator for moving through the collection.
   OidEnumerator ^ oe = oc->GetEnumerator();
   
   //You must execute a MoveNext() to get to the first item in the collection.
   oe->MoveNext();
   
   // Write out Oids in the collection.
   Console::WriteLine( "First Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   oe->MoveNext();
   Console::WriteLine( "Second Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   
   //Return index in the collection to the beginning.
   oe->Reset();
}

import System.*;
import System.Security.Cryptography.*;

public class OidSample
{
    public static void main(String
 args[])
    {
        // Assign values to strings.
        String value1 = "1.2.840.113549.1.1.1";
        String name1 = "3DES";
        String value2 = "1.3.6.1.4.1.311.20.2";
        String invalidName = "This name is not a valid name";
        String invalidValue = "1.1.1.1.1.1.1.1";
        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 
        // is automatically added to the object.
        Oid o1 = new Oid(value1);
        Oid o2 = new Oid(name1);
        // Create a new Oid object using the specified Value and Friendly
 
        // Name properties.
        // Note that the two are not compared to determine if the Value
 is 
        // associated with the Friendly Name.
        Oid o3 = new Oid(value2, invalidName);
        // Create a new Oid object using the specified Value. Note that
 if the
        // value is invalid or not known, no value is assigned to the
 Friendly 
        // Name property.
        Oid o4 = new Oid(invalidValue);
        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}",
            o1.get_FriendlyName(), o1.get_Value());
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 
            o2.get_FriendlyName(), o2.get_Value());
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 
            o3.get_FriendlyName(), o3.get_Value());
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", 
            o4.get_FriendlyName(), o4.get_Value(), Environment.get_NewLine());
        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", 
            System.Convert.ToString(oc.get_Count()));
        Console.WriteLine("Is synchronized: {0} {1}", 
            System.Convert.ToString(oc.get_IsSynchronized()), 
            Environment.get_NewLine());
        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the
        //collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 
            oe.get_Current().get_FriendlyName(), 
            oe.get_Current().get_Value());
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
            oe.get_Current().get_FriendlyName(), oe.get_Current().get_Value());
        //Return index in the collection to the beginning.
        oe.Reset();
    } //main
} //OidSample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Oid クラス
Oid メンバ
System.Security.Cryptography 名前空間

Oid コンストラクタ (String, String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

値と表示名指定して、Oid クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    value As String, _
    friendlyName As String _
)
Dim value As String
Dim friendlyName As String

Dim instance As New Oid(value,
 friendlyName)
public Oid (
    string value,
    string friendlyName
)
public:
Oid (
    String^ value, 
    String^ friendlyName
)
public Oid (
    String value, 
    String friendlyName
)
public function Oid (
    value : String, 
    friendlyName : String
)

パラメータ

value

識別子を示すドット区切り数値

friendlyName

識別子表示名

解説解説
使用例使用例

Oid クラス使用するコード例次に示します

Imports System
Imports System.Security.Cryptography


Public Class OidSample
   Shared msg As String
   Public Shared Sub Main()
      ' Assign values to strings.
      Dim Value1 As String
 = "1.2.840.113549.1.1.1"
      Dim Name1 As String
 = "3DES"
      Dim Value2 As String
 = "1.3.6.1.4.1.311.20.2"
      Dim InvalidName As String
 = "This name is not a valid name"
      Dim InvalidValue As String
 = "1.1.1.1.1.1.1.1"
      
      ' Create new Oid objects using the specified values.
      ' Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
      Dim o1 As New Oid(Value1)
      Dim o2 As New Oid(Name1)
      
      ' Create a new Oid object using the specified Value and Friendly
 Name properties.
      ' Note that the two are not compared to determine if the Value
 is associated 
      '  with the Friendly Name.
      Dim o3 As New Oid(Value2,
 InvalidName)
      
      'Create a new Oid object using the specified Value. Note that
 if the value
      '  is invalid or not known, no value is assigned to the Friendly
 Name property.
      Dim o4 As New Oid(InvalidValue)
      
      'Write out the property information of the Oid objects.
    msg = "Oid1: Automatically assigned Friendly Name: "
 & o1.FriendlyName & ", " & o1.Value
    MsgBox(msg)
      'Console.WriteLine("Oid1: Automatically assigned Friendly
 Name: {0}, {1}", o1.FriendlyName, o1.Value)


      'Console.WriteLine("Oid2: Automatically assigned Value: {0},
 {1}", o2.FriendlyName, o2.Value)
    msg = "Oid2: Automatically assigned Value: " &
 o2.FriendlyName & ", " & o2.Value
    MsgBox(msg)


      'Console.WriteLine("Oid3: Name and Value not compared: {0},
 {1}", o3.FriendlyName, o3.Value)
    msg = "Oid3: Name and Value not compared: " &
 o3.FriendlyName & ", " & o3.Value
    MsgBox(msg)



     ' Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}",
 o4.FriendlyName, o4.Value, Environment.NewLine)
    msg = "Oid4: Invalid Value used: " & o4.FriendlyName
 & ", " & o4.Value
    MsgBox(msg)
 

     
      'Create an Oid collection and add several Oid objects.
      Dim oc As New OidCollection()
      oc.Add(o1)
      oc.Add(o2)
      oc.Add(o3)
     ' Console.WriteLine("Number of Oids in the collection: {0}",
 oc.Count)
      ' Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine)

    msg = "Number of Oids in the collection: " &
 oc.Count
    MsgBox(msg)
    msg = "Is synchronized: " & oc.IsSynchronized
    MsgBox(msg)

      
      'Create an enumerator for moving through the collection.
      Dim oe As OidEnumerator = oc.GetEnumerator()
      'You must execute a MoveNext() to get to the first item in the
 collection.
      oe.MoveNext()
      ' Write out Oids in the collection.
      'Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "First Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      oe.MoveNext()
     ' Console.WriteLine("Second Oid in collection: {0},{1}",
 oe.Current.FriendlyName, oe.Current.Value)
    msg = "Second Oid in collection: " & oe.Current.FriendlyName
 & ", " & oe.Current.Value
    MsgBox(msg)

      'Return index in the collection to the beginning.
      oe.Reset()
   End Sub 'Main
End Class 'OidSample
using System;
using System.Security.Cryptography;
public class OidSample
{
    public static void Main()
    {
        // Assign values to strings.
        string Value1 = "1.2.840.113549.1.1.1";
        string Name1 = "3DES";
        string Value2 = "1.3.6.1.4.1.311.20.2";
        string InvalidName = "This name is not a valid name";
        string InvalidValue = "1.1.1.1.1.1.1.1";

        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 is automatically added to the object.
        Oid o1 = new Oid(Value1);
        Oid o2 = new Oid(Name1);

        // Create a new Oid object using the specified Value and Friendly
 Name properties.
        // Note that the two are not compared to determine if the Value
 is associated 
        //  with the Friendly Name.
        Oid o3 = new Oid(Value2, InvalidName);

        //Create a new Oid object using the specified Value. Note that
 if the value
        //  is invalid or not known, no value is assigned to the Friendly
 Name property.
        Oid o4 = new Oid(InvalidValue);

        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}", o1.FriendlyName, o1.Value);
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 o2.FriendlyName, o2.Value);
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 o3.FriendlyName, o3.Value);
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName,
 o4.Value, Environment.NewLine);

        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", oc.Count);
        Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized,
 Environment.NewLine);

        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 oe.Current.FriendlyName,oe.Current.Value);
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
 oe.Current.FriendlyName, oe.Current.Value);
        //Return index in the collection to the beginning.
        oe.Reset();
    }
}
#using <system.dll>

using namespace System;
using namespace System::Security::Cryptography;
int main()
{
   
   // Assign values to strings.
   String^ Value1 = "1.2.840.113549.1.1.1";
   String^ Name1 = "3DES";
   String^ Value2 = "1.3.6.1.4.1.311.20.2";
   String^ InvalidName = "This name is not a valid name";
   String^ InvalidValue = "1.1.1.1.1.1.1.1";
   
   // Create new Oid objects using the specified values.
   // Note that the corresponding Value or Friendly Name property is
 automatically added to the object.
   Oid ^ o1 = gcnew Oid( Value1 );
   Oid ^ o2 = gcnew Oid( Name1 );
   
   // Create a new Oid object using the specified Value and Friendly
 Name properties.
   // Note that the two are not compared to determine if the Value is
 associated 
   //  with the Friendly Name.
   Oid ^ o3 = gcnew Oid( Value2,InvalidName );
   
   //Create a new Oid object using the specified Value. Note that if
 the value
   //  is invalid or not known, no value is assigned to the Friendly
 Name property.
   Oid ^ o4 = gcnew Oid( InvalidValue );
   
   //Write out the property information of the Oid objects.
   Console::WriteLine( "Oid1: Automatically assigned Friendly Name: {0}, {1}",
 o1->FriendlyName, o1->Value );
   Console::WriteLine( "Oid2: Automatically assigned Value: {0}, {1}",
 o2->FriendlyName, o2->Value );
   Console::WriteLine( "Oid3: Name and Value not compared: {0}, {1}", o3->FriendlyName,
 o3->Value );
   Console::WriteLine( "Oid4: Invalid Value used: {0}, {1} {2}", o4->FriendlyName,
 o4->Value, Environment::NewLine );
   
   //Create an Oid collection and add several Oid objects.
   OidCollection ^ oc = gcnew OidCollection;
   oc->Add( o1 );
   oc->Add( o2 );
   oc->Add( o3 );
   Console::WriteLine( "Number of Oids in the collection:
 {0}", oc->Count );
   Console::WriteLine( "Is synchronized: {0} {1}", oc->IsSynchronized,
 Environment::NewLine );
   
   //Create an enumerator for moving through the collection.
   OidEnumerator ^ oe = oc->GetEnumerator();
   
   //You must execute a MoveNext() to get to the first item in the collection.
   oe->MoveNext();
   
   // Write out Oids in the collection.
   Console::WriteLine( "First Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   oe->MoveNext();
   Console::WriteLine( "Second Oid in collection: {0},{1}",
 oe->Current->FriendlyName, oe->Current->Value );
   
   //Return index in the collection to the beginning.
   oe->Reset();
}

import System.*;
import System.Security.Cryptography.*;

public class OidSample
{
    public static void main(String
 args[])
    {
        // Assign values to strings.
        String value1 = "1.2.840.113549.1.1.1";
        String name1 = "3DES";
        String value2 = "1.3.6.1.4.1.311.20.2";
        String invalidName = "This name is not a valid name";
        String invalidValue = "1.1.1.1.1.1.1.1";
        // Create new Oid objects using the specified values.
        // Note that the corresponding Value or Friendly Name property
 
        // is automatically added to the object.
        Oid o1 = new Oid(value1);
        Oid o2 = new Oid(name1);
        // Create a new Oid object using the specified Value and Friendly
 
        // Name properties.
        // Note that the two are not compared to determine if the Value
 is 
        // associated with the Friendly Name.
        Oid o3 = new Oid(value2, invalidName);
        // Create a new Oid object using the specified Value. Note that
 if the
        // value is invalid or not known, no value is assigned to the
 Friendly 
        // Name property.
        Oid o4 = new Oid(invalidValue);
        //Write out the property information of the Oid objects.
        Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0},
 {1}",
            o1.get_FriendlyName(), o1.get_Value());
        Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}",
 
            o2.get_FriendlyName(), o2.get_Value());
        Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}",
 
            o3.get_FriendlyName(), o3.get_Value());
        Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", 
            o4.get_FriendlyName(), o4.get_Value(), Environment.get_NewLine());
        //Create an Oid collection and add several Oid objects.
        OidCollection oc = new OidCollection();
        oc.Add(o1);
        oc.Add(o2);
        oc.Add(o3);
        Console.WriteLine("Number of Oids in the collection:
 {0}", 
            System.Convert.ToString(oc.get_Count()));
        Console.WriteLine("Is synchronized: {0} {1}", 
            System.Convert.ToString(oc.get_IsSynchronized()), 
            Environment.get_NewLine());
        //Create an enumerator for moving through the collection.
        OidEnumerator oe = oc.GetEnumerator();
        //You must execute a MoveNext() to get to the first item in
 the
        //collection.
        oe.MoveNext();
        // Write out Oids in the collection.
        Console.WriteLine("First Oid in collection: {0},{1}",
 
            oe.get_Current().get_FriendlyName(), 
            oe.get_Current().get_Value());
        oe.MoveNext();
        Console.WriteLine("Second Oid in collection: {0}
,{1}",
            oe.get_Current().get_FriendlyName(), oe.get_Current().get_Value());
        //Return index in the collection to the beginning.
        oe.Reset();
    } //main
} //OidSample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Oid クラス
Oid メンバ
System.Security.Cryptography 名前空間

Oid コンストラクタ


Oid プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ FriendlyName 識別子表示名取得または設定します
パブリック プロパティ Value 識別子を示すドット区切り数値取得または設定します
参照参照

関連項目

Oid クラス
System.Security.Cryptography 名前空間

Oid メソッド


Oid メンバ

暗号オブジェクト識別子表します。このクラス継承できません。

Oid データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ FriendlyName 識別子表示名取得または設定します
パブリック プロパティ Value 識別子を示すドット区切り数値取得または設定します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

Oid クラス
System.Security.Cryptography 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からOIDを検索した結果を表示しています。
Weblioに収録されているすべての辞書からOIDを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からOIDを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「OID」の関連用語

OIDのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



OIDのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS