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ətʃə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]
シグネチャ
【英】signature
シグネチャとは、電子メールなどのメッセージの末尾に付加されるメッセージや個人情報のことである。
シグネチャは、メールソフトの機能として提供されていることが多く、あらかじめ記述する内容を設定しておくことで、送信メールにかならずシグネチャが付加されるようになる。なお、データやメッセージの正当性を補償する電子署名とは別のものである。
シグネチャの用途としては、例えばビジネスでは、送信者の会社の連絡先や部署、氏名などを記すのが一般的であるが、プライベートで用いる場合は、送信者のメッセージなどが記されていることもある。
Signature クラス
アセンブリ: System.Security (system.security.dll 内)
構文
解説
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.Security.Cryptography.Xml.Signature
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Signature コンストラクタ
アセンブリ: 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(); }
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Signature プロパティ
パブリック プロパティ
名前 | 説明 | |
---|---|---|
Id | 現在の Signature の ID を取得または設定します。 | |
KeyInfo | 現在の Signature の KeyInfo を取得または設定します。 | |
ObjectList | 署名されるオブジェクトのリストを取得または設定します。 | |
SignatureValue | デジタル署名の値を取得または設定します。 | |
SignedInfo | 現在の Signature の SignedInfo を取得または設定します。 |
Signature メソッド
パブリック メソッド
名前 | 説明 | |
---|---|---|
AddObject | 署名されるオブジェクトのリストに DataObject を追加します。 | |
Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) | |
GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) | |
GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) | |
GetXml | Signature の XML 表現を返します。 | |
LoadXml | XML 要素から Signature の状態を読み込みます。 | |
ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) | |
ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
名前 | 説明 | |
---|---|---|
Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) | |
MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |
Signature メンバ
Signature データ型で公開されるメンバを以下の表に示します。
パブリック コンストラクタ
パブリック プロパティ
名前 | 説明 | |
---|---|---|
Id | 現在の Signature の ID を取得または設定します。 | |
KeyInfo | 現在の Signature の KeyInfo を取得または設定します。 | |
ObjectList | 署名されるオブジェクトのリストを取得または設定します。 | |
SignatureValue | デジタル署名の値を取得または設定します。 | |
SignedInfo | 現在の Signature の SignedInfo を取得または設定します。 |
名前 | 説明 | |
---|---|---|
AddObject | 署名されるオブジェクトのリストに DataObject を追加します。 | |
Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) | |
GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) | |
GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) | |
GetXml | Signature の XML 表現を返します。 | |
LoadXml | XML 要素から Signature の状態を読み込みます。 | |
ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) | |
ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
名前 | 説明 | |
---|---|---|
Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) | |
MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |
符号数
(signature から転送)
出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2019/03/17 17:09 UTC 版)
数学、とくに線型代数学における符号数(ふごうすう、英: signature)は固有値の符号(正・負・零)を重複度を込めて数えたものである。
- ^ Rowland, Todd. "Matrix Signature." From MathWorld--A Wolfram Web Resource, created by Eric W. Weisstein. http://mathworld.wolfram.com/MatrixSignature.html
- ^ 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)とは、行為者がある行為(例えばクレジットカードの利用時)をする際に、自己の氏名を自署すること、また自署したものである。
注釈
- ^ 捺印は押印と同じ意味であるが、慣例的に、記名押印、署名捺印と呼ぶことが多い。
出典
- ^ “John Hancock”. Merriam-Webster. 2017年10月19日時点のオリジナルよりアーカイブ。2024年3月9日閲覧。
- ^ 『有斐閣 法律用語辞典 [第3版]』法令用語研究会 編、有斐閣、2006年、ISBN 4-641-00025-5
- ^ 法制執務研究会 編「問8」『新訂 ワークブック法制執務 第2版』株式会社ぎょうせい、2018年1月15日、30頁。ISBN 978-4-324-10388-3。
- signatureのページへのリンク