다음을 통해 공유


Package.LoadUserCertificateByHash 메서드

Loads the certificate for the package according to the certificate hash.

네임스페이스:  Microsoft.SqlServer.Dts.Runtime
어셈블리:  Microsoft.SqlServer.ManagedDTS(Microsoft.SqlServer.ManagedDTS.dll)

구문

‘선언
Public Sub LoadUserCertificateByHash ( _
    certHash As Byte() _
)
‘사용 방법
Dim instance As Package 
Dim certHash As Byte()

instance.LoadUserCertificateByHash(certHash)
public void LoadUserCertificateByHash(
    byte[] certHash
)
public:
void LoadUserCertificateByHash(
    array<unsigned char>^ certHash
)
member LoadUserCertificateByHash : 
        certHash:byte[] -> unit
public function LoadUserCertificateByHash(
    certHash : byte[]
)

매개 변수

  • certHash
    유형: array<System.Byte[]
    A byte array that contains the hash of the certificate for the package.

주의

To obtain the byte hash code of a certificate, you can use the X509Certificate.GetCertHash Method from the System.Security.Cryptography.X509Certificates namespace.

The following code example shows the syntax to load a user certificate using the certificate hash.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;

namespace Package_API
{
    class Program
    {
        static void Main(string[] args)
        {
            Application app = new Application();
            Package pkg = new Package();

            pkg.Name = ("Cool Test on Loading Certificates");
            pkg.LoadUserCertificateByName("\"VeriSign, Inc.\", VeriSign Trust Network, \"www.verisign.com/repository/RPA Incorp. by Ref.,LIAB.LTD(c)98\", Persona Not Validated, Digital ID Class 1 - Microsoft, <name>, <alias>");
        
    pkg.LoadUserCertificateByHash(pkg.CertificateObject.GetCertHash());

            // Save signed package  to change_this.dtsx
            app.SaveToXml("change_this.dtxs", pkg, null);
            app.CheckSignatureOnLoad = false;
            pkg = app.LoadPackage("change_this.dtxs", null);
            DTSSignatureStatus dss = pkg.CheckSignature();
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime

Class Program
    Shared Sub Main(ByVal args() As String) 
        Dim app As New Application()
        Dim pkg As New Package()

        pkg.Name = "Cool Test on Loading Certificates"
        pkg.LoadUserCertificateByName("""VeriSign, Inc."", VeriSign Trust Network, ""www.verisign.com/repository/RPA Incorp. by Ref.,LIAB.LTD(c)98"", Persona Not Validated, Digital ID Class 1 - Microsoft, <name>, <alias>")

        pkg.LoadUserCertificateByHash(
            pkg.CertificateObject.GetCertHash())

        ' Save signed package  to change_this.dtsx
        app.SaveToXml("change_this.dtxs", pkg, Nothing)
        app.CheckSignatureOnLoad = False
        pkg = app.LoadPackage("change_this.dtxs", Nothing)
        Dim dss As DTSSignatureStatus = pkg.CheckSignature()
    End Sub
End Class

참고 항목

참조

Package 클래스

Microsoft.SqlServer.Dts.Runtime 네임스페이스