SignedXml.LoadXml メソッドとは? わかりやすく解説

SignedXml.LoadXml メソッド

XML 要素から SignedXml の状態を読み込みます。

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

Public Sub LoadXml ( _
    value As XmlElement _
)
Dim instance As SignedXml
Dim value As XmlElement

instance.LoadXml(value)
public void LoadXml (
    XmlElement value
)
public:
void LoadXml (
    XmlElement^ value
)
public void LoadXml (
    XmlElement value
)
public function LoadXml (
    value : XmlElement
)

パラメータ

value

SignedXml 状態の読み込み元の XML 要素

例外例外
例外種類条件

ArgumentNullException

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

CryptographicException

value パラメータが、有効な SignatureValue プロパティ格納していません。

または

value パラメータが、有効な SignedInfo プロパティ格納していません。

使用例使用例

LoadXml メソッド使用して XML ドキュメント検証する方法次のコード例示します

' Verify the signature of an XML file and return the result.
Public Shared Function VerifyDetachedSignature(XmlSigFileName
 As String) As [Boolean]
   ' Create a new XML document.
   Dim xmlDocument As New
 XmlDocument()
   
   ' Load the passed XML file into the document.
   xmlDocument.Load(XmlSigFileName)
   
   ' Create a new SignedXMl object.
   Dim signedXml As New
 SignedXml()
   
   ' 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
// Verify the signature of an XML file and return the result.
public static Boolean VerifyDetachedSignature(string
 XmlSigFileName)
{    
    // Create a new XML document.
    XmlDocument xmlDocument = new XmlDocument();

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

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

    // 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();
}
// Verify the signature of an XML file and return the result.
Boolean VerifyDetachedSignature( String^ XmlSigFileName )
{
   
   // Create a new XML document.
   XmlDocument^ xmlDocument = gcnew XmlDocument;
   
   // Load the passed XML file into the document.
   xmlDocument->Load( XmlSigFileName );
   
   // Create a new SignedXMl object.
   SignedXml^ signedXml = gcnew SignedXml;
   
   // Find the "Signature" node and create a new
   // XmlNodeList object.
   XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature"
 );
   
   // Load the signature node.
   signedXml->LoadXml( safe_cast<XmlElement^>(nodeList->Item( 0 )) );
   
   // Check the signature and return the result.
   return signedXml->CheckSignature();
}


// Verify the signature of an XML file and return the result.
public static Boolean VerifyDetachedSignature(String
 xmlSigFileName)
{
    // Create a new XML document.
    XmlDocument xmlDocument = new XmlDocument();

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

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

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

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

    // Check the signature and return the result.
    return new Boolean(signedXml.CheckSignature());
} //VerifyDetachedSignature
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SignedXml クラス
SignedXml メンバ
System.Security.Cryptography.Xml 名前空間



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

辞書ショートカット

すべての辞書の索引

「SignedXml.LoadXml メソッド」の関連用語

SignedXml.LoadXml メソッドのお隣キーワード
検索ランキング

   

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



SignedXml.LoadXml メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS