Example #1
0
        public byte[] P7xTimeStampDocument(bool InfoCamereFormat, string FileName, byte[] blobIn)
        {
            string ErrS;
            int    ceHndl, ErrI, idTsProv = 0;

            CCypher.enumErrorClass errC;

            oDigest.P7xNew(out ceHndl);
            oDigest.P7xContentWriteFromBuf(ceHndl, (object)blobIn, FileName);
            oDigest.GetLastError(out errC, out ErrI, out ErrS);
            if (ErrS.Length > 0)
            {
                throw new Exception(ErrS);
            }

            oDigest.P7xSetFormat(ceHndl,
                                 InfoCamereFormat ? CCypher.enumP7xFormatType.p7xDike : CCypher.enumP7xFormatType.p7xDigitalSign,
                                 false, false);
            oDigest.GetLastError(out errC, out ErrI, out ErrS);
            if (ErrS.Length > 0)
            {
                throw new Exception(ErrS);
            }

            oDigest.P7xAddTS(ceHndl, idTsProv);
            oDigest.GetLastError(out errC, out ErrI, out ErrS);
            if (ErrS.Length > 0)
            {
                throw new Exception(ErrS);
            }

            object OutBuf;// = new object();

            oDigest.P7xSaveToBuf(ceHndl, out OutBuf);
            oDigest.GetLastError(out errC, out ErrI, out ErrS);
            if (ErrS.Length > 0)
            {
                throw new Exception(ErrS);
            }

            return((byte[])OutBuf);
        }