Exemplo n.º 1
0
        private static void Sign()
        {
            DigitalSig dSig    = new DigitalSig();
            string     pdfPath = @"";

            byte[] pdf = File.ReadAllBytes(pdfPath);

            SignInformation signInfo = setSignInformation();

            byte[] result = dSig.Sign(pdf, signInfo);

            string outputPath = @"";

            File.WriteAllBytes(outputPath, result);
        }
Exemplo n.º 2
0
        private static void LTVEnable()
        {
            DigitalSig dSig    = new DigitalSig();
            string     pdfPath = @"";

            byte[] pdf = File.ReadAllBytes(pdfPath);

            string     tsaUrl    = "";
            ITSAClient tsaClient = new TSAClientBouncyCastle(tsaUrl);

            byte[] result = dSig.LTVEnable(pdf, tsaClient);

            string outputPath = @"";

            File.WriteAllBytes(outputPath, result);
        }
Exemplo n.º 3
0
        private static void SignWithLTVEnable()
        {
            DigitalSig dSig    = new DigitalSig();
            string     pdfPath = @"";

            byte[]          pdf      = File.ReadAllBytes(pdfPath);
            SignInformation signInfo = setSignInformation();

            string tsaUrl = "";

            signInfo.tsaClient = new TSAClientBouncyCastle(tsaUrl);
            byte[] result = dSig.SignWithLTVEnable(pdf, signInfo);

            string outputPath = @"";

            File.WriteAllBytes(outputPath, result);
        }
Exemplo n.º 4
0
        private static void VerifyDigitalSig()
        {
            DigitalSig dSig    = new DigitalSig();
            string     pdfPath = @"";

            byte[] pdf           = File.ReadAllBytes(pdfPath);
            string signatureName = "";

            try
            {
                dSig.VerifyDigitalSig(pdf, signatureName);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }