Пример #1
0
        /// <summary>
        /// Deserializes the raw data into the concrete class <see cref="Psd2Attributes"/>.
        /// </summary>
        /// <returns>Deserilized contents</returns>
        public Psd2Attributes Extract()
        {
            var attributes   = new Psd2Attributes();
            var typeSequence = Value.Where(x => x is DerAsnSequence).FirstOrDefault() as DerAsnSequence;
            var roleSequence = typeSequence?.Value.Where(x => x is DerAsnSequence).FirstOrDefault() as DerAsnSequence;
            var ncaName      = typeSequence?.Value[1] as DerAsnUtf8String;
            var ncaId        = typeSequence?.Value[2] as DerAsnUtf8String;

            attributes.AuthorityName   = ncaName.Value;
            attributes.AuthorizationId = NCAId.Parse(ncaId.Value, false);
            foreach (var item in roleSequence.Value)
            {
                if (!(item is DerAsnSequence))
                {
                    continue;
                }
                var role          = item as DerAsnSequence;
                var roleOid       = role.Value[0] as DerAsnObjectIdentifier;
                var roleOidString = string.Join(".", roleOid.Value);
                switch (roleOidString)
                {
                case Oid_PSD2_Roles_PSP_AS: attributes.HasAccountServicing = true; break;

                case Oid_PSD2_Roles_PSP_PI: attributes.HasPaymentInitiation = true; break;

                case Oid_PSD2_Roles_PSP_AI: attributes.HasAccountInformation = true; break;

                case Oid_PSD2_Roles_PSP_IC: attributes.HasIssuingOfCardBasedPaymentInstruments = true; break;
                }
            }
            return(attributes);
        }
Пример #2
0
 /// <summary>
 ///  DTO encapsulating all statements found inside a <see cref="QualifiedCertificateStatementsExtension"/>
 /// </summary>
 /// <param name="isCompliant"><b>QcCompliant</b>. True is the cert is European Qualified Certificate otherwize false</param>
 /// <param name="limit"><b>QcLimitValue</b>. Monetary value </param>
 /// <param name="retentionPeriod"><b>QcRetentionPeriod</b></param>
 /// <param name="isQSCD"><b>QcSSCD</b></param>
 /// <param name="pdsLocations"><b>QcPds</b></param>
 /// <param name="type"><b>QcType</b></param>
 /// <param name="psd2"><b>PSD2 QcStatement</b></param>
 public QualifiedCertificateStatements(bool isCompliant, QcMonetaryValue limit, int retentionPeriod, bool isQSCD, IEnumerable <PdsLocation> pdsLocations, QcTypeIdentifiers type, Psd2Attributes psd2)
 {
     IsCompliant     = isCompliant;
     LimitValue      = limit;
     RetentionPeriod = retentionPeriod;
     IsQSCD          = isQSCD;
     PdsLocations    = pdsLocations.ToArray();
     Type            = type;
     Psd2Type        = psd2;
 }
Пример #3
0
        /// <summary>
        /// Constructs the QcStatement from <see cref="Psd2Attributes "/>.
        /// </summary>
        /// <param name="psd2"></param>
        public Psd2QcStatement(Psd2Attributes psd2) : base(Array.Empty <DerAsnType>())
        {
            var rolesList = new List <DerAsnSequence>();

            foreach (var roleName in psd2.Roles)
            {
                var id   = new DerAsnObjectIdentifier(DerAsnIdentifiers.Primitive.ObjectIdentifier, GetPsd2Oid(roleName).OidToArray());
                var name = new DerAsnUtf8String(roleName);
                var role = new DerAsnSequence(new DerAsnType[] { id, name });
                rolesList.Add(role);
            }
            var rolesOfPSP = new DerAsnSequence(rolesList.ToArray()); //RolesOfPSP ::= SEQUENCE OF RoleOfPSP
            var ncaName    = new DerAsnUtf8String(psd2.AuthorityName);
            var ncaId      = new DerAsnUtf8String(psd2.AuthorizationId.ToString());

            var typeSequence = new DerAsnSequence(new DerAsnType[] { rolesOfPSP, ncaName, ncaId });

            var psd2QstatementOid = new DerAsnObjectIdentifier(DerAsnIdentifiers.Primitive.ObjectIdentifier, Oid_PSD2_QcStatement.OidToArray());

            Value = new DerAsnType[] { psd2QstatementOid, typeSequence };
        }
Пример #4
0
        /// <summary>
        /// Used to create the extension from typed model
        /// </summary>
        /// <param name="isCompliant"><b>QcCompliant</b>. True is the cert is European Qualified Certificate otherwize false</param>
        /// <param name="limit"><b>QcLimitValue</b>. Monetary value </param>
        /// <param name="retentionPeriod"><b>QcRetentionPeriod</b></param>
        /// <param name="isQSCD"><b>QcSSCD</b></param>
        /// <param name="pdsLocations"><b>QcPds</b></param>
        /// <param name="type"><b>QcType</b></param>
        /// <param name="psd2"><b>PSD2 QcStatement</b></param>
        /// <param name="critical"></param>
        public QualifiedCertificateStatementsExtension(bool isCompliant, QcMonetaryValue limit, int retentionPeriod, bool isQSCD, IEnumerable <PdsLocation> pdsLocations, QcTypeIdentifiers type, Psd2Attributes psd2, bool critical)
        {
            Oid      = new Oid(Oid_QC_Statements, "Qualified Certificate Statements");
            Critical = critical;
            var statements = new List <DerAsnSequence>();

            if (isCompliant)
            {
                statements.Add(new QcComplianceStatement());
            }
            if (retentionPeriod > 0)
            {
                statements.Add(new QcRetentionPeriodStatement(retentionPeriod));
            }
            if (limit != null)
            {
                statements.Add(new QcLimitValueStatement(limit));
            }
            if (isQSCD)
            {
                statements.Add(new QcSSCDStatement());
            }
            statements.Add(new QcTypeStatement(type));
            if (pdsLocations?.Any() == true)
            {
                statements.Add(new QcPdsStatement(pdsLocations));
            }
            if (psd2 != null)
            {
                statements.Add(new Psd2QcStatement(psd2));
            }
            RawData     = DerConvert.Encode(new DerAsnSequence(statements.ToArray())).ToArray();
            _Statements = new QualifiedCertificateStatements(isCompliant, limit, retentionPeriod, isQSCD, pdsLocations, type, psd2);
            _decoded    = true;
        }