Example #1
0
        /**
         * verify that the given certificate successfully handles and confirms
         * the signature associated with this signer and, if a signingTime
         * attribute is available, that the certificate was valid at the time the
         * signature was generated.
         */
        public bool Verify(
            X509Certificate cert)
        {
            Time signingTime = GetSigningTime();

            if (signingTime != null)
            {
                cert.CheckValidity(signingTime.Date);
            }

            return(DoVerify(cert.GetPublicKey()));
        }
Example #2
0
        private Time GetSigningTime()
        {
            Asn1Object validSigningTime = GetSingleValuedSignedAttribute(
                CmsAttributes.SigningTime, "signing-time");

            if (validSigningTime == null)
            {
                return(null);
            }

            try
            {
                return(Time.GetInstance(validSigningTime));
            }
            catch (ArgumentException)
            {
                throw new CmsException("signing-time attribute value not a valid 'Time' structure");
            }
        }