XmlDsigEnvelopedSignatureTransform コンストラクタ ()とは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > XmlDsigEnvelopedSignatureTransform コンストラクタ ()の意味・解説 

XmlDsigEnvelopedSignatureTransform コンストラクタ ()

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

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

Dim instance As New XmlDsigEnvelopedSignatureTransform
public XmlDsigEnvelopedSignatureTransform ()
public:
XmlDsigEnvelopedSignatureTransform ()
public XmlDsigEnvelopedSignatureTransform ()
public function XmlDsigEnvelopedSignatureTransform
 ()
使用例使用例

XmlDsigEnvelopedSignatureTransform クラスメンバ使用する方法次のコード例示します

' Sign an XML file and save the signature in a new file.
Public Shared Sub SignXmlFile(FileName
 As String, SignedFileName As
 String, Key As RSA)
   ' 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
   
   ' Create a reference to be signed.
   Dim reference As New
 Reference()
   reference.Uri = ""
   
   ' Add an enveloped transformation to the reference.
   Dim env As New XmlDsigEnvelopedSignatureTransform()
   reference.AddTransform(env)
   
   ' Add the reference to the SignedXml object.
   signedXml.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)))
   signedXml.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 
// Sign an XML file and save the signature in a new file.
public static void SignXmlFile(string
 FileName, string SignedFileName, RSA 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;

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

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

    // Add the reference to the SignedXml object.
    signedXml.AddReference(reference);

    
    // Add an RSAKeyValue KeyInfo (optional; helps recipient find key
 to validate).
    KeyInfo keyInfo = new KeyInfo();
    keyInfo.AddClause(new RSAKeyValue((RSA)Key));
    signedXml.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();
}
// Sign an XML file and save the signature in a new file.
void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^
 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 its 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;
   
   // Create a reference to be signed.
   Reference^ reference = gcnew Reference;
   reference->Uri = "";
   
   // Add an enveloped transformation to the reference.
   XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform;
   reference->AddTransform( env );
   
   // Add the reference to the SignedXml object.
   signedXml->AddReference( reference );
   
   // Add an RSAKeyValue KeyInfo (optional; helps recipient find key
 to validate).
   KeyInfo^ keyInfo = gcnew KeyInfo;
   keyInfo->AddClause( gcnew RSAKeyValue( safe_cast<RSA^>(Key) ) );
   signedXml->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)->GetType() == XmlDeclaration::typeid
 )
   {
      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();
}


// Sign an XML file and save the signature in a new file.
public static void SignXmlFile(String
 fileName, String signedFileName, 
    RSA key)
{
    // Create a new XML document.
    XmlDocument doc = new XmlDocument();

    // Format the document to ignore white spaces.
    doc.set_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.set_SigningKey(key);

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

    // Add a transformation to the reference.
    Transform trns = new XmlDsigC14NTransform();

    reference.AddTransform(trns);

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

    // Add the reference to the SignedXml object.
    signedXml.AddReference(reference);

    // Add an RSAKeyValue KeyInfo (optional; helps recipient 
    // find key to validate).
    KeyInfo keyInfo = new KeyInfo();
    keyInfo.AddClause(new RSAKeyValue(((RSA)(key))));
    signedXml.set_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.get_DocumentElement().AppendChild(doc.ImportNode(
        xmlDigitalSignature, true));
    if (doc.get_FirstChild() instanceof XmlDeclaration) {
        doc.RemoveChild(doc.get_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();
} //SignXmlFile   
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
XmlDsigEnvelopedSignatureTransform クラス
XmlDsigEnvelopedSignatureTransform メンバ
System.Security.Cryptography.Xml 名前空間

XmlDsigEnvelopedSignatureTransform コンストラクタ

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

名前 説明
XmlDsigEnvelopedSignatureTransform () XmlDsigEnvelopedSignatureTransform クラス新しインスタンス初期化します。
XmlDsigEnvelopedSignatureTransform (Boolean) コメント指定されている場合は、そのコメントを持つ XmlDsigEnvelopedSignatureTransform クラス新しインスタンス初期化します。
参照参照

関連項目

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

XmlDsigEnvelopedSignatureTransform コンストラクタ (Boolean)

コメント指定されている場合は、そのコメントを持つ XmlDsigEnvelopedSignatureTransform クラス新しインスタンス初期化します。

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

Public Sub New ( _
    includeComments As Boolean _
)
Dim includeComments As Boolean

Dim instance As New XmlDsigEnvelopedSignatureTransform(includeComments)
public XmlDsigEnvelopedSignatureTransform (
    bool includeComments
)
public:
XmlDsigEnvelopedSignatureTransform (
    bool includeComments
)
public XmlDsigEnvelopedSignatureTransform (
    boolean includeComments
)
public function XmlDsigEnvelopedSignatureTransform
 (
    includeComments : boolean
)

パラメータ

includeComments

コメント含め場合trueそれ以外場合false

使用例使用例

XmlDsigEnvelopedSignatureTransform コンストラクタBoolean 値に true指定してコメント追加する方法次のコード例示します。このコード例は、XmlDsigEnvelopedSignatureTransform クラストピック取り上げているコード例一部分です。

Dim IncludeComments As Boolean
 = True
' This transform is created for demonstration purposes.
Dim secondTransform As _
    New XmlDsigEnvelopedSignatureTransform(IncludeComments)
bool IncludeComments = true;
// This transform is created for demonstration purposes.
XmlDsigEnvelopedSignatureTransform secondTransform =
    new XmlDsigEnvelopedSignatureTransform(IncludeComments);
bool IncludeComments = true;
// This transform is created for demonstration purposes.
XmlDsigEnvelopedSignatureTransform^ secondTransform =
    gcnew XmlDsigEnvelopedSignatureTransform(IncludeComments);
boolean includeComments = true;
// This transform is created for demonstration purposes.
XmlDsigEnvelopedSignatureTransform secondTransform 
    = new XmlDsigEnvelopedSignatureTransform(includeComments);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
XmlDsigEnvelopedSignatureTransform クラス
XmlDsigEnvelopedSignatureTransform メンバ
System.Security.Cryptography.Xml 名前空間


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

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

辞書ショートカット

すべての辞書の索引

「XmlDsigEnvelopedSignatureTransform コンストラクタ ()」の関連用語

XmlDsigEnvelopedSignatureTransform コンストラクタ ()のお隣キーワード
検索ランキング

   

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



XmlDsigEnvelopedSignatureTransform コンストラクタ ()のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS