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

DataObject クラス

署名されているデータ保持するXML 署名オブジェクト要素表します

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

public class DataObject
public ref class DataObject
public class DataObject
public class DataObject
解説解説
使用例使用例

エンベロープXML 署名生成する方法次のコード例示します

Imports System
Imports System.IO
Imports System.Security.Cryptography
Imports System.Security.Cryptography.Xml
Imports System.Xml

 _


Public Class XMLdsigsample1

   Shared Sub Main(args() As
 [String])
      ' Create example data to sign.
      Dim document As New
 XmlDocument()
      Dim node As XmlNode = document.CreateNode(XmlNodeType.Element,
 "", "MyElement",
 "samples")
      node.InnerText = "This is some text"
      document.AppendChild(node)
      Console.Error.WriteLine("Data to sign:")
      Console.Error.WriteLine()
      Console.Error.WriteLine(document.OuterXml)
      Console.Error.WriteLine()
      
      ' Create the SignedXml message.
      Dim signedXml As New
 SignedXml()
      Dim key As RSA = RSA.Create()
      signedXml.SigningKey = key
      
      ' Create a data object to hold the data to sign.
      Dim dataObject As New
 DataObject()
      dataObject.Data = document.ChildNodes
      dataObject.Id = "MyObjectId"
      
      ' Add the data object to the signature.
      signedXml.AddObject(dataObject)
      
      ' Create a reference to be able to package everything into the
      ' message.
      Dim reference As New
 Reference()
      reference.Uri = "#MyObjectId"
      
      ' Add it to the message.
      signedXml.AddReference(reference)
      
      ' Add a KeyInfo.
      Dim keyInfo As New
 KeyInfo()
      keyInfo.AddClause(New RSAKeyValue(key))
      signedXml.KeyInfo = keyInfo
      
      ' Compute the signature.
      signedXml.ComputeSignature()
      
      ' Get the XML representation of the signature.
      Dim xmlSignature As XmlElement = signedXml.GetXml()
      Console.WriteLine(xmlSignature.OuterXml)
   End Sub 'Main
End Class 'XMLdsigsample1 
using System;
using System.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.Xml;


public class XMLdsigsample1 {

static void Main(String[] args)
{
     // Create example data to sign.
     XmlDocument document = new XmlDocument();
     XmlNode  node = document.CreateNode(XmlNodeType.Element, "", "MyElement",
 "samples");
     node.InnerText = "This is some text";
     document.AppendChild(node);
     Console.Error.WriteLine("Data to sign:\n" + document.OuterXml + "\n");
 
     // Create the SignedXml message.
     SignedXml signedXml = new SignedXml();
     RSA key = RSA.Create();
     signedXml.SigningKey = key;
 
     // Create a data object to hold the data to sign.
     DataObject dataObject = new DataObject();
     dataObject.Data = document.ChildNodes;
     dataObject.Id = "MyObjectId";

     // Add the data object to the signature.
     signedXml.AddObject(dataObject);
 
     // Create a reference to be able to package everything into the
     // message.
     Reference reference = new Reference();
     reference.Uri = "#MyObjectId";
 
     // Add it to the message.
     signedXml.AddReference(reference);

     // Add a KeyInfo.
     KeyInfo keyInfo = new KeyInfo();
     keyInfo.AddClause(new RSAKeyValue(key));
     signedXml.KeyInfo = keyInfo;

     // Compute the signature.
     signedXml.ComputeSignature();

     // Get the XML representation of the signature.
     XmlElement xmlSignature = signedXml.GetXml();
     Console.WriteLine(xmlSignature.OuterXml);
}

}
#using <System.dll>
#using <System.Xml.dll>
#using <System.Security.dll>

using namespace System;
using namespace System::IO;
using namespace System::Security::Cryptography;
using namespace System::Security::Cryptography::Xml;
using namespace System::Xml;
int main()
{
   
   // Create example data to sign.
   XmlDocument^ document = gcnew XmlDocument;
   XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement",
 "samples" );
   node->InnerText = "This is some text";
   document->AppendChild( node );
   Console::Error->WriteLine( "Data to sign:\n{0}\n", document->OuterXml
 );
   
   // Create the SignedXml message.
   SignedXml^ signedXml = gcnew SignedXml;
   RSA^ key = RSA::Create();
   signedXml->SigningKey = key;
   
   // Create a data object to hold the data to sign.
   DataObject^ dataObject = gcnew DataObject;
   dataObject->Data = document->ChildNodes;
   dataObject->Id = "MyObjectId";
   
   // Add the data object to the signature.
   signedXml->AddObject( dataObject );
   
   // Create a reference to be able to package everything into the
   // message.
   Reference^ reference = gcnew Reference;
   reference->Uri = "#MyObjectId";
   
   // Add it to the message.
   signedXml->AddReference( reference );
   
   // Add a KeyInfo.
   KeyInfo^ keyInfo = gcnew KeyInfo;
   keyInfo->AddClause( gcnew RSAKeyValue( key ) );
   signedXml->KeyInfo = keyInfo;
   
   // Compute the signature.
   signedXml->ComputeSignature();
   
   // Get the XML representation of the signature.
   XmlElement^ xmlSignature = signedXml->GetXml();
   Console::WriteLine( xmlSignature->OuterXml );
}

import System.*;
import System.IO.*;
import System.Security.Cryptography.*;
import System.Security.Cryptography.Xml.*;
import System.Xml.*;

public class XmlDsigSample1
{
    public static void main(String[]
 args)
    {
        // Create example data to sign.
        XmlDocument document = new XmlDocument();
        XmlNode node = document.CreateNode(XmlNodeType.Element, "",
            "MyElement", "samples");
        node.set_InnerText("This is some text");
        document.AppendChild(node);
        Console.get_Error().WriteLine("Data to sign:\n" +
            document.get_OuterXml() + "\n");
        // Create the SignedXml message.
        SignedXml signedXml = new SignedXml();
        RSA key = RSA.Create();
        signedXml.set_SigningKey(key);
        // Create a data object to hold the data to sign.
        DataObject dataObject = new DataObject();
        dataObject.set_Data(document.get_ChildNodes());
        dataObject.set_Id("MyObjectId");
        // Add the data object to the signature.
        signedXml.AddObject(dataObject);
        // Create a reference to be able to
        Reference reference = new Reference();
        reference.set_Uri("#MyObjectId");
        // Add it to the message.
        signedXml.AddReference(reference);
        // Add a KeyInfo.
        KeyInfo keyInfo = new KeyInfo();
        keyInfo.AddClause(new RSAKeyValue(key));
        signedXml.set_KeyInfo(keyInfo);
        // Compute the signature.
        signedXml.ComputeSignature();
        // Get the XML representation of the signature.
        XmlElement xmlSignature = signedXml.GetXml();
        Console.WriteLine(xmlSignature.get_OuterXml());
    } //main
} //XmlDsigSample1 

XML 署名確認する方法次のコード例示します

Imports System
Imports System.Security.Cryptography
Imports System.Security.Cryptography.Xml
Imports System.IO
Imports System.Xml

 _

Public Class Verify
   
   Public Shared Sub Main(args()
 As [String])
      
      Console.WriteLine(("Verifying " + args(0) +
 "..."))
      
      ' Create a SignedXml.
      Dim signedXml As New
 SignedXml()
      
      ' Load the XML.
      Dim xmlDocument As New
 XmlDocument()
      xmlDocument.PreserveWhitespace = True
      xmlDocument.Load(New XmlTextReader(args(0)))
      
      Dim nodeList As XmlNodeList = xmlDocument.GetElementsByTagName("Signature")
      signedXml.LoadXml(CType(nodeList(0), XmlElement))
      
      If signedXml.CheckSignature() Then
         Console.WriteLine("Signature check OK")
      Else
         Console.WriteLine("Signature check FAILED")
      End If
   End Sub 'Main 
End Class 'Verify
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.IO;
using System.Xml;

public class Verify {

    public static void Main(String[]
 args) 
    {

        Console.WriteLine("Verifying " + args[0] + "...");

        // Create a SignedXml.
        SignedXml signedXml = new SignedXml();

        // Load the XML.
        XmlDocument xmlDocument = new XmlDocument();
        xmlDocument.PreserveWhitespace = true;
        xmlDocument.Load(new XmlTextReader(args[0]));

        XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");
        signedXml.LoadXml((XmlElement)nodeList[0]);

        if (signedXml.CheckSignature()) {
            Console.WriteLine("Signature check OK");
        } else {
            Console.WriteLine("Signature check FAILED");
        }

    }
}
#using <System.dll>
#using <System.Security.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Cryptography::Xml;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   array<String^>^args = System::Environment::GetCommandLineArgs();
   Console::WriteLine( "Verifying {0}...", args[ 1 ] );

   // Create a SignedXml.
   SignedXml^ signedXml = gcnew SignedXml;

   // Load the XML.
   XmlDocument^ xmlDocument = gcnew XmlDocument;
   xmlDocument->PreserveWhitespace = true;
   xmlDocument->Load( gcnew XmlTextReader( args[ 1 ] ) );
   XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature"
 );
   signedXml->LoadXml( safe_cast<XmlElement^>(nodeList[ 0 ]) );
   if ( signedXml->CheckSignature() )
   {
      Console::WriteLine( "Signature check OK" );
   }
   else
   {
      Console::WriteLine( "Signature check FAILED" );
   }
}
継承階層継承階層
System.Object
  System.Security.Cryptography.Xml.DataObject
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataObject メンバ
System.Security.Cryptography.Xml 名前空間

DataObject クラス

基本データ転送機構実装ます。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<ClassInterfaceAttribute(ClassInterfaceType.None)> _
Public Class DataObject
    Implements IDataObject, IDataObject
[ClassInterfaceAttribute(ClassInterfaceType.None)] 
public class DataObject : IDataObject, IDataObject
[ClassInterfaceAttribute(ClassInterfaceType::None)] 
public ref class DataObject : IDataObject,
 IDataObject
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.None) */ 
public class DataObject implements IDataObject,
 IDataObject
ClassInterfaceAttribute(ClassInterfaceType.None) 
public class DataObject implements IDataObject,
 IDataObject
解説解説

DataObject は IDataObject インターフェイス実装し、そのメソッド形式依存しないデータ転送のための機構提供します

DataObject は、通常 Clipboard と共に使用されたり、ドラッグ アンド ドロップ操作使用されりしますDataObject クラスは、IDataObject インターフェイス推奨される実装提供します独自に IDataObject実装するのではなくDataObject クラス使用することをお勧めます。

異なった形式複数データDataObject格納できますデータは、そのデータ関連付けられている形式によって、DataObject から取得されます。データ取り出す側のアプリケーション形式不明なので、DataObjectデータ複数形式にしておくと、アプリケーションデータ適切な形式になる可能性高くなります。定義済み形式については、DataFormats のトピック参照してください。DataFormats.Format クラスインスタンス作成することにより、独自の形式実装できます

DataObjectデータ格納するには、データコンストラクタに渡すか、SetData を呼び出します。同じ DataObject複数形式データ追加できます追加するデータネイティブ形式だけで取得されるようにする場合は、autoConvertパラメータfalse設定して SetData(String,Boolean,Object) を呼び出します。

データは GetData と互換性のある任意の形式DataObject から取得できます。たとえば、テキストUnicode変換できますデータ格納されている形式データ取得するには、autoConvert パラメータfalse設定して GetData呼び出します。

データがどの形式格納されているかを判断するには、GetFormats を呼び出します。形式使用できるかどうか判断するには、目的形式で GetDataPresent を呼び出します。

Microsoft .NET Framework version 2.0 では、DataObject クラスに、共通の形式データ簡単に処理できるようにする追加メソッド用意されています。特定の形式データDataObject追加するには、SetText などの適切な SetFormat メソッド呼び出します。DataObject から特定の形式データ取得するには、まず適切な ContainsFormat メソッド (ContainsText など) を呼び出して DataObject にその形式データ含まれているかどうか確認しますDataObject にそのデータ含まれている場合は、次に適切な GetFormat メソッド (GetText など) を呼び出してデータ取得します

メモメモ

クリップボードメタファイル形式使用する場合には、特別な配慮必要な場合ありますDataObject クラス現在の実装における制限により、.NET Framework使用されるメタファイル形式は、旧メタファイル形式使用するアプリケーションでは認識されない場合あります。この場合は、Win32 クリップボード アプリケーション プログラミング インターフェイス (API: Application Programming Interface) で相互運用する必要があります詳細については、http://support.microsoft.com にある Microsoft サポート技術情報文書 323530 (「Metafiles on Clipboard Are Not Visible to All Applications」) を参照してください

クリップボード格納するには、オブジェクトシリアル化可能である必要がありますシリアル化詳細については、「シリアル化」を参照してください対象アプリケーションが、非常に限定されデータ形式を必要とする場合は、シリアル化プロセスデータヘッダー追加すると、アプリケーションデータ認識できない場合ありますデータ形式維持するには、データByte 配列として MemoryStream に追加し、その MemoryStream を SetData メソッド渡します

使用例使用例

DataObjectデータ追加するコード例次に示します。まず、新しDataObject作成されて、その中にコンポーネント格納されます。次にDataObject適切な種類データ存在するかどうか調べます結果テキスト ボックス表示されます。このコードでは、textBox1作成されていることが必要です。

Private Sub AddMyData3()
    ' Creates a component to store in the data object.
    Dim myComponent As New
 Component()
    
    ' Creates a new data object.
    Dim myDataObject As New
 DataObject()
    
    ' Adds the component to the DataObject.
    myDataObject.SetData(myComponent)
    
    ' Prints whether data of the specified type is in the DataObject.
    Dim myType As Type = myComponent.GetType()
    If myDataObject.GetDataPresent(myType) Then
        textBox1.Text = "Data of type " & myType.ToString()
 & _
            " is present in the DataObject"
    Else
        textBox1.Text = "Data of type " & myType.ToString()
 & _
            " is not present in the DataObject"
    End If
End Sub 'AddMyData3

private void AddMyData3() {
    // Creates a component to store in the data object.
    Component myComponent = new Component();
 
    // Creates a new data object.
    DataObject myDataObject = new DataObject();
 
    // Adds the component to the DataObject.
    myDataObject.SetData(myComponent);
 
    // Prints whether data of the specified type is in the DataObject.
    Type myType = myComponent.GetType();
    if(myDataObject.GetDataPresent(myType))
       textBox1.Text = "Data of type " + myType.ToString() + 
       " is present in the DataObject";
    else
       textBox1.Text = "Data of type " + myType.ToString() +
       " is not present in the DataObject";
 }
private:
   void AddMyData3()
   {
      // Creates a component to store in the data object.
      Component^ myComponent = gcnew Component;
      
      // Creates a new data object.
      DataObject^ myDataObject = gcnew DataObject;
      
      // Adds the component to the DataObject.
      myDataObject->SetData( myComponent );
      
      // Prints whether data of the specified type is in the DataObject.
      Type^ myType = myComponent->GetType();
      if ( myDataObject->GetDataPresent( myType ) )
      {
         textBox1->Text = String::Concat( "Data of type ", myType,
            " is present in the DataObject" );
      }
      else
      {
         textBox1->Text = String::Concat( "Data of type ", myType,
            " is not present in the DataObject" );
      }
   }
private void AddMyData3()
{
    // Creates a component to store in the data object.
    Component myComponent = new Component();

    // Creates a new data object.
    DataObject myDataObject = new DataObject();

    // Adds the component to the DataObject.
    myDataObject.SetData(myComponent);

    // Prints whether data of the specified type is in the DataObject.
    Type myType = myComponent.GetType();

    if (myDataObject.GetDataPresent(myType)) {
        textBox1.set_Text("Data of type " + myType.ToString() 
            + " is present in the DataObject");
    }
    else {
        textBox1.set_Text("Data of type " + myType.ToString() 
            + " is not present in the DataObject");
    }
} //AddMyData3

DataObject格納されているデータ取得する例を次に示します。まず、テキスト データを含む新しDataObject作成されます。次に、そのデータ取得され形式文字列指定されテキスト ボックス表示されます。データ形式自動的にテキストから文字列変換されます。このコードでは、textBox1作成されていることが必要です。

Private Sub GetMyData2()
    ' Creates a new data object using a string and the text format.
    Dim myDataObject As New
 DataObject(DataFormats.Text, "Text to Store")
    
    ' Prints the string in a text box.
    textBox1.Text = myDataObject.GetData("System.String").ToString()
End Sub 'GetMyData2
private void GetMyData2() {
    // Creates a new data object using a string and the text format.
    DataObject myDataObject = new DataObject(DataFormats.Text,
 "Text to Store");
 
    // Prints the string in a text box.
    textBox1.Text = myDataObject.GetData("System.String").ToString();
 }
void GetMyData2()
{
   // Creates a new data object using a string and the text format.
   DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Text to Store"
 );
   
   // Prints the string in a text box.
   textBox1->Text = myDataObject->GetData( "System.String" )->ToString();
}
private void GetMyData2()
{
    // Creates a new data object using a string and the text format.
    DataObject myDataObject = new DataObject(DataFormats.Text,
 
        "Text to Store");

    // Prints the string in a text box.
    textBox1.set_Text(myDataObject.GetData("System.String").ToString());
} //GetMyData2
継承階層継承階層
System.Object
  System.Windows.Forms.DataObject
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataObject コンストラクタ ()

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

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

public DataObject ()
public:
DataObject ()
public DataObject ()
解説解説
使用例使用例

エンベロープXML 署名生成する方法次のコード例示します

Imports System
Imports System.IO
Imports System.Security.Cryptography
Imports System.Security.Cryptography.Xml
Imports System.Xml

 _


Public Class XMLdsigsample1

   Shared Sub Main(args() As
 [String])
      ' Create example data to sign.
      Dim document As New
 XmlDocument()
      Dim node As XmlNode = document.CreateNode(XmlNodeType.Element,
 "", "MyElement",
 "samples")
      node.InnerText = "This is some text"
      document.AppendChild(node)
      Console.Error.WriteLine("Data to sign:")
      Console.Error.WriteLine()
      Console.Error.WriteLine(document.OuterXml)
      Console.Error.WriteLine()
      
      ' Create the SignedXml message.
      Dim signedXml As New
 SignedXml()
      Dim key As RSA = RSA.Create()
      signedXml.SigningKey = key
      
      ' Create a data object to hold the data to sign.
      Dim dataObject As New
 DataObject()
      dataObject.Data = document.ChildNodes
      dataObject.Id = "MyObjectId"
      
      ' Add the data object to the signature.
      signedXml.AddObject(dataObject)
      
      ' Create a reference to be able to package everything into the
      ' message.
      Dim reference As New
 Reference()
      reference.Uri = "#MyObjectId"
      
      ' Add it to the message.
      signedXml.AddReference(reference)
      
      ' Add a KeyInfo.
      Dim keyInfo As New
 KeyInfo()
      keyInfo.AddClause(New RSAKeyValue(key))
      signedXml.KeyInfo = keyInfo
      
      ' Compute the signature.
      signedXml.ComputeSignature()
      
      ' Get the XML representation of the signature.
      Dim xmlSignature As XmlElement = signedXml.GetXml()
      Console.WriteLine(xmlSignature.OuterXml)
   End Sub 'Main
End Class 'XMLdsigsample1 
using System;
using System.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.Xml;


public class XMLdsigsample1 {

static void Main(String[] args)
{
     // Create example data to sign.
     XmlDocument document = new XmlDocument();
     XmlNode  node = document.CreateNode(XmlNodeType.Element, "", "MyElement",
 "samples");
     node.InnerText = "This is some text";
     document.AppendChild(node);
     Console.Error.WriteLine("Data to sign:\n" + document.OuterXml + "\n");
 
     // Create the SignedXml message.
     SignedXml signedXml = new SignedXml();
     RSA key = RSA.Create();
     signedXml.SigningKey = key;
 
     // Create a data object to hold the data to sign.
     DataObject dataObject = new DataObject();
     dataObject.Data = document.ChildNodes;
     dataObject.Id = "MyObjectId";

     // Add the data object to the signature.
     signedXml.AddObject(dataObject);
 
     // Create a reference to be able to package everything into the
     // message.
     Reference reference = new Reference();
     reference.Uri = "#MyObjectId";
 
     // Add it to the message.
     signedXml.AddReference(reference);

     // Add a KeyInfo.
     KeyInfo keyInfo = new KeyInfo();
     keyInfo.AddClause(new RSAKeyValue(key));
     signedXml.KeyInfo = keyInfo;

     // Compute the signature.
     signedXml.ComputeSignature();

     // Get the XML representation of the signature.
     XmlElement xmlSignature = signedXml.GetXml();
     Console.WriteLine(xmlSignature.OuterXml);
}

}
#using <System.dll>
#using <System.Xml.dll>
#using <System.Security.dll>

using namespace System;
using namespace System::IO;
using namespace System::Security::Cryptography;
using namespace System::Security::Cryptography::Xml;
using namespace System::Xml;
int main()
{
   
   // Create example data to sign.
   XmlDocument^ document = gcnew XmlDocument;
   XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement",
 "samples" );
   node->InnerText = "This is some text";
   document->AppendChild( node );
   Console::Error->WriteLine( "Data to sign:\n{0}\n", document->OuterXml
 );
   
   // Create the SignedXml message.
   SignedXml^ signedXml = gcnew SignedXml;
   RSA^ key = RSA::Create();
   signedXml->SigningKey = key;
   
   // Create a data object to hold the data to sign.
   DataObject^ dataObject = gcnew DataObject;
   dataObject->Data = document->ChildNodes;
   dataObject->Id = "MyObjectId";
   
   // Add the data object to the signature.
   signedXml->AddObject( dataObject );
   
   // Create a reference to be able to package everything into the
   // message.
   Reference^ reference = gcnew Reference;
   reference->Uri = "#MyObjectId";
   
   // Add it to the message.
   signedXml->AddReference( reference );
   
   // Add a KeyInfo.
   KeyInfo^ keyInfo = gcnew KeyInfo;
   keyInfo->AddClause( gcnew RSAKeyValue( key ) );
   signedXml->KeyInfo = keyInfo;
   
   // Compute the signature.
   signedXml->ComputeSignature();
   
   // Get the XML representation of the signature.
   XmlElement^ xmlSignature = signedXml->GetXml();
   Console::WriteLine( xmlSignature->OuterXml );
}

import System.*;
import System.IO.*;
import System.Security.Cryptography.*;
import System.Security.Cryptography.Xml.*;
import System.Xml.*;

public class XmlDsigSample1
{
    public static void main(String[]
 args)
    {
        // Create example data to sign.
        XmlDocument document = new XmlDocument();
        XmlNode node = document.CreateNode(XmlNodeType.Element, "",
            "MyElement", "samples");
        node.set_InnerText("This is some text");
        document.AppendChild(node);
        Console.get_Error().WriteLine("Data to sign:\n" +
            document.get_OuterXml() + "\n");
        // Create the SignedXml message.
        SignedXml signedXml = new SignedXml();
        RSA key = RSA.Create();
        signedXml.set_SigningKey(key);
        // Create a data object to hold the data to sign.
        DataObject dataObject = new DataObject();
        dataObject.set_Data(document.get_ChildNodes());
        dataObject.set_Id("MyObjectId");
        // Add the data object to the signature.
        signedXml.AddObject(dataObject);
        // Create a reference to be able to
        Reference reference = new Reference();
        reference.set_Uri("#MyObjectId");
        // Add it to the message.
        signedXml.AddReference(reference);
        // Add a KeyInfo.
        KeyInfo keyInfo = new KeyInfo();
        keyInfo.AddClause(new RSAKeyValue(key));
        signedXml.set_KeyInfo(keyInfo);
        // Compute the signature.
        signedXml.ComputeSignature();
        // Get the XML representation of the signature.
        XmlElement xmlSignature = signedXml.GetXml();
        Console.WriteLine(xmlSignature.get_OuterXml());
    } //main
} //XmlDsigSample1 

XML 署名確認する方法次のコード例示します

Imports System
Imports System.Security.Cryptography
Imports System.Security.Cryptography.Xml
Imports System.IO
Imports System.Xml

 _

Public Class Verify
   
   Public Shared Sub Main(args()
 As [String])
      
      Console.WriteLine(("Verifying " + args(0) +
 "..."))
      
      ' Create a SignedXml.
      Dim signedXml As New
 SignedXml()
      
      ' Load the XML.
      Dim xmlDocument As New
 XmlDocument()
      xmlDocument.PreserveWhitespace = True
      xmlDocument.Load(New XmlTextReader(args(0)))
      
      Dim nodeList As XmlNodeList = xmlDocument.GetElementsByTagName("Signature")
      signedXml.LoadXml(CType(nodeList(0), XmlElement))
      
      If signedXml.CheckSignature() Then
         Console.WriteLine("Signature check OK")
      Else
         Console.WriteLine("Signature check FAILED")
      End If
   End Sub 'Main 
End Class 'Verify
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.IO;
using System.Xml;

public class Verify {

    public static void Main(String[]
 args) 
    {

        Console.WriteLine("Verifying " + args[0] + "...");

        // Create a SignedXml.
        SignedXml signedXml = new SignedXml();

        // Load the XML.
        XmlDocument xmlDocument = new XmlDocument();
        xmlDocument.PreserveWhitespace = true;
        xmlDocument.Load(new XmlTextReader(args[0]));

        XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");
        signedXml.LoadXml((XmlElement)nodeList[0]);

        if (signedXml.CheckSignature()) {
            Console.WriteLine("Signature check OK");
        } else {
            Console.WriteLine("Signature check FAILED");
        }

    }
}
#using <System.dll>
#using <System.Security.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Cryptography::Xml;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   array<String^>^args = System::Environment::GetCommandLineArgs();
   Console::WriteLine( "Verifying {0}...", args[ 1 ] );

   // Create a SignedXml.
   SignedXml^ signedXml = gcnew SignedXml;

   // Load the XML.
   XmlDocument^ xmlDocument = gcnew XmlDocument;
   xmlDocument->PreserveWhitespace = true;
   xmlDocument->Load( gcnew XmlTextReader( args[ 1 ] ) );
   XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature"
 );
   signedXml->LoadXml( safe_cast<XmlElement^>(nodeList[ 0 ]) );
   if ( signedXml->CheckSignature() )
   {
      Console::WriteLine( "Signature check OK" );
   }
   else
   {
      Console::WriteLine( "Signature check FAILED" );
   }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataObject クラス
DataObject メンバ
System.Security.Cryptography.Xml 名前空間

DataObject コンストラクタ ()

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

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

public DataObject ()
public:
DataObject ()
public DataObject ()
使用例使用例

DataObject作成しデータ追加するコード例次に示します。この例では、次にデータ取得して表示します。このコードでは、textBox1作成されていることが必要です。

Private Sub CreateDefaultDataObject()
    ' Creates a data object.
    Dim myDataObject As DataObject
    
    ' Assigns the string to the data object.
    Dim myString As String
 = "My text string"
    myDataObject = New DataObject(myString)
    
    ' Prints the string in a text box.
    textBox1.Text = myDataObject.GetData(DataFormats.Text).ToString()
End Sub 'CreateDefaultDataObject
private void CreateDefaultDataObject() {
    // Creates a data object.
    DataObject myDataObject;
 
    // Assigns the string to the data object.
    string myString = "My text string";
    myDataObject = new DataObject(myString);
 
    // Prints the string in a text box.
    textBox1.Text = myDataObject.GetData(DataFormats.Text).ToString();
 }
 
private:
   void CreateDefaultDataObject()
   {
      // Creates a data object.
      DataObject^ myDataObject;
      
      // Assigns the string to the data object.
      String^ myString = "My text string";
      myDataObject = gcnew DataObject( myString );
      
      // Prints the string in a text box.
      textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString();
   }
private void CreateDefaultDataObject()
{
    // Creates a data object.
    DataObject myDataObject;

    // Assigns the string to the data object.
    String myString = "My text string";
    myDataObject = new DataObject(myString);

    // Prints the string in a text box.
    textBox1.set_Text(myDataObject.GetData(DataFormats.Text).ToString());
} //CreateDefaultDataObject
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataObject クラス
DataObject メンバ
System.Windows.Forms 名前空間
GetData
SetData
GetDataPresent

DataObject コンストラクタ (String, Object)

DataObject クラス新しインスタンス初期化し指定したオブジェクト指定した形式追加します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

使用例使用例

文字列型として指定され文字列使用して DataObject クラス作成するコード例次に示しますデータは、データ形式テキスト指定すると、DataObject から取得されます。結果テキスト ボックス表示されます。このコードでは、textBox1作成されていることが必要です。

Private Sub CreateTextDataObject2()
    ' Creates a new data object using a string.
    Dim myString As String
 = "My next text string"
    Dim myDataObject As New
 DataObject("System.String", myString)
    
    ' Prints the string in a text box.
    textBox1.Text = myDataObject.GetData(DataFormats.Text).ToString()
End Sub 'CreateTextDataObject2
private void CreateTextDataObject2() {
    // Creates a new data object using a string.
    string myString = "My next text string";
    DataObject myDataObject = new DataObject("System.String",
 myString);
 
    // Prints the string in a text box.
    textBox1.Text = myDataObject.GetData(DataFormats.Text).ToString();
 }
 
private:
   void CreateTextDataObject2()
   {
      // Creates a new data object using a string.
      String^ myString = "My next text string";
      DataObject^ myDataObject = gcnew DataObject( "System.String",myString
 );
      
      // Prints the string in a text box.
      textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString();
   }
private void CreateTextDataObject2()
{
    // Creates a new data object using a string.
    String myString = "My next text string";
    DataObject myDataObject = new DataObject("String",
 myString);

    // Prints the string in a text box.
    textBox1.set_Text(myDataObject.GetData(DataFormats.Text).ToString());
} //CreateTextDataObject2
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataObject クラス
DataObject メンバ
System.Windows.Forms 名前空間
GetData
SetData
GetDataPresent

DataObject コンストラクタ (String, String, String, XmlElement)

指定した IDMIME 型、エンコーディング、およびデータ使用してDataObject クラス新しインスタンス初期化します。

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

例外例外
例外種類条件

System.ArgumentNullException

data パラメータnull 参照 (Visual Basic では Nothing) です。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataObject クラス
DataObject メンバ
System.Security.Cryptography.Xml 名前空間

DataObject コンストラクタ (Object)

DataObject クラス新しインスタンス初期化し指定したオブジェクト追加します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

解説解説
使用例使用例

文字列含んだ DataObject作成するコード例次に示しますデータは、そのデータ形式使用して取得されます。結果テキスト ボックス表示されます。このコードでは、textBox1作成されていることが必要です。

Private Sub CreateTextDataObject()
    ' Creates a new data object using a string.
    Dim myString As String
 = "My text string"
    Dim myDataObject As New
 DataObject(myString)
    
    ' Prints the string in a text box.
    textBox1.Text = myDataObject.GetData(DataFormats.Text).ToString()
End Sub 'CreateTextDataObject
private void CreateTextDataObject() {
    // Creates a new data object using a string.
    string myString = "My text string";
    DataObject myDataObject = new DataObject(myString);
 
    // Prints the string in a text box.
    textBox1.Text = myDataObject.GetData(DataFormats.Text).ToString();
 }
 
private:
   void CreateTextDataObject()
   {
      // Creates a new data object using a string.
      String^ myString = "My text string";
      DataObject^ myDataObject = gcnew DataObject( myString );
      
      // Prints the string in a text box.
      textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString();
   }
private void CreateTextDataObject()
{
    // Creates a new data object using a string.
    String myString = "My text string";
    DataObject myDataObject = new DataObject(myString);

    // Prints the string in a text box.
    textBox1.set_Text(myDataObject.GetData(DataFormats.Text).ToString());
} //CreateTextDataObject
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataObject クラス
DataObject メンバ
System.Windows.Forms 名前空間
IDataObject
GetData
SetData
GetDataPresent
その他の技術情報
IDataObject

DataObject コンストラクタ

DataObject クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

参照参照

関連項目

DataObject クラス
DataObject メンバ
System.Security.Cryptography.Xml 名前空間

DataObject コンストラクタ


DataObject プロパティ


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

参照参照

関連項目

DataObject クラス
System.Security.Cryptography.Xml 名前空間

DataObject メソッド


DataObject メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド ContainsAudio データ オブジェクトに WaveAudio 形式データ含まれているかどうか示します
パブリック メソッド ContainsFileDropList データ オブジェクトに FileDrop 形式データか、その形式変換できるデータ含まれているかどうか示します
パブリック メソッド ContainsImage データ オブジェクトBitmap 形式データか、その形式変換できるデータ含まれているかどうか示します
パブリック メソッド ContainsText オーバーロードされますデータ オブジェクトテキスト データ含まれているかどうか示します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド GetAudioStream データ オブジェクトからオーディオ ストリーム取得します
パブリック メソッド GetData オーバーロードされます指定したデータ形式関連付けられたデータ返します
パブリック メソッド GetDataPresent オーバーロードされます。 この DataObject に格納されているデータが、指定した形式関連付けられているかどうか確認します
パブリック メソッド GetFileDropList ファイル名コレクションデータ オブジェクトから取得します
パブリック メソッド GetFormats オーバーロードされます。 この DataObject格納されデータ関連付けられているすべての形式、または変換できるすべての形式リスト返します
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetImage データ オブジェクトからイメージ取得します
パブリック メソッド GetText オーバーロードされますデータ オブジェクトからテキスト データ取得します
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド SetAudio オーバーロードされますデータ オブジェクトWaveAudio 形式データ追加します
パブリック メソッド SetData オーバーロードされますオブジェクトDataObject追加します
パブリック メソッド SetFileDropList データ オブジェクトFileDrop 形式ファイル名コレクション追加します
パブリック メソッド SetImage データ オブジェクトBitmap 形式Image追加します
パブリック メソッド SetText オーバーロードされますデータ オブジェクトテキスト データ追加します
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.DAdvise このメンバ説明については、IDataObject.DAdvise のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.DUnadvise このメンバ説明については、IDataObject.DUnadvise のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.EnumDAdvise このメンバ説明については、IDataObject.EnumDAdvise のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.EnumFormatEtc このメンバ説明については、IDataObject.EnumFormatEtc のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.GetCanonicalFormatEtc このメンバ説明については、IDataObject.GetCanonicalFormatEtc のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.GetData このメンバ説明については、IDataObject.GetData のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere このメンバ説明については、IDataObject.GetDataHere のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.QueryGetData このメンバ説明については、IDataObject.QueryGetData のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.SetData このメンバ説明については、IDataObject.SetData のトピック参照してください
参照参照

関連項目

DataObject クラス
System.Windows.Forms 名前空間
Clipboard クラス
IDataObject
DataFormats クラス

DataObject メンバ

署名されているデータ保持するXML 署名オブジェクト要素表します

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


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DataObject クラス
System.Security.Cryptography.Xml 名前空間

DataObject メンバ

基本データ転送機構実装ます。

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


パブリック コンストラクタパブリック コンストラクタ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド ContainsAudio データ オブジェクトに WaveAudio 形式データ含まれているかどうか示します
パブリック メソッド ContainsFileDropList データ オブジェクトに FileDrop 形式データか、その形式変換できるデータ含まれているかどうか示します
パブリック メソッド ContainsImage データ オブジェクトBitmap 形式データか、その形式変換できるデータ含まれているかどうか示します
パブリック メソッド ContainsText オーバーロードされますデータ オブジェクトテキスト データ含まれているかどうか示します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド GetAudioStream データ オブジェクトからオーディオ ストリーム取得します
パブリック メソッド GetData オーバーロードされます指定したデータ形式関連付けられたデータ返します
パブリック メソッド GetDataPresent オーバーロードされます。 この DataObject格納されているデータが、指定した形式関連付けられているかどうか確認します
パブリック メソッド GetFileDropList ファイル名コレクションデータ オブジェクトから取得します
パブリック メソッド GetFormats オーバーロードされます。 この DataObject格納されデータ関連付けられているすべての形式、または変換できるすべての形式リスト返します
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetImage データ オブジェクトからイメージ取得します
パブリック メソッド GetText オーバーロードされますデータ オブジェクトからテキスト データ取得します
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド SetAudio オーバーロードされますデータ オブジェクトWaveAudio 形式データ追加します
パブリック メソッド SetData オーバーロードされますオブジェクトDataObject追加します
パブリック メソッド SetFileDropList データ オブジェクトFileDrop 形式ファイル名コレクション追加します
パブリック メソッド SetImage データ オブジェクトBitmap 形式Image追加します
パブリック メソッド SetText オーバーロードされますデータ オブジェクトテキスト データ追加します
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.DAdvise このメンバ説明については、IDataObject.DAdvise のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.DUnadvise このメンバ説明については、IDataObject.DUnadvise のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.EnumDAdvise このメンバ説明については、IDataObject.EnumDAdvise のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.EnumFormatEtc このメンバ説明については、IDataObject.EnumFormatEtc のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.GetCanonicalFormatEtc このメンバ説明については、IDataObject.GetCanonicalFormatEtc のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.GetData このメンバ説明については、IDataObject.GetData のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere このメンバ説明については、IDataObject.GetDataHere のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.QueryGetData このメンバ説明については、IDataObject.QueryGetData のトピック参照してください
インターフェイスの明示的な実装 System.Runtime.InteropServices.ComTypes.IDataObject.SetData このメンバ説明については、IDataObject.SetData のトピック参照してください
参照参照

関連項目

DataObject クラス
System.Windows.Forms 名前空間
Clipboard クラス
IDataObject
DataFormats クラス


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

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

辞書ショートカット

すべての辞書の索引

「DataObject」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS