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

Weblio 辞書 > 辞書・百科事典 > 日本語表現辞典 > signatureの意味・解説 

signature

別表記:シグネチャー

「signature」とは、主に「署名サイン)」や「署名すること」などを意味する英語の表現である。本人自分の名前を(本人の証として)記すこと、および、そのようにして記された名前のこと。自筆署名限らず個人判別できる特徴的なマークなどを指す場合もある。

日本語名詞としてのサイン」は、英語では「sign」よりも、むしろこの「signature」の意味に近い。

ちなみに有名人サイン」は、英語では普通「sign」でも「signature」でもなく「autographオートグラフ)」という。

「signature」は、典型的には、契約書小切手などに書かれる署名」を指す。この署名(signature)は、法的な効力有するハンコ文化持たない西欧では、signature がハンコ役割を持つわけである。

「signature」のスラングとしての意味

「signature」は、基本的に名詞として使われるが、形容詞として「代表的な」「自慢の」などの意味合い使われることもある。例えば、「signature food名物料理)」「signature soup自慢スープ)」などが挙げられる

ほかにも「signature」はスラングとしてカッコいいユニークという意味で用いられることがあるこのような意味合いで使う場合、「signacha」と表記されることもある。


・Your outfit is so signacha !
(その服スゴカッコいいね)

「signature(署名)」の意味で使われるスラング

アメリカ英語では「signature」の代わりにJohn Hancock」という表現が、「署名」を指す語として用いられることがある

John Hancockジョン・ハンコック)」は1776年独立宣言署名した人物である。大きな文字で目立つ署名だったことが知られている。いわば印象的なsignatureの代名詞のような扱いである。


Can I have your John Hancock ?
署名お願いします

「signature」の発音・読み方

「signature」の発音は /sígnəər/ である。カタカナ表記では「スィグネチャ」に近い発音である。

日本語としては「シグネチャー」という表記一般的に用いられている。

「signature」の特徴

「signature」には「特徴」という意味があり、行動外観の特徴表現するために使われる。ほかにも「特徴」という意味を持つ英単語として「character」挙げられるが、こちらは精神的感情的な特徴に対して用いられる

「signature」の語源・由来

「signature」の語源は、ラテン語で「署名する印をつける」を意味する「signatus」である。それが中世ラテン語で「signatura」となり、16世紀中頃「signature」となった

「signature」と「sign」の違い

「signature」と「sign」品詞が違う。「signature」は名詞で「署名」、「sign」動詞で「署名する」という意味である。「sign」名詞としては「合図」「標識」「しるし」などを意味するが、「署名」という意味はない。

Please write your signature on this form.(この用紙署名記入してください
Please sign this form.(署名をしてください

「signature」を含む英熟語・英語表現

「by signature」とは

「by signature」とは、「署名によって」という意味である。

「affix one's signature to」とは

affix one's signature to」とは、「~に署名する」という意味である。「affix one's signature to a contract」とすると「契約書署名する」という意味になる。

「time signature」とは

音楽における、拍子記号のことである。

「signature」の使い方・例文

・He put his signature to the document.(彼は書類署名した
・I need your signature on the dotted line. (点線ところにサインをしてください
Can you please give me your signature here? (ここにあなたのサインお願いできますか
・A signature collection campaign is not easy to accomplish.(署名運動簡単に達成できるものではない)

・The two companies have reached an agreement shortly to be formalized by the signature of the president. (両社間もなく合意達し社長署名によって正式に決定される予定だ)
・Some merchants require that every transaction over a certain amount be verified by signature.( 一部加盟店では、一定額以上の取引はすべて署名確認することを義務付けている)

The band blends jazz with classic and world music to create a signature sound.(このバンドは、ジャズクラシック音楽ワールド ミュージック融合させて独自のサウンド生み出している)
・The signature food of the cafe is the "vegetable potage soup", made with local organic vegetables.(カフェ看板メニューは、地元有機野菜使った野菜ポタージュスープ」だ)

This is their signature item. (これがこのお店名物だ)
The time signature tells us how to count the rhythms. (拍子記号リズム数え方教えてくれる)

・I affixed my signature to each of the documents.(各書類に署名をした)

シグネチャー【signature】

読み方:しぐねちゃー

《「シグニチャー」とも》署名。特に、電子メール付される送信者の氏名所属連絡先など。


シグネチャ [signature]

メソッドフィールドプロパティ、またはローカル変数の定義に関係する型のリストメソッド場合、シグネチャは、メソッドの名前、パラメータの数と型、返される型 (指定されている場合)、および呼び出し規約 (既定または vararg) を含みますプロパティのシグネチャは、メソッドのシグネチャに似てます。フィールドおよびローカル変数のシグネチャは、単に型 (たとえば、int配列 [0..5] など) です。

シグネチャ

別名:署名
【英】signature

シグネチャとは、電子メールなどのメッセージ末尾付加されるメッセージ個人情報のことである。

シグネチャは、メールソフト機能として提供されていることが多く、あらかじめ記述する内容設定しておくことで、送信メールにかならずシグネチャが付加されるうになる。なお、データメッセージ正当性補償する電子署名とは別ののである

シグネチャの用途としては、例えビジネスでは、送信者の会社連絡先部署氏名などを記すのが一般的であるが、プライベート用い場合は、送信者のメッセージなどが記されていることもある。

電子メールのほかの用語一覧
メールの構造:  Quoted-Printable  リプライ  サブジェクト  シグネチャ  添付ファイル  電子メールアドレス
メールの種類:  オプトインメール

Signature クラス

XML 署名<Signature> 要素表します

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

public class Signature
public ref class Signature
public class Signature
public class Signature
解説解説

Signature クラスは、XML デジタル署名仕様定義されている XML 署名の <Signature> 要素表します。<Signature> 要素は、XML デジタル署名ルート要素です。SignedInfo、SignatureValue、KeyInfo、および ObjectList プロパティは、<Signature> 要素サブ要素カプセル化ます。

<Signature> 要素詳細については、www.w3.org/TR/xmldsig-core/ の W3C 仕様参照してください

使用例使用例

Signature クラスを SignedXml クラスと共に使用しエンベロープ シグネチャXML ドキュメント署名および検証を行うコードの例次に示します

' This example signs an XML file using an
' envelope signature. It then verifies the 
' signed XML.
'
Imports System
Imports System.Security.Cryptography
Imports System.Security.Cryptography.Xml
Imports System.Text
Imports System.Xml



Module SignVerifyEnvelope


    Sub Main(ByVal args() As
 String)
        ' Generate a signing key.
        Dim Key As New RSACryptoServiceProvider()

        Try

            ' Sign an XML file and save the signature to a 
            ' new file.
            SignXmlFile("Test.xml", "SignedExample.xml",
 Key)
            Console.WriteLine("XML file signed.")

            ' Verify the signature of the signed XML.
            Console.WriteLine("Verifying signature...")

            Dim result As Boolean
 = VerifyXmlFile("SignedExample.xml")

            ' Display the results of the signature verification to 
            ' the console.
            If result Then
                Console.WriteLine("The XML signature is valid.")
            Else
                Console.WriteLine("The XML signature is not valid.")
            End If
        Catch e As CryptographicException
            Console.WriteLine(e.Message)
        Finally
            ' Clear resources associated with the 
            ' RSACryptoServiceProvider.
            Key.Clear()
        End Try

    End Sub


    ' Sign an XML file and save the signature in a new file.
    Sub SignXmlFile(ByVal FileName As
 String, ByVal SignedFileName As
 String, ByVal Key As RSA)
        ' Check the arguments.  
        If FileName Is Nothing
 Then
            Throw New ArgumentNullException("FileName")
        End If
        If SignedFileName Is Nothing
 Then
            Throw New ArgumentNullException("SignedFileName")
        End If
        If Key Is Nothing
 Then
            Throw New ArgumentNullException("Key")
        End If

        ' Create a new XML document.
        Dim doc As New XmlDocument()

        ' Format the document to ignore white spaces.
        doc.PreserveWhitespace = False

        ' Load the passed XML file using it's name.
        doc.Load(New XmlTextReader(FileName))

        ' Create a SignedXml object.
        Dim signedXml As New
 SignedXml(doc)

        ' Add the key to the SignedXml document. 
        signedXml.SigningKey = Key

        ' Get the signature object from the SignedXml object.
        Dim XMLSignature As Signature = signedXml.Signature

        ' Create a reference to be signed.  Pass "" 
        ' to specify that all of the current XML
        ' document should be signed.
        Dim reference As New
 Reference("")

        ' Add an enveloped transformation to the reference.
        Dim env As New XmlDsigEnvelopedSignatureTransform()
        reference.AddTransform(env)

        ' Add the Reference object to the Signature object.
        XMLSignature.SignedInfo.AddReference(reference)

        ' Add an RSAKeyValue KeyInfo (optional; helps recipient find
 key to validate).
        Dim keyInfo As New
 KeyInfo()
        keyInfo.AddClause(New RSAKeyValue(CType(Key, RSA)))

        ' Add the KeyInfo object to the Reference object.
        XMLSignature.KeyInfo = keyInfo

        ' Compute the signature.
        signedXml.ComputeSignature()

        ' Get the XML representation of the signature and save
        ' it to an XmlElement object.
        Dim xmlDigitalSignature As XmlElement
 = signedXml.GetXml()

        ' Append the element to the XML document.
        doc.DocumentElement.AppendChild(doc.ImportNode(xmlDigitalSignature, True))


        If TypeOf doc.FirstChild Is
 XmlDeclaration Then
            doc.RemoveChild(doc.FirstChild)
        End If

        ' Save the signed XML document to a file specified
        ' using the passed string.
        Dim xmltw As New
 XmlTextWriter(SignedFileName, New UTF8Encoding(False))
        doc.WriteTo(xmltw)
        xmltw.Close()

    End Sub

    ' Verify the signature of an XML file and return the result.
    Function VerifyXmlFile(ByVal Name As
 String) As [Boolean]
        ' Check the arguments.  
        If Name Is Nothing
 Then
            Throw New ArgumentNullException("Name")
        End If
        ' Create a new XML document.
        Dim xmlDocument As New
 XmlDocument()

        ' Format using white spaces.
        xmlDocument.PreserveWhitespace = True

        ' Load the passed XML file into the document. 
        xmlDocument.Load(Name)

        ' Create a new SignedXml object and pass it
        ' the XML document class.
        Dim signedXml As New
 SignedXml(xmlDocument)

        ' Find the "Signature" node and create a new
        ' XmlNodeList object.
        Dim nodeList As XmlNodeList = xmlDocument.GetElementsByTagName("Signature")

        ' Load the signature node.
        signedXml.LoadXml(CType(nodeList(0), XmlElement))

        ' Check the signature and return the result.
        Return signedXml.CheckSignature()

    End Function
End Module
//
// This example signs an XML file using an
// envelope signature. It then verifies the 
// signed XML.
//
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Xml;

public class SignVerifyEnvelope
{

    public static void Main(String[]
 args)
    {
        // Generate a signing key.
       RSACryptoServiceProvider Key = new RSACryptoServiceProvider();

       try
       {

           // Sign an XML file and save the signature to a 
           // new file.
           SignXmlFile("Test.xml", "SignedExample.xml", Key);
           Console.WriteLine("XML file signed.");

           // Verify the signature of the signed XML.
           Console.WriteLine("Verifying signature...");

           bool result = VerifyXmlFile("SignedExample.xml");

           // Display the results of the signature verification to 
           // the console.
           if (result)
           {
               Console.WriteLine("The XML signature is valid.");
           }
           else
           {
               Console.WriteLine("The XML signature is not valid.");
           }
       }
       catch (CryptographicException e)
       {
           Console.WriteLine(e.Message);
       }
       finally
       {
           // Clear resources associated with the 
           // RSACryptoServiceProvider.
           Key.Clear();
       }
   }

    // Sign an XML file and save the signature in a new file.
    public static void SignXmlFile(string
 FileName, string SignedFileName, RSA Key)
    {
        // Check the arguments.  
        if (FileName == null)
            throw new ArgumentNullException("FileName");
        if (SignedFileName == null)
            throw new ArgumentNullException("SignedFileName");
        if (Key == null)
            throw new ArgumentNullException("Key");


        // Create a new XML document.
        XmlDocument doc = new XmlDocument();

        // Format the document to ignore white spaces.
        doc.PreserveWhitespace = false;

        // Load the passed XML file using it's name.
        doc.Load(new XmlTextReader(FileName));

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

        // Add the key to the SignedXml document. 
        signedXml.SigningKey = Key;

        // Get the signature object from the SignedXml object.
        Signature XMLSignature = signedXml.Signature;

        // Create a reference to be signed.  Pass "" 
        // to specify that all of the current XML
        // document should be signed.
        Reference reference = new Reference("");

        // Add an enveloped transformation to the reference.
        XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform();
        reference.AddTransform(env);

        // Add the Reference object to the Signature object.
        XMLSignature.SignedInfo.AddReference(reference);

        // Add an RSAKeyValue KeyInfo (optional; helps recipient find
 key to validate).
        KeyInfo keyInfo = new KeyInfo();
        keyInfo.AddClause(new RSAKeyValue((RSA)Key));

        // Add the KeyInfo object to the Reference object.
        XMLSignature.KeyInfo = keyInfo;

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

        // Get the XML representation of the signature and save
        // it to an XmlElement object.
        XmlElement xmlDigitalSignature = signedXml.GetXml();

        // Append the element to the XML document.
        doc.DocumentElement.AppendChild(doc.ImportNode(xmlDigitalSignature, true));


        if (doc.FirstChild is XmlDeclaration)
        {
            doc.RemoveChild(doc.FirstChild);
        }

        // Save the signed XML document to a file specified
        // using the passed string.
        XmlTextWriter xmltw = new XmlTextWriter(SignedFileName,
 new UTF8Encoding(false));
        doc.WriteTo(xmltw);
        xmltw.Close();
    }
    // Verify the signature of an XML file and return the result.
    public static Boolean VerifyXmlFile(String
 Name)
    {
        // Check the arguments.  
        if (Name == null)
            throw new ArgumentNullException("Name");

        // Create a new XML document.
        XmlDocument xmlDocument = new XmlDocument();

        // Format using white spaces.
        xmlDocument.PreserveWhitespace = true;

        // Load the passed XML file into the document. 
        xmlDocument.Load(Name);

        // Create a new SignedXml object and pass it
        // the XML document class.
        SignedXml signedXml = new SignedXml(xmlDocument);

        // Find the "Signature" node and create a new
        // XmlNodeList object.
        XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");

        // Load the signature node.
        signedXml.LoadXml((XmlElement)nodeList[0]);

        // Check the signature and return the result.
        return signedXml.CheckSignature();
    }
}
//
// This example signs an XML file using an
// envelope signature. It then verifies the 
// signed XML.
//
#using <System.Xml.dll>
#using <System.Security.dll>
#using <System.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Cryptography::Xml;
using namespace System::Text;
using namespace System::Xml;

// Sign an XML file and save the signature in a new file.
static void SignXmlFile( String^ FileName,
 String^ SignedFileName, RSA^ Key )
{
   
   // Check the arguments.  
   if ( FileName == nullptr )
      throw gcnew ArgumentNullException( L"FileName" );

   if ( SignedFileName == nullptr )
      throw gcnew ArgumentNullException( L"SignedFileName" );

   if ( Key == nullptr )
      throw gcnew ArgumentNullException( L"Key" );

   
   // Create a new XML document.
   XmlDocument^ doc = gcnew XmlDocument;
   
   // Format the document to ignore white spaces.
   doc->PreserveWhitespace = false;
   
   // Load the passed XML file using it's name.
   doc->Load( gcnew XmlTextReader( FileName ) );
   
   // Create a SignedXml object.
   SignedXml^ signedXml = gcnew SignedXml( doc );
   
   // Add the key to the SignedXml document. 
   signedXml->SigningKey = Key;
   
   // Get the signature object from the SignedXml object.
   Signature^ XMLSignature = signedXml->Signature;
   
   // Create a reference to be signed.  Pass "" 
   // to specify that all of the current XML
   // document should be signed.
   Reference^ reference = gcnew Reference( L"" );
   
   // Add an enveloped transformation to the reference.
   XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform;
   reference->AddTransform( env );
   
   // Add the Reference object to the Signature object.
   XMLSignature->SignedInfo->AddReference( reference );
   
   // Add an RSAKeyValue KeyInfo (optional; helps recipient find key
 to validate).
   KeyInfo^ keyInfo = gcnew KeyInfo;
   keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast<RSA^>(Key) ) );
   
   // Add the KeyInfo object to the Reference object.
   XMLSignature->KeyInfo = keyInfo;
   
   // Compute the signature.
   signedXml->ComputeSignature();
   
   // Get the XML representation of the signature and save
   // it to an XmlElement object.
   XmlElement^ xmlDigitalSignature = signedXml->GetXml();
   
   // Append the element to the XML document.
   doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature,
 true ) );
   if ( dynamic_cast<XmlDeclaration^>(doc->FirstChild)
 )
   {
      doc->RemoveChild( doc->FirstChild );
   }

   
   // Save the signed XML document to a file specified
   // using the passed string.
   XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding(
 false ) );
   doc->WriteTo( xmltw );
   xmltw->Close();
}


// Verify the signature of an XML file and return the result.
static Boolean VerifyXmlFile( String^ Name )
{
   
   // Check the arguments.  
   if ( Name == nullptr )
      throw gcnew ArgumentNullException( L"Name" );

   
   // Create a new XML document.
   XmlDocument^ xmlDocument = gcnew XmlDocument;
   
   // Format using white spaces.
   xmlDocument->PreserveWhitespace = true;
   
   // Load the passed XML file into the document. 
   xmlDocument->Load( Name );
   
   // Create a new SignedXml object and pass it
   // the XML document class.
   SignedXml^ signedXml = gcnew SignedXml( xmlDocument );
   
   // Find the "Signature" node and create a new
   // XmlNodeList object.
   XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature"
 );
   
   // Load the signature node.
   signedXml->LoadXml( dynamic_cast<XmlElement^>(nodeList->Item( 0 ))
 );
   
   // Check the signature and return the result.
   return signedXml->CheckSignature();
}

int main()
{
   
   // Generate a signing key.
   RSACryptoServiceProvider^ Key = gcnew RSACryptoServiceProvider;
   try
   {
      
      // Sign an XML file and save the signature to a 
      // new file.
      SignXmlFile( L"Test.xml", L"SignedExample.xml", Key );
      Console::WriteLine( L"XML file signed." );
      
      // Verify the signature of the signed XML.
      Console::WriteLine( L"Verifying signature..." );
      bool result = VerifyXmlFile( L"SignedExample.xml"
 );
      
      // Display the results of the signature verification to 
      // the console.
      if ( result )
      {
         Console::WriteLine( L"The XML signature is valid." );
      }
      else
      {
         Console::WriteLine( L"The XML signature is not valid." );
      }
   }
   catch ( CryptographicException^ e ) 
   {
      Console::WriteLine( e->Message );
   }
   finally
   {
      
      // Clear resources associated with the 
      // RSACryptoServiceProvider.
      Key->Clear();
   }

   return 1;
}

Signature クラスSignedXml クラスと共に使用し、デタッチ シグネチャXML ドキュメント署名および検証を行うコードの例次に示します

' This example signs a URL using an
' envelope signature. It then verifies the 
' signed XML.
'
Imports System
Imports System.Security.Cryptography
Imports System.Security.Cryptography.Xml
Imports System.Text
Imports System.Xml



Module SignVerifyEnvelope


    Sub Main(ByVal args() As
 String)
        ' Generate a signing key.
        Dim Key As New RSACryptoServiceProvider()

        Try

            ' Sign the detached resource and save the signature in an
 XML file.
            SignDetachedResource("http://www.microsoft.com",
 "SignedExample.xml", Key)

            Console.WriteLine("XML file signed.")

            ' Verify the signature of the signed XML.
            Console.WriteLine("Verifying signature...")

            Dim result As Boolean
 = VerifyXmlFile("SignedExample.xml")

            ' Display the results of the signature verification to \
            ' the console.
            If result Then
                Console.WriteLine("The XML signature is valid.")
            Else
                Console.WriteLine("The XML signature is not valid.")
            End If
        Catch e As CryptographicException
            Console.WriteLine(e.Message)
        Finally
            ' Clear resources associated with the 
            ' RSACryptoServiceProvider.
            Key.Clear()
        End Try

    End Sub


    ' Sign an XML file and save the signature in a new file.
    Sub SignDetachedResource(ByVal URIString
 As String, ByVal XmlSigFileName
 As String, ByVal Key As RSA)
        ' Check the arguments.  
        If URIString Is Nothing
 Then
            Throw New ArgumentNullException("URIString")
        End If
        If XmlSigFileName Is Nothing
 Then
            Throw New ArgumentNullException("XmlSigFileName")
        End If
        If Key Is Nothing
 Then
            Throw New ArgumentNullException("Key")
        End If
        ' Create a SignedXml object.
        Dim signedXml As New
 SignedXml()

        ' Assign the key to the SignedXml object.
        signedXml.SigningKey = Key

        ' Get the signature object from the SignedXml object.
        Dim XMLSignature As Signature = signedXml.Signature

        ' Create a reference to be signed.
        Dim reference As New
 Reference()

        ' Add the passed URI to the reference object.
        reference.Uri = URIString

        ' Add the Reference object to the Signature object.
        XMLSignature.SignedInfo.AddReference(reference)

        ' Add an RSAKeyValue KeyInfo (optional; helps recipient find
 key to validate).
        Dim keyInfo As New
 KeyInfo()
        keyInfo.AddClause(New RSAKeyValue(CType(Key, RSA)))

        ' Add the KeyInfo object to the Reference object.
        XMLSignature.KeyInfo = keyInfo

        ' Compute the signature.
        signedXml.ComputeSignature()

        ' Get the XML representation of the signature and save
        ' it to an XmlElement object.
        Dim xmlDigitalSignature As XmlElement
 = signedXml.GetXml()

        ' Save the signed XML document to a file specified
        ' using the passed string.
        Dim xmltw As New
 XmlTextWriter(XmlSigFileName, New UTF8Encoding(False))
        xmlDigitalSignature.WriteTo(xmltw)
        xmltw.Close()

    End Sub



    ' Verify the signature of an XML file and return the result.
    Function VerifyXmlFile(ByVal Name As
 String) As [Boolean]
        ' Check the arguments.  
        If Name Is Nothing
 Then
            Throw New ArgumentNullException("Name")
        End If
        ' Create a new XML document.
        Dim xmlDocument As New
 XmlDocument()

        ' Format using white spaces.
        xmlDocument.PreserveWhitespace = True

        ' Load the passed XML file into the document. 
        xmlDocument.Load(Name)

        ' Create a new SignedXml object and pass it
        ' the XML document class.
        Dim signedXml As New
 SignedXml(xmlDocument)

        ' Find the "Signature" node and create a new
        ' XmlNodeList object.
        Dim nodeList As XmlNodeList = xmlDocument.GetElementsByTagName("Signature")

        ' Load the signature node.
        signedXml.LoadXml(CType(nodeList(0), XmlElement))

        ' Check the signature and return the result.
        Return signedXml.CheckSignature()

    End Function
End Module
//
// This example signs a URL using an
// envelope signature. It then verifies the 
// signed XML.
//
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Xml;

public class SignVerifyEnvelope
{

    public static void Main(String[]
 args)
    {
        // Generate a signing key.
       RSACryptoServiceProvider Key = new RSACryptoServiceProvider();

       try
       {

           // Sign the detached resource and save the signature in an
 XML file.
           SignDetachedResource("http://www.microsoft.com",
 "SignedExample.xml", Key);

           Console.WriteLine("XML file signed.");

           // Verify the signature of the signed XML.
           Console.WriteLine("Verifying signature...");

           bool result = VerifyXmlFile("SignedExample.xml");

           // Display the results of the signature verification to \
           // the console.
           if (result)
           {
               Console.WriteLine("The XML signature is valid.");
           }
           else
           {
               Console.WriteLine("The XML signature is not valid.");
           }
       }
       catch (CryptographicException e)
       {
           Console.WriteLine(e.Message);
       }
       finally
       {
           // Clear resources associated with the 
           // RSACryptoServiceProvider.
           Key.Clear();
       }
   }

    // Sign an XML file and save the signature in a new file.
    public static void SignDetachedResource(string
 URIString, string XmlSigFileName, RSA Key)
    {
        // Check the arguments.  
        if (URIString == null)
            throw new ArgumentNullException("URIString");
        if (XmlSigFileName == null)
            throw new ArgumentNullException("XmlSigFileName");
        if (Key == null)
            throw new ArgumentNullException("Key");

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

        // Assign the key to the SignedXml object.
        signedXml.SigningKey = Key;

        // Get the signature object from the SignedXml object.
        Signature XMLSignature = signedXml.Signature;

        // Create a reference to be signed.
        Reference reference = new Reference();

        // Add the passed URI to the reference object.
        reference.Uri = URIString;

        // Add the Reference object to the Signature object.
        XMLSignature.SignedInfo.AddReference(reference);

        // Add an RSAKeyValue KeyInfo (optional; helps recipient find
 key to validate).
        KeyInfo keyInfo = new KeyInfo();
        keyInfo.AddClause(new RSAKeyValue((RSA)Key));

        // Add the KeyInfo object to the Reference object.
        XMLSignature.KeyInfo = keyInfo;

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

        // Get the XML representation of the signature and save
        // it to an XmlElement object.
        XmlElement xmlDigitalSignature = signedXml.GetXml();

        // Save the signed XML document to a file specified
        // using the passed string.
        XmlTextWriter xmltw = new XmlTextWriter(XmlSigFileName,
 new UTF8Encoding(false));
        xmlDigitalSignature.WriteTo(xmltw);
        xmltw.Close();
    }


    // Verify the signature of an XML file and return the result.
    public static Boolean VerifyXmlFile(String
 Name)
    {
        // Check the arguments.  
        if (Name == null)
            throw new ArgumentNullException("Name");

        // Create a new XML document.
        XmlDocument xmlDocument = new XmlDocument();

        // Format using white spaces.
        xmlDocument.PreserveWhitespace = true;

        // Load the passed XML file into the document. 
        xmlDocument.Load(Name);

        // Create a new SignedXml object and pass it
        // the XML document class.
        SignedXml signedXml = new SignedXml(xmlDocument);

        // Find the "Signature" node and create a new
        // XmlNodeList object.
        XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");

        // Load the signature node.
        signedXml.LoadXml((XmlElement)nodeList[0]);

        // Check the signature and return the result.
        return signedXml.CheckSignature();
    }
}
//
// This example signs a URL using an
// envelope signature. It then verifies the 
// signed XML.
//
#using <System.dll>
#using <System.Xml.dll>
#using <System.Security.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Cryptography::Xml;
using namespace System::Text;
using namespace System::Xml;


namespace Sample
{
    public ref class SignVerifyEnvelope
    {
    public:
        static void Work()
        {
            // Generate a signing key.
            RSACryptoServiceProvider^ key = 
                gcnew RSACryptoServiceProvider();

            try
            {

                // Sign the detached resource and save the 
                // signature in an XML file.
                SignDetachedResource("http://www.microsoft.com"
,
                    "SignedExample.xml", key);

                Console::WriteLine("XML file signed.");

                // Verify the signature of the signed XML.
                Console::WriteLine("Verifying signature...");

                bool result = VerifyXmlFile("SignedExample.xml");

                // Display the results of the signature verification
 
                // to the console.
                if (result)
                {
                    Console::WriteLine("The XML signature"
                        " is valid.");
                }
                else
                {
                    Console::WriteLine("The XML signature"
                        " is not valid.");
                }
                Console::ReadLine();
            }

            catch (CryptographicException^ ex)
            {
                Console::WriteLine(ex->Message);
            }
            finally
            {
                // Clear resources associated with the 
                // RSACryptoServiceProvider.
                key->Clear();
            }
        }


        // Sign an XML file and save the signature in a new file.
        static void SignDetachedResource(String^
 uri, 
            String^ xmlFileName, RSA^ key)
        {
            // Check the arguments.  
            if (uri->Length == 0)
            {
                throw gcnew ArgumentException("uri");
            }
            if (xmlFileName->Length == 0)
            {
                throw gcnew ArgumentException("xmlFileName");
            } 
            if (key->KeySize == 0)
            {
                throw gcnew ArgumentException("key");
            }
            // Create a SignedXml object.
            SignedXml^ signedXml = gcnew SignedXml();

            // Assign the key to the SignedXml object.
            signedXml->SigningKey = key;

            // Get the signature object from the SignedXml object.
            Signature^ xmlSignature = signedXml->Signature;

            // Create a reference to be signed.
            Reference^ reference = gcnew Reference();

            // Add the passed URI to the reference object.
            reference->Uri = uri;

            // Add the Reference object to the Signature object.
            xmlSignature->SignedInfo->AddReference(reference);

            // Add an RSAKeyValue KeyInfo (optional; helps recipient
            // find key to validate).
            KeyInfo^ keyInfo = gcnew KeyInfo();
            keyInfo->AddClause(
                gcnew RSAKeyValue(key));

            // Add the KeyInfo object to the Reference object.
            xmlSignature->KeyInfo = keyInfo;

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

            // Get the XML representation of the signature and save
            // it to an XmlElement object.
            XmlElement^ xmlDigitalSignature = signedXml->GetXml();

            // Save the signed XML document to a file specified
            // using the passed string.
            XmlTextWriter^ xmlTextWriter = gcnew XmlTextWriter(
                xmlFileName, gcnew UTF8Encoding(false));

            xmlDigitalSignature->WriteTo(xmlTextWriter);
            xmlTextWriter->Close();
        }


        // Verify the signature of an XML file and return the result.
        static Boolean VerifyXmlFile(String^ documentName)
        {
            // Check the arguments.  
            if (documentName->Length == 0)
            {
                throw gcnew ArgumentException("documentName");
            }
            // Create a new XML document.
            XmlDocument^ xmlDocument = gcnew XmlDocument();

            // Format using white spaces.
            xmlDocument->PreserveWhitespace = true;

            // Load the passed XML file into the document. 
            xmlDocument->Load(documentName);

            // Create a new SignedXml object and pass it
            // the XML document class.
            SignedXml^ signedXml = gcnew SignedXml(xmlDocument);

            // Find the "Signature" node and create a new
            // XmlNodeList object.
            XmlNodeList^ nodeList = 
                xmlDocument->GetElementsByTagName("Signature");

            // Load the signature node.
            signedXml->LoadXml(
                (XmlElement^) nodeList->Item(0));

            // Check the signature and return the result.
            return signedXml->CheckSignature();
        }
    };
}


int main()
{
    Sample::SignVerifyEnvelope::Work();
}
継承階層継承階層
System.Object
  System.Security.Cryptography.Xml.Signature
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Signature メンバ
System.Security.Cryptography.Xml 名前空間
SignedXml

Signature コンストラクタ

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

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

使用例使用例

Signature クラスを SignedXml クラスと共に使用しエンベロープ シグネチャXML ドキュメント署名および検証を行うコードの例次に示します

' This example signs an XML file using an
' envelope signature. It then verifies the 
' signed XML.
'
Imports System
Imports System.Security.Cryptography
Imports System.Security.Cryptography.Xml
Imports System.Text
Imports System.Xml



Module SignVerifyEnvelope


    Sub Main(ByVal args() As
 String)
        ' Generate a signing key.
        Dim Key As New RSACryptoServiceProvider()

        Try

            ' Sign an XML file and save the signature to a 
            ' new file.
            SignXmlFile("Test.xml", "SignedExample.xml",
 Key)
            Console.WriteLine("XML file signed.")

            ' Verify the signature of the signed XML.
            Console.WriteLine("Verifying signature...")

            Dim result As Boolean
 = VerifyXmlFile("SignedExample.xml")

            ' Display the results of the signature verification to 
            ' the console.
            If result Then
                Console.WriteLine("The XML signature is valid.")
            Else
                Console.WriteLine("The XML signature is not valid.")
            End If
        Catch e As CryptographicException
            Console.WriteLine(e.Message)
        Finally
            ' Clear resources associated with the 
            ' RSACryptoServiceProvider.
            Key.Clear()
        End Try

    End Sub


    ' Sign an XML file and save the signature in a new file.
    Sub SignXmlFile(ByVal FileName As
 String, ByVal SignedFileName As
 String, ByVal Key As RSA)
        ' Check the arguments.  
        If FileName Is Nothing
 Then
            Throw New ArgumentNullException("FileName")
        End If
        If SignedFileName Is Nothing
 Then
            Throw New ArgumentNullException("SignedFileName")
        End If
        If Key Is Nothing
 Then
            Throw New ArgumentNullException("Key")
        End If

        ' Create a new XML document.
        Dim doc As New XmlDocument()

        ' Format the document to ignore white spaces.
        doc.PreserveWhitespace = False

        ' Load the passed XML file using it's name.
        doc.Load(New XmlTextReader(FileName))

        ' Create a SignedXml object.
        Dim signedXml As New
 SignedXml(doc)

        ' Add the key to the SignedXml document. 
        signedXml.SigningKey = Key

        ' Get the signature object from the SignedXml object.
        Dim XMLSignature As Signature = signedXml.Signature

        ' Create a reference to be signed.  Pass "" 
        ' to specify that all of the current XML
        ' document should be signed.
        Dim reference As New
 Reference("")

        ' Add an enveloped transformation to the reference.
        Dim env As New XmlDsigEnvelopedSignatureTransform()
        reference.AddTransform(env)

        ' Add the Reference object to the Signature object.
        XMLSignature.SignedInfo.AddReference(reference)

        ' Add an RSAKeyValue KeyInfo (optional; helps recipient find
 key to validate).
        Dim keyInfo As New
 KeyInfo()
        keyInfo.AddClause(New RSAKeyValue(CType(Key, RSA)))

        ' Add the KeyInfo object to the Reference object.
        XMLSignature.KeyInfo = keyInfo

        ' Compute the signature.
        signedXml.ComputeSignature()

        ' Get the XML representation of the signature and save
        ' it to an XmlElement object.
        Dim xmlDigitalSignature As XmlElement
 = signedXml.GetXml()

        ' Append the element to the XML document.
        doc.DocumentElement.AppendChild(doc.ImportNode(xmlDigitalSignature, True))


        If TypeOf doc.FirstChild Is
 XmlDeclaration Then
            doc.RemoveChild(doc.FirstChild)
        End If

        ' Save the signed XML document to a file specified
        ' using the passed string.
        Dim xmltw As New
 XmlTextWriter(SignedFileName, New UTF8Encoding(False))
        doc.WriteTo(xmltw)
        xmltw.Close()

    End Sub

    ' Verify the signature of an XML file and return the result.
    Function VerifyXmlFile(ByVal Name As
 String) As [Boolean]
        ' Check the arguments.  
        If Name Is Nothing
 Then
            Throw New ArgumentNullException("Name")
        End If
        ' Create a new XML document.
        Dim xmlDocument As New
 XmlDocument()

        ' Format using white spaces.
        xmlDocument.PreserveWhitespace = True

        ' Load the passed XML file into the document. 
        xmlDocument.Load(Name)

        ' Create a new SignedXml object and pass it
        ' the XML document class.
        Dim signedXml As New
 SignedXml(xmlDocument)

        ' Find the "Signature" node and create a new
        ' XmlNodeList object.
        Dim nodeList As XmlNodeList = xmlDocument.GetElementsByTagName("Signature")

        ' Load the signature node.
        signedXml.LoadXml(CType(nodeList(0), XmlElement))

        ' Check the signature and return the result.
        Return signedXml.CheckSignature()

    End Function
End Module
//
// This example signs an XML file using an
// envelope signature. It then verifies the 
// signed XML.
//
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Xml;

public class SignVerifyEnvelope
{

    public static void Main(String[]
 args)
    {
        // Generate a signing key.
       RSACryptoServiceProvider Key = new RSACryptoServiceProvider();

       try
       {

           // Sign an XML file and save the signature to a 
           // new file.
           SignXmlFile("Test.xml", "SignedExample.xml", Key);
           Console.WriteLine("XML file signed.");

           // Verify the signature of the signed XML.
           Console.WriteLine("Verifying signature...");

           bool result = VerifyXmlFile("SignedExample.xml");

           // Display the results of the signature verification to 
           // the console.
           if (result)
           {
               Console.WriteLine("The XML signature is valid.");
           }
           else
           {
               Console.WriteLine("The XML signature is not valid.");
           }
       }
       catch (CryptographicException e)
       {
           Console.WriteLine(e.Message);
       }
       finally
       {
           // Clear resources associated with the 
           // RSACryptoServiceProvider.
           Key.Clear();
       }
   }

    // Sign an XML file and save the signature in a new file.
    public static void SignXmlFile(string
 FileName, string SignedFileName, RSA Key)
    {
        // Check the arguments.  
        if (FileName == null)
            throw new ArgumentNullException("FileName");
        if (SignedFileName == null)
            throw new ArgumentNullException("SignedFileName");
        if (Key == null)
            throw new ArgumentNullException("Key");


        // Create a new XML document.
        XmlDocument doc = new XmlDocument();

        // Format the document to ignore white spaces.
        doc.PreserveWhitespace = false;

        // Load the passed XML file using it's name.
        doc.Load(new XmlTextReader(FileName));

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

        // Add the key to the SignedXml document. 
        signedXml.SigningKey = Key;

        // Get the signature object from the SignedXml object.
        Signature XMLSignature = signedXml.Signature;

        // Create a reference to be signed.  Pass "" 
        // to specify that all of the current XML
        // document should be signed.
        Reference reference = new Reference("");

        // Add an enveloped transformation to the reference.
        XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform();
        reference.AddTransform(env);

        // Add the Reference object to the Signature object.
        XMLSignature.SignedInfo.AddReference(reference);

        // Add an RSAKeyValue KeyInfo (optional; helps recipient find
 key to validate).
        KeyInfo keyInfo = new KeyInfo();
        keyInfo.AddClause(new RSAKeyValue((RSA)Key));

        // Add the KeyInfo object to the Reference object.
        XMLSignature.KeyInfo = keyInfo;

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

        // Get the XML representation of the signature and save
        // it to an XmlElement object.
        XmlElement xmlDigitalSignature = signedXml.GetXml();

        // Append the element to the XML document.
        doc.DocumentElement.AppendChild(doc.ImportNode(xmlDigitalSignature, true));


        if (doc.FirstChild is XmlDeclaration)
        {
            doc.RemoveChild(doc.FirstChild);
        }

        // Save the signed XML document to a file specified
        // using the passed string.
        XmlTextWriter xmltw = new XmlTextWriter(SignedFileName,
 new UTF8Encoding(false));
        doc.WriteTo(xmltw);
        xmltw.Close();
    }
    // Verify the signature of an XML file and return the result.
    public static Boolean VerifyXmlFile(String
 Name)
    {
        // Check the arguments.  
        if (Name == null)
            throw new ArgumentNullException("Name");

        // Create a new XML document.
        XmlDocument xmlDocument = new XmlDocument();

        // Format using white spaces.
        xmlDocument.PreserveWhitespace = true;

        // Load the passed XML file into the document. 
        xmlDocument.Load(Name);

        // Create a new SignedXml object and pass it
        // the XML document class.
        SignedXml signedXml = new SignedXml(xmlDocument);

        // Find the "Signature" node and create a new
        // XmlNodeList object.
        XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");

        // Load the signature node.
        signedXml.LoadXml((XmlElement)nodeList[0]);

        // Check the signature and return the result.
        return signedXml.CheckSignature();
    }
}
//
// This example signs an XML file using an
// envelope signature. It then verifies the 
// signed XML.
//
#using <System.Xml.dll>
#using <System.Security.dll>
#using <System.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Cryptography::Xml;
using namespace System::Text;
using namespace System::Xml;

// Sign an XML file and save the signature in a new file.
static void SignXmlFile( String^ FileName,
 String^ SignedFileName, RSA^ Key )
{
   
   // Check the arguments.  
   if ( FileName == nullptr )
      throw gcnew ArgumentNullException( L"FileName" );

   if ( SignedFileName == nullptr )
      throw gcnew ArgumentNullException( L"SignedFileName" );

   if ( Key == nullptr )
      throw gcnew ArgumentNullException( L"Key" );

   
   // Create a new XML document.
   XmlDocument^ doc = gcnew XmlDocument;
   
   // Format the document to ignore white spaces.
   doc->PreserveWhitespace = false;
   
   // Load the passed XML file using it's name.
   doc->Load( gcnew XmlTextReader( FileName ) );
   
   // Create a SignedXml object.
   SignedXml^ signedXml = gcnew SignedXml( doc );
   
   // Add the key to the SignedXml document. 
   signedXml->SigningKey = Key;
   
   // Get the signature object from the SignedXml object.
   Signature^ XMLSignature = signedXml->Signature;
   
   // Create a reference to be signed.  Pass "" 
   // to specify that all of the current XML
   // document should be signed.
   Reference^ reference = gcnew Reference( L"" );
   
   // Add an enveloped transformation to the reference.
   XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform;
   reference->AddTransform( env );
   
   // Add the Reference object to the Signature object.
   XMLSignature->SignedInfo->AddReference( reference );
   
   // Add an RSAKeyValue KeyInfo (optional; helps recipient find key
 to validate).
   KeyInfo^ keyInfo = gcnew KeyInfo;
   keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast<RSA^>(Key) ) );
   
   // Add the KeyInfo object to the Reference object.
   XMLSignature->KeyInfo = keyInfo;
   
   // Compute the signature.
   signedXml->ComputeSignature();
   
   // Get the XML representation of the signature and save
   // it to an XmlElement object.
   XmlElement^ xmlDigitalSignature = signedXml->GetXml();
   
   // Append the element to the XML document.
   doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature,
 true ) );
   if ( dynamic_cast<XmlDeclaration^>(doc->FirstChild)
 )
   {
      doc->RemoveChild( doc->FirstChild );
   }

   
   // Save the signed XML document to a file specified
   // using the passed string.
   XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding(
 false ) );
   doc->WriteTo( xmltw );
   xmltw->Close();
}


// Verify the signature of an XML file and return the result.
static Boolean VerifyXmlFile( String^ Name )
{
   
   // Check the arguments.  
   if ( Name == nullptr )
      throw gcnew ArgumentNullException( L"Name" );

   
   // Create a new XML document.
   XmlDocument^ xmlDocument = gcnew XmlDocument;
   
   // Format using white spaces.
   xmlDocument->PreserveWhitespace = true;
   
   // Load the passed XML file into the document. 
   xmlDocument->Load( Name );
   
   // Create a new SignedXml object and pass it
   // the XML document class.
   SignedXml^ signedXml = gcnew SignedXml( xmlDocument );
   
   // Find the "Signature" node and create a new
   // XmlNodeList object.
   XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature"
 );
   
   // Load the signature node.
   signedXml->LoadXml( dynamic_cast<XmlElement^>(nodeList->Item( 0 ))
 );
   
   // Check the signature and return the result.
   return signedXml->CheckSignature();
}

int main()
{
   
   // Generate a signing key.
   RSACryptoServiceProvider^ Key = gcnew RSACryptoServiceProvider;
   try
   {
      
      // Sign an XML file and save the signature to a 
      // new file.
      SignXmlFile( L"Test.xml", L"SignedExample.xml", Key );
      Console::WriteLine( L"XML file signed." );
      
      // Verify the signature of the signed XML.
      Console::WriteLine( L"Verifying signature..." );
      bool result = VerifyXmlFile( L"SignedExample.xml"
 );
      
      // Display the results of the signature verification to 
      // the console.
      if ( result )
      {
         Console::WriteLine( L"The XML signature is valid." );
      }
      else
      {
         Console::WriteLine( L"The XML signature is not valid." );
      }
   }
   catch ( CryptographicException^ e ) 
   {
      Console::WriteLine( e->Message );
   }
   finally
   {
      
      // Clear resources associated with the 
      // RSACryptoServiceProvider.
      Key->Clear();
   }

   return 1;
}

Signature クラスSignedXml クラスと共に使用し、デタッチ シグネチャXML ドキュメント署名および検証を行うコードの例次に示します

' This example signs a URL using an
' envelope signature. It then verifies the 
' signed XML.
'
Imports System
Imports System.Security.Cryptography
Imports System.Security.Cryptography.Xml
Imports System.Text
Imports System.Xml



Module SignVerifyEnvelope


    Sub Main(ByVal args() As
 String)
        ' Generate a signing key.
        Dim Key As New RSACryptoServiceProvider()

        Try

            ' Sign the detached resource and save the signature in an
 XML file.
            SignDetachedResource("http://www.microsoft.com",
 "SignedExample.xml", Key)

            Console.WriteLine("XML file signed.")

            ' Verify the signature of the signed XML.
            Console.WriteLine("Verifying signature...")

            Dim result As Boolean
 = VerifyXmlFile("SignedExample.xml")

            ' Display the results of the signature verification to \
            ' the console.
            If result Then
                Console.WriteLine("The XML signature is valid.")
            Else
                Console.WriteLine("The XML signature is not valid.")
            End If
        Catch e As CryptographicException
            Console.WriteLine(e.Message)
        Finally
            ' Clear resources associated with the 
            ' RSACryptoServiceProvider.
            Key.Clear()
        End Try

    End Sub


    ' Sign an XML file and save the signature in a new file.
    Sub SignDetachedResource(ByVal URIString
 As String, ByVal XmlSigFileName
 As String, ByVal Key As RSA)
        ' Check the arguments.  
        If URIString Is Nothing
 Then
            Throw New ArgumentNullException("URIString")
        End If
        If XmlSigFileName Is Nothing
 Then
            Throw New ArgumentNullException("XmlSigFileName")
        End If
        If Key Is Nothing
 Then
            Throw New ArgumentNullException("Key")
        End If
        ' Create a SignedXml object.
        Dim signedXml As New
 SignedXml()

        ' Assign the key to the SignedXml object.
        signedXml.SigningKey = Key

        ' Get the signature object from the SignedXml object.
        Dim XMLSignature As Signature = signedXml.Signature

        ' Create a reference to be signed.
        Dim reference As New
 Reference()

        ' Add the passed URI to the reference object.
        reference.Uri = URIString

        ' Add the Reference object to the Signature object.
        XMLSignature.SignedInfo.AddReference(reference)

        ' Add an RSAKeyValue KeyInfo (optional; helps recipient find
 key to validate).
        Dim keyInfo As New
 KeyInfo()
        keyInfo.AddClause(New RSAKeyValue(CType(Key, RSA)))

        ' Add the KeyInfo object to the Reference object.
        XMLSignature.KeyInfo = keyInfo

        ' Compute the signature.
        signedXml.ComputeSignature()

        ' Get the XML representation of the signature and save
        ' it to an XmlElement object.
        Dim xmlDigitalSignature As XmlElement
 = signedXml.GetXml()

        ' Save the signed XML document to a file specified
        ' using the passed string.
        Dim xmltw As New
 XmlTextWriter(XmlSigFileName, New UTF8Encoding(False))
        xmlDigitalSignature.WriteTo(xmltw)
        xmltw.Close()

    End Sub



    ' Verify the signature of an XML file and return the result.
    Function VerifyXmlFile(ByVal Name As
 String) As [Boolean]
        ' Check the arguments.  
        If Name Is Nothing
 Then
            Throw New ArgumentNullException("Name")
        End If
        ' Create a new XML document.
        Dim xmlDocument As New
 XmlDocument()

        ' Format using white spaces.
        xmlDocument.PreserveWhitespace = True

        ' Load the passed XML file into the document. 
        xmlDocument.Load(Name)

        ' Create a new SignedXml object and pass it
        ' the XML document class.
        Dim signedXml As New
 SignedXml(xmlDocument)

        ' Find the "Signature" node and create a new
        ' XmlNodeList object.
        Dim nodeList As XmlNodeList = xmlDocument.GetElementsByTagName("Signature")

        ' Load the signature node.
        signedXml.LoadXml(CType(nodeList(0), XmlElement))

        ' Check the signature and return the result.
        Return signedXml.CheckSignature()

    End Function
End Module
//
// This example signs a URL using an
// envelope signature. It then verifies the 
// signed XML.
//
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Xml;

public class SignVerifyEnvelope
{

    public static void Main(String[]
 args)
    {
        // Generate a signing key.
       RSACryptoServiceProvider Key = new RSACryptoServiceProvider();

       try
       {

           // Sign the detached resource and save the signature in an
 XML file.
           SignDetachedResource("http://www.microsoft.com",
 "SignedExample.xml", Key);

           Console.WriteLine("XML file signed.");

           // Verify the signature of the signed XML.
           Console.WriteLine("Verifying signature...");

           bool result = VerifyXmlFile("SignedExample.xml");

           // Display the results of the signature verification to \
           // the console.
           if (result)
           {
               Console.WriteLine("The XML signature is valid.");
           }
           else
           {
               Console.WriteLine("The XML signature is not valid.");
           }
       }
       catch (CryptographicException e)
       {
           Console.WriteLine(e.Message);
       }
       finally
       {
           // Clear resources associated with the 
           // RSACryptoServiceProvider.
           Key.Clear();
       }
   }

    // Sign an XML file and save the signature in a new file.
    public static void SignDetachedResource(string
 URIString, string XmlSigFileName, RSA Key)
    {
        // Check the arguments.  
        if (URIString == null)
            throw new ArgumentNullException("URIString");
        if (XmlSigFileName == null)
            throw new ArgumentNullException("XmlSigFileName");
        if (Key == null)
            throw new ArgumentNullException("Key");

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

        // Assign the key to the SignedXml object.
        signedXml.SigningKey = Key;

        // Get the signature object from the SignedXml object.
        Signature XMLSignature = signedXml.Signature;

        // Create a reference to be signed.
        Reference reference = new Reference();

        // Add the passed URI to the reference object.
        reference.Uri = URIString;

        // Add the Reference object to the Signature object.
        XMLSignature.SignedInfo.AddReference(reference);

        // Add an RSAKeyValue KeyInfo (optional; helps recipient find
 key to validate).
        KeyInfo keyInfo = new KeyInfo();
        keyInfo.AddClause(new RSAKeyValue((RSA)Key));

        // Add the KeyInfo object to the Reference object.
        XMLSignature.KeyInfo = keyInfo;

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

        // Get the XML representation of the signature and save
        // it to an XmlElement object.
        XmlElement xmlDigitalSignature = signedXml.GetXml();

        // Save the signed XML document to a file specified
        // using the passed string.
        XmlTextWriter xmltw = new XmlTextWriter(XmlSigFileName,
 new UTF8Encoding(false));
        xmlDigitalSignature.WriteTo(xmltw);
        xmltw.Close();
    }


    // Verify the signature of an XML file and return the result.
    public static Boolean VerifyXmlFile(String
 Name)
    {
        // Check the arguments.  
        if (Name == null)
            throw new ArgumentNullException("Name");

        // Create a new XML document.
        XmlDocument xmlDocument = new XmlDocument();

        // Format using white spaces.
        xmlDocument.PreserveWhitespace = true;

        // Load the passed XML file into the document. 
        xmlDocument.Load(Name);

        // Create a new SignedXml object and pass it
        // the XML document class.
        SignedXml signedXml = new SignedXml(xmlDocument);

        // Find the "Signature" node and create a new
        // XmlNodeList object.
        XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");

        // Load the signature node.
        signedXml.LoadXml((XmlElement)nodeList[0]);

        // Check the signature and return the result.
        return signedXml.CheckSignature();
    }
}
//
// This example signs a URL using an
// envelope signature. It then verifies the 
// signed XML.
//
#using <System.dll>
#using <System.Xml.dll>
#using <System.Security.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Cryptography::Xml;
using namespace System::Text;
using namespace System::Xml;


namespace Sample
{
    public ref class SignVerifyEnvelope
    {
    public:
        static void Work()
        {
            // Generate a signing key.
            RSACryptoServiceProvider^ key = 
                gcnew RSACryptoServiceProvider();

            try
            {

                // Sign the detached resource and save the 
                // signature in an XML file.
                SignDetachedResource("http://www.microsoft.com"
,
                    "SignedExample.xml", key);

                Console::WriteLine("XML file signed.");

                // Verify the signature of the signed XML.
                Console::WriteLine("Verifying signature...");

                bool result = VerifyXmlFile("SignedExample.xml");

                // Display the results of the signature verification
 
                // to the console.
                if (result)
                {
                    Console::WriteLine("The XML signature"
                        " is valid.");
                }
                else
                {
                    Console::WriteLine("The XML signature"
                        " is not valid.");
                }
                Console::ReadLine();
            }

            catch (CryptographicException^ ex)
            {
                Console::WriteLine(ex->Message);
            }
            finally
            {
                // Clear resources associated with the 
                // RSACryptoServiceProvider.
                key->Clear();
            }
        }


        // Sign an XML file and save the signature in a new file.
        static void SignDetachedResource(String^
 uri, 
            String^ xmlFileName, RSA^ key)
        {
            // Check the arguments.  
            if (uri->Length == 0)
            {
                throw gcnew ArgumentException("uri");
            }
            if (xmlFileName->Length == 0)
            {
                throw gcnew ArgumentException("xmlFileName");
            } 
            if (key->KeySize == 0)
            {
                throw gcnew ArgumentException("key");
            }
            // Create a SignedXml object.
            SignedXml^ signedXml = gcnew SignedXml();

            // Assign the key to the SignedXml object.
            signedXml->SigningKey = key;

            // Get the signature object from the SignedXml object.
            Signature^ xmlSignature = signedXml->Signature;

            // Create a reference to be signed.
            Reference^ reference = gcnew Reference();

            // Add the passed URI to the reference object.
            reference->Uri = uri;

            // Add the Reference object to the Signature object.
            xmlSignature->SignedInfo->AddReference(reference);

            // Add an RSAKeyValue KeyInfo (optional; helps recipient
            // find key to validate).
            KeyInfo^ keyInfo = gcnew KeyInfo();
            keyInfo->AddClause(
                gcnew RSAKeyValue(key));

            // Add the KeyInfo object to the Reference object.
            xmlSignature->KeyInfo = keyInfo;

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

            // Get the XML representation of the signature and save
            // it to an XmlElement object.
            XmlElement^ xmlDigitalSignature = signedXml->GetXml();

            // Save the signed XML document to a file specified
            // using the passed string.
            XmlTextWriter^ xmlTextWriter = gcnew XmlTextWriter(
                xmlFileName, gcnew UTF8Encoding(false));

            xmlDigitalSignature->WriteTo(xmlTextWriter);
            xmlTextWriter->Close();
        }


        // Verify the signature of an XML file and return the result.
        static Boolean VerifyXmlFile(String^ documentName)
        {
            // Check the arguments.  
            if (documentName->Length == 0)
            {
                throw gcnew ArgumentException("documentName");
            }
            // Create a new XML document.
            XmlDocument^ xmlDocument = gcnew XmlDocument();

            // Format using white spaces.
            xmlDocument->PreserveWhitespace = true;

            // Load the passed XML file into the document. 
            xmlDocument->Load(documentName);

            // Create a new SignedXml object and pass it
            // the XML document class.
            SignedXml^ signedXml = gcnew SignedXml(xmlDocument);

            // Find the "Signature" node and create a new
            // XmlNodeList object.
            XmlNodeList^ nodeList = 
                xmlDocument->GetElementsByTagName("Signature");

            // Load the signature node.
            signedXml->LoadXml(
                (XmlElement^) nodeList->Item(0));

            // Check the signature and return the result.
            return signedXml->CheckSignature();
        }
    };
}


int main()
{
    Sample::SignVerifyEnvelope::Work();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Signature クラス
Signature メンバ
System.Security.Cryptography.Xml 名前空間
SignedXml

Signature プロパティ


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

  名前 説明
パブリック プロパティ Id 現在の Signature の ID取得または設定します
パブリック プロパティ KeyInfo 現在の Signature の KeyInfo を取得または設定します
パブリック プロパティ ObjectList 署名されるオブジェクトリスト取得または設定します
パブリック プロパティ SignatureValue デジタル署名の値を取得または設定します
パブリック プロパティ SignedInfo 現在の Signature の SignedInfo を取得または設定します
参照参照

関連項目

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

Signature メソッド


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

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

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

Signature メンバ

XML 署名<Signature> 要素表します

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド Signature Signature クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Id 現在の SignatureID取得または設定します
パブリック プロパティ KeyInfo 現在の Signature の KeyInfo を取得または設定します
パブリック プロパティ ObjectList 署名されるオブジェクトリスト取得または設定します
パブリック プロパティ SignatureValue デジタル署名の値を取得または設定します
パブリック プロパティ SignedInfo 現在の Signature の SignedInfo を取得または設定します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

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

【シグネチャー】(しぐねちゃー)

Signature.

自己の存在を示すようなあらゆる雑音
可視光赤外線電波放射反射がそれである。


符号数

(signature から転送)

出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2019/03/17 17:09 UTC 版)

数学、とくに線型代数学における符号数(ふごうすう、: signature)は固有値の符号(正・負・零)を重複度を込めて数えたものである。


  1. ^ Rowland, Todd. "Matrix Signature." From MathWorld--A Wolfram Web Resource, created by Eric W. Weisstein. http://mathworld.wolfram.com/MatrixSignature.html
  2. ^ Dray, Tevian; Ellis, George; Hellaby, Charles; Manogue, Corinne A. (1997). “Gravity and signature change”. General Relativity and Gravity 29: 591–597. arXiv:gr-qc/9610063. Bibcode 1997GReGr..29..591D. doi:10.1023/A:1018895302693. 


「符号数」の続きの解説一覧

署名

(signature から転送)

出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2024/05/24 22:17 UTC 版)

署名(しょめい、英語: sign, signature)とは、行為者がある行為(例えばクレジットカードの利用時)をする際に、自己の氏名を自署すること、また自署したものである。


注釈

  1. ^ 捺印は押印と同じ意味であるが、慣例的に、記名印、署名印と呼ぶことが多い。

出典

  1. ^ John Hancock”. Merriam-Webster. 2017年10月19日時点のオリジナルよりアーカイブ。2024年3月9日閲覧。
  2. ^ 『有斐閣 法律用語辞典 [第3版]』法令用語研究会 編、有斐閣、2006年、ISBN 4-641-00025-5
  3. ^ 法制執務研究会 編「問8」『新訂 ワークブック法制執務 第2版』株式会社ぎょうせい、2018年1月15日、30頁。ISBN 978-4-324-10388-3 


「署名」の続きの解説一覧


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

辞書ショートカット

すべての辞書の索引

「signature」の関連用語

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

   

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



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

   
実用日本語表現辞典実用日本語表現辞典
Copyright © 2024実用日本語表現辞典 All Rights Reserved.
デジタル大辞泉デジタル大辞泉
(C)Shogakukan Inc.
株式会社 小学館
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.
IT用語辞典バイナリIT用語辞典バイナリ
Copyright © 2005-2024 Weblio 辞書 IT用語辞典バイナリさくいん。 この記事は、IT用語辞典バイナリシグネチャの記事を利用しております。
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.
航空軍事用語辞典++航空軍事用語辞典++
この記事はMASDF 航空軍事用語辞典++の記事を転載しております。
MASDFでは航空及び軍事についての様々なコンテンツをご覧頂けます。
ウィキペディアウィキペディア
All text is available under the terms of the GNU Free Documentation License.
この記事は、ウィキペディアの符号数 (改訂履歴)、署名 (改訂履歴)の記事を複製、再配布したものにあたり、GNU Free Documentation Licenseというライセンスの下で提供されています。 Weblio辞書に掲載されているウィキペディアの記事も、全てGNU Free Documentation Licenseの元に提供されております。

©2024 GRAS Group, Inc.RSS