Sertifikalı Bir VBA Kodu Projesini Dijital Olarak İmzalayın
Contents
[
Hide
]
Aspose.Cells ile VBA kodlu projenizi dijital olarak imzalayabilirsiniz.Workbook.VbaProject.Sign() yöntem. Excel dosyanızın bir sertifika ile dijital olarak imzalanıp imzalanmadığını kontrol etmek için lütfen aşağıdaki adımları izleyin.
- TıklamakVisual Basic danGeliştirici açmak için sekmeUygulamalar IDE’si için Visual Basic
- TıklamakAraçlar > Dijital imzalar… ile ilgiliUygulamalar IDE’si için Visual Basic
ve gösterecekDijital İmza Formu belgenin bir sertifika ile dijital olarak imzalanıp imzalanmadığını gösterir.
C# Sertifikalı Bir VBA Kodu Projesini Dijital Olarak İmzalayın
Aşağıdaki örnek kod, nasıl kullanılacağını gösterir.[Workbook.VbaProject.Sign()](https://reference.aspose.com/cells/java/com.aspose.cells/vbaproject#sign(com.aspose.cells.DigitalSignature)yöntem. İşte örnek kodun giriş ve çıkış dosyaları. Bu kodu test etmek için herhangi bir excel dosyasını ve herhangi bir sertifikayı kullanabilirsiniz.
- Kaynak Excel dosyası örnek kodda kullanılmıştır.
- Örnek pfx dosyası Dijital İmza oluşturmak için. Bu kodu çalıştırmak için lütfen bilgisayarınıza yükleyin. Şifresi 1234’tür.
- Çıktı Excel dosyası örnek kod tarafından oluşturulur.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
String password = "1234"; | |
String pfxPath = sourceDir + "sampleDigitallySignVbaProjectWithCertificate.pfx";; | |
String comment = "Signing Digital Signature using Aspose.Cells"; | |
// Load the certificate into an instance of InputStream | |
InputStream inStream = new FileInputStream(pfxPath); | |
// Create an instance of KeyStore with PKCS12 cryptography | |
KeyStore inputKeyStore = KeyStore.getInstance("PKCS12"); | |
// Use the KeyStore.load method to load the certificate stream and its password | |
inputKeyStore.load(inStream, password.toCharArray()); | |
inStream.close(); | |
// Create an instance of DigitalSignature and pass the instance of KeyStore, password, comments and time | |
DigitalSignature signature = new DigitalSignature(inputKeyStore, password, comment, | |
DateTime.getNow()); | |
Workbook wb = new Workbook(sourceDir + "sampleDigitallySignVbaProjectWithCertificate.xlsm"); | |
wb.getVbaProject().sign(signature); | |
wb.save(outputDir + "outputDigitallySignVbaProjectWithCertificate.xlsm"); |