Exemple #1
0
        public void StoreCapkRow(int acqNumber, int recNumber, byte[] rid, int capkIndex, int expLen, byte[] exp, int modLen, byte[] mod, bool hasChecksum, byte[] checksum)
        {
            CapkEntry entry = new CapkEntry {
                AcquirerNumber = acqNumber,
                RecordIndex    = recNumber,

                Rid         = Encoding.ASCII.GetString(rid, 0, 10),
                PublicKeyId = capkIndex,
                Exponent    = Encoding.ASCII.GetString(exp, 0, expLen * 2),
                Modulus     = Encoding.ASCII.GetString(mod, 0, modLen * 2),
                Checksum    = hasChecksum ? Encoding.ASCII.GetString(checksum, 0, 40) : null
            };

            db.Insert(entry);
        }
                public Capk(CapkEntry e)
                {
                    IsAid          = false;
                    AcquirerNumber = e.AcquirerNumber;
                    RecordIndex    = e.RecordIndex;

                    Rid             = GetBytes(e.Rid, 10);
                    CapkIndex       = e.PublicKeyId;
                    Exponent        = GetBytes(e.Exponent, 6, out ExponentLength);
                    ExponentLength /= 2;
                    Modulus         = GetBytes(e.Modulus, 496, out ModulusLength);
                    ModulusLength  /= 2;
                    HasChecksum     = e.Checksum != null;

                    if (HasChecksum)
                    {
                        Checksum = GetBytes(e.Checksum, 40);
                    }
                    else
                    {
                        Checksum = GetHexBytes("", 40);
                    }
                }