Ejemplo n.º 1
0
        /// <summary>Because some information are stored in the profile, a profile is not Thread-safe.
        ///     </summary>
        /// <remarks>
        /// Because some information are stored in the profile, a profile is not Thread-safe. The software must create one
        /// for each request.
        /// </remarks>
        /// <returns>A new instance of signatureProfile corresponding to the parameters.</returns>
        private CAdESProfileBES GetSigningProfile(SignatureParameters parameters)
        {
            //jbonilla
            SignatureFormat signFormat = parameters.SignatureFormat;

            if (signFormat.Equals(SignatureFormat.CAdES_BES))
            {
                return(new CAdESProfileBES());
            }
            else
            {
                if (signFormat.Equals(SignatureFormat.CAdES_EPES))
                {
                    return(new CAdESProfileEPES());
                }
            }
            return(new CAdESProfileEPES());
        }
Ejemplo n.º 2
0
        private CAdESSignatureExtension GetExtensionProfile(SignatureParameters parameters
                                                            )
        {
            //jbonilla
            SignatureFormat signFormat = parameters.SignatureFormat;

            if (signFormat.Equals(SignatureFormat.CAdES_BES) || signFormat.Equals(SignatureFormat
                                                                                  .CAdES_EPES))
            {
                return(null);
            }
            else if (signFormat.Equals(SignatureFormat.CAdES_T))
            {
                CAdESProfileT extensionT = new CAdESProfileT();
                extensionT.SetSignatureTsa(TspSource);
                return(extensionT);
            }
            else if (signFormat.Equals(SignatureFormat.CAdES_C))
            {
                CAdESProfileC extensionC = new CAdESProfileC();
                extensionC.SetSignatureTsa(TspSource);
                extensionC.SetCertificateVerifier(Verifier);
                return(extensionC);
            }
            else if (signFormat.Equals(SignatureFormat.CAdES_X))
            {
                CAdESProfileX extensionX = new CAdESProfileX();
                extensionX.SetSignatureTsa(TspSource);
                extensionX.SetExtendedValidationType(1);
                extensionX.SetCertificateVerifier(Verifier);
                return(extensionX);
            }
            else if (signFormat.Equals(SignatureFormat.CAdES_XL))
            {
                CAdESProfileXL extensionXL = new CAdESProfileXL();
                extensionXL.SetSignatureTsa(TspSource);
                extensionXL.SetExtendedValidationType(1);
                extensionXL.SetCertificateVerifier(Verifier);
                return(extensionXL);
            }
            else if (signFormat.Equals(SignatureFormat.CAdES_A))
            {
                CAdESProfileA extensionA = new CAdESProfileA();
                extensionA.SetSignatureTsa(TspSource);
                extensionA.SetCertificateVerifier(Verifier);
                extensionA.SetExtendedValidationType(1);
                return(extensionA);
            }

            throw new ArgumentException("Unsupported signature format " + parameters.SignatureFormat);
        }
Ejemplo n.º 3
0
        private SignatureExtension GetExtensionProfile(SignatureParameters parameters)
        {
            //jbonilla
            SignatureFormat signFormat = parameters.SignatureFormat;

            if (signFormat.Equals(SignatureFormat.XAdES_BES) || signFormat.Equals(SignatureFormat
                                                                                  .XAdES_EPES))
            {
                return(null);
            }
            else if (signFormat.Equals(SignatureFormat.XAdES_T))
            {
                XAdESProfileT extensionT = new XAdESProfileT();
                extensionT.SetTspSource(TspSource);
                return(extensionT);
            }
            else if (signFormat.Equals(SignatureFormat.XAdES_C))
            {
                XAdESProfileC extensionC = new XAdESProfileC();
                extensionC.SetTspSource(TspSource);
                extensionC.SetCertificateVerifier(Verifier);
                return(extensionC);
            }
            else if (signFormat.Equals(SignatureFormat.XAdES_X))
            {
                XAdESProfileX extensionX = new XAdESProfileX();
                extensionX.SetTspSource(TspSource);
                extensionX.SetCertificateVerifier(Verifier);
                return(extensionX);
            }
            else if (signFormat.Equals(SignatureFormat.XAdES_XL))
            {
                XAdESProfileXL extensionXL = new XAdESProfileXL();
                extensionXL.SetTspSource(TspSource);
                extensionXL.SetCertificateVerifier(Verifier);
                return(extensionXL);
            }
            //                else
            //                {
            //                    if (signFormat.Equals(SignatureFormat.XAdES_A))
            //                    {
            //                        throw new NotImplementedException();
            //                        //XAdESProfileA extensionA = new XAdESProfileA();
            //                        //extensionA.SetTspSource(tspSource);
            //                        //extensionA.SetCertificateVerifier(certificateVerifier);
            //                        //return extensionA;
            //                    }
            //                }
            //            }
            //        }
            //    }
            //}
            throw new ArgumentException("Unsupported signature format " + parameters.SignatureFormat);
        }
Ejemplo n.º 4
0
        private XAdESProfileBES GetSigningProfile(SignatureParameters parameters)
        {
            //jbonilla
            SignatureFormat signFormat = parameters.SignatureFormat;

            if (signFormat.Equals(SignatureFormat.XAdES_BES))
            {
                return(new XAdESProfileBES());
            }
            //else
            //{
            //    if (signFormat.Equals(SignatureFormat.XAdES_EPES))
            //    {
            //        return new XAdESProfileEPES();
            //    }
            //}
            //TODO jbonilla EPES?
            return(new XAdESProfileBES());
        }