/// <summary>
        /// When overridden in a descendant class, deserializes the object from an XML according to Aadhaar API specification.
        /// </summary>
        /// <param name="element">An instance of <see cref="XElement"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="element"/> is null.</exception>
        protected override void DeserializeXml(XElement element)
        {
            ValidateNull(element, nameof(element));

            IsAuthentic  = element.Attribute("ret").Value[0] == AadhaarHelper.YesUpper;
            ResponseCode = element.Attribute("code").Value;
            Timestamp    = DateTimeOffset.Parse(element.Attribute("ts").Value, CultureInfo.InvariantCulture);
            ErrorCode    = element.Attribute("err")?.Value;

            if (!string.IsNullOrWhiteSpace(ErrorCode))
            {
                return;
            }

            IsDecryptionByKsa = element.Attribute("ko").Value == "KSA";
            if (!IsDecryptionByKsa)
            {
                var encryptedKycInfo = new EncryptedKycInfo {
                    InfoValue = Convert.FromBase64String(element.Element("kycRes").Value)
                };
                var decryptedKycInfo = encryptedKycInfo.Decrypt(Decryptor);
                element = decryptedKycInfo.ToXml();
            }

            var authBytes = Convert.FromBase64String(element.Element("Rar").Value);

            using (var stream = new MemoryStream(authBytes))
                base.DeserializeXml(XElement.Load(stream));

            TimeToLive = DateTimeOffset.ParseExact(element.Attribute("ttl").Value, AadhaarHelper.TimestampFormat, CultureInfo.InvariantCulture);

            var uidData = element.Element("UidData");

            Resident = new PersonalInfo
            {
                AadhaarNumber = uidData.Attribute("uid").Value,
                Demographic   = new Demographic
                {
                    Address  = new Address(uidData.Element("Poa")),
                    Identity = new Identity(uidData.Element("Poi"))
                },
                Photo = Convert.FromBase64String(uidData.Element("Pht").Value)
            };
            var localAddress = uidData.Element("LData");

            if (localAddress != null)
            {
                Resident.Demographic.ILAddress    = new Address(localAddress);
                Resident.Demographic.LanguageUsed = (IndianLanguage?)int.Parse(localAddress.Attribute("lang").Value);
            }
            EAadhaar = new AadhaarDocument {
                Content = uidData.Element("Prn").Value
            };
        }