-
Notifications
You must be signed in to change notification settings - Fork 1
Description
public Signer(string temporaryFolder, string javaPath, string SignerJarPath)
{
_tempFolder = temporaryFolder;
_javaPath = javaPath;
//_jsignpdfLocation = """ + Directory.GetCurrentDirectory() + "/assets/JSignPdf-1.6.4/JSignPdf.jar" + """;
_jsignpdfLocation = SignerJarPath;
}
SignerJarPath is our custom variable defined to suit our needs
string VirtualFolderPath = Server.MapPath("SomePath");
string CertificatePath = Server.MapPath("SomePath");
if (!Directory.Exists(VirtualFolderPath))
{
Directory.CreateDirectory(VirtualFolderPath);
}
This is how we call your function, AssetFilePaths is a static class having path for Java Compiler and JSignPDFJar file
Signer _sign = new Signer(VirtualFolderPath, AssetFilePaths.Java.JavaEngine, Server.MapPath(AssetFilePaths.AssetFiles.JSignPDFJar));
string _BaseFileAsX64 = Convert.ToBase64String(System.IO.File.ReadAllBytes(fileName));
string _SignedFileAsX64 = _sign.Sign(_BaseFileAsX64, CertificatePath, "12345678", "");
return Encoding.UTF8.GetBytes(_SignedFileAsX64);