<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alen IBRIC on Medium]]></title>
        <description><![CDATA[Stories by Alen IBRIC on Medium]]></description>
        <link>https://medium.com/@alenibric?source=rss-ee1b144a9dd2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tC28Cke64CsqdlaC7_IrUQ.jpeg</url>
            <title>Stories by Alen IBRIC on Medium</title>
            <link>https://medium.com/@alenibric?source=rss-ee1b144a9dd2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:30:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alenibric/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Developer’s Survival Kit in the AI Era: Are We Still Writing Code, or Are We Becoming Something…]]></title>
            <link>https://alenibric.medium.com/the-developers-survival-kit-in-the-ai-era-are-we-still-writing-code-or-are-we-becoming-something-a888af574159?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a888af574159</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[developer-experience]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[futureof-work]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Fri, 20 Nov 2026 13:35:26 GMT</pubDate>
            <atom:updated>2026-11-20T13:35:26.143Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Developer’s Survival Kit in the AI Era: Are We Still Writing Code, or Are We Becoming Something Else?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s_v0Jwg_EJynQYSMX1mOTQ.png" /></figure><p><em>My thoughts on AI, software development, and what really matters for developers in the coming years.</em></p><p>I’ve been working in software development for years, and I have seen quite a few changes in this industry. New programming languages, new frameworks, new architectures, new tools. Every few years, something comes along that promises to change the way we develop software.</p><p>Some technologies disappear after a few years. Others become part of our daily work.</p><p>But I think what we are experiencing with artificial intelligence is different.</p><p>AI is not just another framework or development tool. It is changing how we approach problems, how we write code, how we debug applications, and even how we think about software architecture.</p><p>And I believe we are still at the beginning.</p><p>Recently, I came across a discussion about the “Developer’s Survival Kit in the AI Era.” It raised a question that I think every software developer should seriously consider:</p><p><strong>What skills should we invest in while AI is changing software development so quickly?</strong></p><p>I wanted to share some of my own thoughts, based on my experience as a developer and what I have been seeing while working with AI tools.</p><h3>Writing Code Is No Longer the Hardest Part</h3><p>When I started developing software, writing code was a significant part of the job.</p><p>You needed to understand the language, remember syntax, know which libraries to use, and spend time researching solutions.</p><p>Sometimes you could spend hours trying to understand why a particular function wasn’t working.</p><p>Today, I can describe a problem to an AI assistant and get a working example within seconds.</p><p>I can ask it to generate a REST API, write SQL queries, create frontend components, suggest database structures, or explain an unfamiliar codebase.</p><p>And in many cases, the generated code is actually quite good.</p><p>This is impressive, but it also raises an interesting question.</p><p>If AI can write so much code, what exactly is the developer’s role?</p><p>For me, the answer is becoming clearer.</p><p><strong>The real value of a developer is not simply writing code. It is understanding the problem and knowing how to solve it correctly.</strong></p><p>There is a big difference between generating code that works and developing a system that works reliably in a real environment.</p><p>Anyone who has maintained a production application knows this.</p><p>A simple feature can involve database changes, security considerations, existing business rules, integrations, deployment processes, and unexpected user behavior.</p><p>AI can help with all of these things, but somebody still needs to understand how everything fits together.</p><p>That somebody is the developer.</p><h3>AI Makes Development Faster, but Not Necessarily Better</h3><p>I use AI tools in development, and I genuinely enjoy working with them.</p><p>They save time.</p><p>Sometimes a lot of time.</p><p>Tasks that previously required hours of research can now be completed much faster.</p><p>I can explore different solutions, generate prototypes, review code, and investigate errors without constantly switching between documentation pages and search results.</p><p>But I have also noticed something important.</p><p><strong>AI can produce incorrect code with the same confidence as correct code.</strong></p><p>It may generate a solution that looks perfect but introduces a security issue.</p><p>It may suggest a database query that works with a small dataset but performs terribly with millions of records.</p><p>It may change existing functionality while trying to fix something unrelated.</p><p>And sometimes it simply misunderstands the business requirement.</p><p>This is why I don’t think developers should blindly accept AI-generated code.</p><p>I prefer treating AI as a very capable assistant, not as someone who should make every technical decision.</p><p>I can ask AI to write a function, but I still need to understand what that function does.</p><p>I can ask AI to optimize a query, but I still need to check the execution plan and actual performance.</p><p>I can ask AI to modify an application, but I still need to test whether the changes affect other parts of the system.</p><p>The faster we generate code, the more important it becomes to verify what we generate.</p><p>Otherwise, we are simply producing technical debt at a much higher speed.</p><h3>Software Architecture Will Become Even More Important</h3><p>One area where I believe experienced developers will continue to have a major advantage is software architecture.</p><p>Creating a simple application with AI is becoming easier every day.</p><p>But building a system that needs to operate for years is a different story.</p><p>Think about an application used by hundreds or thousands of people.</p><p>It needs authentication, authorization, logging, monitoring, database management, integrations, backups, and reliable deployment processes.</p><p>It also needs to evolve.</p><p>Business requirements change. New integrations are introduced. Old systems need to be replaced. Security requirements become stricter.</p><p>In these situations, the challenge is rarely just writing another controller or creating another database table.</p><p>The real challenge is making good technical decisions.</p><p>Should we use a monolithic architecture or separate services?</p><p>How should different applications communicate?</p><p>Where should business logic live?</p><p>How do we handle failures?</p><p>How do we maintain compatibility with existing systems?</p><p>What happens when the database becomes a bottleneck?</p><p>AI can provide recommendations, and sometimes excellent ones.</p><p>But those recommendations need context.</p><p>An architecture that works perfectly for one company might be completely unnecessary or even harmful for another.</p><p>I believe understanding architecture, databases, networking, security, and system integration will become more valuable, not less.</p><h3>The Danger of Becoming Too Dependent on AI</h3><p>There is another side to this transformation that I think we should talk about more often.</p><p>Developers are becoming increasingly dependent on AI tools.</p><p>And I include myself in this discussion.</p><p>When you know that AI can generate a solution in seconds, it becomes tempting to stop investigating problems yourself.</p><p>Why spend thirty minutes debugging something when an AI assistant might fix it immediately?</p><p>The problem is that debugging is not only about fixing errors.</p><p>It is also how we learn.</p><p>When we investigate an issue, we discover how systems behave. We understand dependencies, identify design weaknesses, and improve our technical knowledge.</p><p>If we always skip that process, we may become faster at producing software but weaker at understanding it.</p><p>Imagine a developer who can generate an entire application using AI but cannot explain how authentication works, why a database transaction fails, or what happens when two processes update the same record.</p><p>That is a dangerous situation.</p><p>Not because AI is bad, but because the developer has lost control of the technology.</p><p>I think we need to find a balance.</p><p>Use AI to accelerate development, absolutely.</p><p>But don’t stop learning how things work.</p><p>Sometimes it is worth reading the generated code carefully, investigating an error manually, or implementing a small component yourself.</p><p>Not because AI cannot do it.</p><p>Because understanding is still our responsibility.</p><h3>Developers Need to Learn How to Work With AI</h3><p>I don’t believe ignoring AI is a realistic option anymore.</p><p>Some developers still see AI coding assistants as a threat or as tools that produce low-quality code.</p><p>And yes, there are legitimate concerns.</p><p>But refusing to use AI completely reminds me of developers who once refused to use modern frameworks, version control systems, or automated testing tools.</p><p>Technology moves forward whether we like it or not.</p><p>The important question is how we adapt.</p><p>For me, learning to work with AI involves more than writing prompts.</p><p>It means understanding how to break a complex task into smaller pieces.</p><p>It means providing the right context.</p><p>It means explaining requirements clearly.</p><p>It means reviewing results instead of accepting everything automatically.</p><p>And perhaps most importantly, it means knowing when AI is useful and when traditional engineering methods are more appropriate.</p><p>I have noticed that AI works much better when the developer already understands the problem.</p><p>If you give vague instructions, you often get vague solutions.</p><p>If you explain the architecture, business rules, constraints, and expected behavior, the results improve significantly.</p><p>In other words, good engineering knowledge makes AI more useful.</p><p>AI doesn’t eliminate the need for technical expertise. It actually increases the value of knowing what to ask.</p><h3>What About Junior Developers?</h3><p>This is probably one of the questions that concerns me the most.</p><p>How will new developers gain experience if AI handles many of the tasks that traditionally helped juniors learn?</p><p>In the past, junior developers often started with relatively simple assignments.</p><p>Creating forms, writing basic SQL queries, fixing small bugs, implementing CRUD operations, or adding simple features.</p><p>These tasks helped them understand real applications.</p><p>Today, AI can perform many of them very quickly.</p><p>From a productivity perspective, this is excellent.</p><p>But from a learning perspective, we need to be careful.</p><p>If junior developers only learn how to request code from AI, they may struggle when something goes wrong.</p><p>They need to understand programming fundamentals, data structures, algorithms, databases, HTTP, APIs, and basic security principles.</p><p>They also need experience reading existing code, not just generating new code.</p><p>I don’t think junior developers should avoid AI.</p><p>Actually, AI can be an excellent learning tool.</p><p>They can ask why a solution works, request alternative implementations, explore unfamiliar technologies, and understand complex concepts much faster.</p><p>But there is a difference between using AI to learn programming and using AI to avoid learning programming.</p><p>That difference will matter.</p><h3>Security and Production Experience Cannot Be Ignored</h3><p>One thing that becomes very clear when working with real production systems is that a successful build does not mean a successful application.</p><p>The code compiles.</p><p>The tests pass.</p><p>The application starts.</p><p>Everything looks fine.</p><p>Then the application is deployed, and suddenly something unexpected happens.</p><p>A configuration is missing.</p><p>A database connection behaves differently.</p><p>An authentication token expires.</p><p>A background process fails.</p><p>A permission issue appears.</p><p>Or an integration works in development but fails in production.</p><p>These are not theoretical problems.</p><p>They are normal parts of software engineering.</p><p>AI can help diagnose them, but understanding the environment is essential.</p><p>This is why I believe developers should invest more time in areas such as deployment, infrastructure, monitoring, application security, database performance, and troubleshooting.</p><p>Knowing how to generate an application is useful.</p><p>Knowing how to keep that application running reliably is much more valuable.</p><p>And as AI makes it easier to create applications, I suspect we will see even more software being deployed by people who don’t fully understand these operational responsibilities.</p><p>That could create a completely different set of problems.</p><h3>We Should Stop Measuring Developers by Lines of Code</h3><p>For years, developers have sometimes been evaluated by how much code they produce.</p><p>I never thought this was a particularly good measurement.</p><p>A developer who writes 500 lines of code is not necessarily more productive than someone who solves the same problem with 50 lines.</p><p>With AI, this becomes even more obvious.</p><p>Generating thousands of lines of code is no longer difficult.</p><p>But does that code solve the actual business problem?</p><p>Is it maintainable?</p><p>Is it secure?</p><p>Can another developer understand it six months later?</p><p>Will it still work when the number of users increases?</p><p>These questions are much more important than the amount of code produced.</p><p>I think the industry needs to focus more on outcomes rather than output.</p><p>A good developer is not someone who writes the most code.</p><p>A good developer is someone who consistently delivers reliable solutions to real problems.</p><p>Sometimes that means writing code.</p><p>Sometimes it means deleting unnecessary code.</p><p>And sometimes it means deciding that a new feature should not be developed at all.</p><p>AI doesn’t change that principle.</p><p>It makes it even more important.</p><h3>My Personal Approach to AI-Assisted Development</h3><p>I don’t see AI as a replacement for my development experience.</p><p>I see it as a way to make that experience more productive.</p><p>When I work on an application, I want AI to help me with repetitive tasks, suggest alternative solutions, review implementations, and accelerate debugging.</p><p>But I still want to understand the architecture.</p><p>I still want control over database changes.</p><p>I still want to know how authentication and authorization are implemented.</p><p>I still want to understand what happens when something fails.</p><p>And I definitely want to review important changes before deploying them to production.</p><p>I also think AI creates opportunities to experiment with technologies that we might otherwise not have enough time to explore.</p><p>A developer who mainly works with backend technologies can now build frontend prototypes much faster.</p><p>Someone experienced in traditional enterprise applications can experiment with mobile development, local AI models, automation, or completely different programming languages.</p><p>I find this part particularly exciting.</p><p>AI makes experimentation cheaper.</p><p>Ideas that previously required weeks of development can sometimes be tested in a few days.</p><p>But again, there is a difference between creating a prototype and maintaining a real product.</p><p>We should not confuse the two.</p><h3>So, What Should Developers Actually Learn?</h3><p>If I had to decide where to invest my time over the next few years, I would focus on a combination of traditional engineering skills and newer AI-related capabilities.</p><p>First, I would continue strengthening software engineering fundamentals.</p><p>Programming languages will evolve. Frameworks will change. AI models will improve.</p><p>But understanding algorithms, databases, concurrency, networking, security, and system design will remain useful.</p><p>Second, I would invest more time in architecture and integration.</p><p>Modern applications rarely operate independently. They communicate with databases, APIs, identity providers, cloud services, and legacy systems.</p><p>Understanding these connections is essential.</p><p>Third, I would learn how AI systems actually work.</p><p>Not necessarily at the level of training large language models from scratch, but enough to understand their limitations, context windows, embeddings, retrieval-augmented generation, tool calling, and the security implications of integrating AI into applications.</p><p>Fourth, I would improve my ability to understand business requirements.</p><p>This is something that is often underestimated.</p><p>A technically perfect solution to the wrong problem is still the wrong solution.</p><p>Developers who can communicate with users, understand workflows, identify real requirements, and translate them into reliable systems will remain valuable.</p><p>Finally, I would keep experimenting.</p><p>I don’t think anyone can predict exactly what software development will look like five years from now.</p><p>The tools are changing too quickly.</p><p>But developers who remain curious and continue learning will have a much better chance of adapting.</p><h3>Will AI Replace Software Developers?</h3><p>I see this question almost every day.</p><p>Some people believe AI will replace most developers.</p><p>Others believe nothing significant will change.</p><p>I don’t agree with either extreme.</p><p>I think AI will change the software development profession significantly.</p><p>Some tasks will become automated.</p><p>Some roles will change.</p><p>Some types of development work may require fewer people.</p><p>And new roles will probably appear.</p><p>We should not pretend that there will be no impact on employment or the job market.</p><p>There will be.</p><p>But I also don’t believe that software engineering can be reduced to generating source code.</p><p>Real software development involves understanding people, processes, infrastructure, business constraints, technical limitations, and long-term maintenance.</p><p>These are complex responsibilities.</p><p>AI will become increasingly capable of handling parts of them, but the need for engineering judgment will not disappear overnight.</p><p>What concerns me more is not whether AI can write better code than a developer.</p><p>It is whether developers will continue developing their own judgment while relying more heavily on AI.</p><p>Because that judgment is what allows us to recognize when a solution is wrong, even when it looks convincing.</p><h3>Final Thoughts</h3><p>I have been in software development long enough to know that our industry never stops changing.</p><p>We have adapted to new languages, frameworks, architectures, development methodologies, and infrastructure technologies.</p><p>AI is another transformation, although probably a much bigger one than most of the changes we have experienced before.</p><p>Personally, I am optimistic.</p><p>I enjoy using AI tools. I enjoy experimenting with new technologies. And I appreciate being able to spend less time on repetitive coding tasks and more time thinking about solutions.</p><p>But I also believe we need to be realistic.</p><p>AI-generated code is not automatically good code.</p><p>Faster development is not automatically better development.</p><p>And knowing how to use an AI coding assistant is not the same as understanding software engineering.</p><p>For developers, I think the best strategy is neither to resist AI nor to depend on it completely.</p><p>It is to combine AI capabilities with strong technical fundamentals, practical experience, and good judgment.</p><p>We should use AI to become better developers, not simply faster code generators.</p><p><strong>My biggest concern is not that AI will eventually write most of our code. It is that we might reach a point where we no longer understand the code we are responsible for.</strong></p><p>And that is something we should avoid.</p><p>The future of software development will certainly look different.</p><p>But as long as there are real problems to solve, complex systems to maintain, and difficult technical decisions to make, there will still be a need for people who understand how software actually works.</p><p>Maybe we will write less code ourselves.</p><p>Maybe we will spend more time reviewing, designing, integrating, and making decisions.</p><p>And maybe that is not necessarily a bad thing.</p><p>After all, we became software developers to solve problems.</p><p>Not just to type code.</p><p><em>These are my personal thoughts based on my experience working with software systems and experimenting with AI-assisted development. I’m interested in hearing how other developers see this transformation.</em></p><p><strong>Are AI tools making us better software engineers, or are we slowly becoming too dependent on them?</strong></p><p>#SoftwareDevelopment #ArtificialIntelligence #SoftwareEngineering #AI #Programming #DeveloperExperience #SystemArchitecture #FutureOfWork</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a888af574159" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VCL component for reading UID from ACS / ACR contactless readers on Windows]]></title>
            <link>https://alenibric.medium.com/vcl-component-for-reading-uid-from-acs-acr-contactless-readers-on-windows-fe7d2d21e06f?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe7d2d21e06f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[pascal]]></category>
            <category><![CDATA[delphi]]></category>
            <category><![CDATA[inovation]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Tue, 08 Sep 2026 13:11:35 GMT</pubDate>
            <atom:updated>2026-09-08T13:13:07.252Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fpoY3f9vrVED6BRMN6Xk4Q.png" /></figure><p>It talks to the Windows Smart Card API (winscard.dll / PC/SC).</p><p>UID is requested with the PC/SC Escape APDU used by ACS readers:</p><pre>FF CA 00 00 Le</pre><p>Le is 04 for 4-byte UIDs and 07 for 7-byte UIDs.</p><p>ComponentTDFACSReaderPaletteDF ACSPlatformsVCL Win32 / Win64Website<a href="https://delphifan.com/">delphifan.com</a>Email<a href="/service/mailto:adsdelphi@gmail.com">adsdelphi@gmail.com</a></p><h3>Requirements</h3><ul><li>Delphi 10.3 Rio or later</li><li>Windows Smart Card service running</li><li>ACS / ACR (or other PC/SC) reader driver installed</li><li>Reader plugged in</li></ul><h3>Folder layout</h3><pre>Delphi/<br>  Source/<br>    DFWinSCard.pas          WinSCard API<br>    DFACSReader.pas         TDFACSReader<br>    DFACSReaderReg.pas      palette registration<br>    DFACSReader.dpk         optional runtime package<br>    dclDFACSReader.dpk      design-time package (Install)<br>  Demo/<br>    DFACSReaderDemo.dpr     VCL demo<br>    uMain.pas / uMain.dfm<br>  DFACSReader.groupproj<br>  README.md</pre><h3>Install on the Tool Palette</h3><p>The component appears next to other VCL controls only after the design-time package is installed.</p><ol><li>Open Source\dclDFACSReader.dpk in Delphi.</li><li>Right-click the package → Install.</li><li>Open a VCL form.</li><li>Open the Tool Palette and find the DF ACS category, or search for DFACSReader.</li><li>Drop TDFACSReader on the form.</li></ol><p>If the category is missing: Component → Install Packages, confirm dclDFACSReader is checked.</p><p>Installing the demo project from source does not register the palette item. Palette registration comes only from Install.</p><h3>Quick start</h3><pre>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>  ACSReader.LoadReaders(cbxReaders.Items, True);<br>  ACSReader.ReadingMode := rmUID4Hex;<br>  ACSReader.Active := True;<br>end;</pre><pre>procedure TForm1.ACSReaderUIDRead(Sender: TObject; const UID: string);<br>begin<br>  EditUID.Text := UID;<br>end;</pre><p>Typical flow:</p><ol><li>Call LoadReaders (or set ReaderName yourself).</li><li>Set ReadingMode.</li><li>Assign OnUIDRead.</li><li>Set Active := True (or call Start).</li><li>Present a card. The component raises OnCardInserted, then reads the UID and raises OnUIDRead.</li></ol><h3>Properties</h3><p>PropertyTypeDefaultDescriptionActiveBooleanFalseStarts / stops card insert monitoring. Safe at design time (no PC/SC I/O).ReaderNamestring&#39;&#39;PC/SC reader name, e.g. ACS ACR122 0. Changing it while active restarts the monitor.ReadingModeTDFACSReadingModermUID4HexUID format (see table below).DuplicateBlockMsInteger400Ignore the same UID if it is reported again within this many milliseconds. 0 disables.</p><h3>Methods</h3><p>MethodDescriptionGetReadersReturns connected PC/SC reader names.LoadReaders(Dest, SelectFirst)Fills a TStrings / combo. If SelectFirst is true, sets ReaderName to the first reader.ReadUIDReads UID now from ReaderName using ReadingMode. Card must already be on the reader.ReadUID(ReaderName, Mode)Same, with explicit reader and mode.Start / StopSame as Active := True / False.</p><h3>Events</h3><p>EventWhenOnUIDReadUID was read after a card insert (duplicate filter applied).OnCardInsertedCard present after empty (before UID read).OnCardRemovedCard taken off the reader.OnErrorPC/SC or APDU error. Code is the raw LONG status.OnStartedMonitor thread started.OnStoppedMonitor stopped.</p><p>OnUIDRead and the card events run on the main thread.</p><h3>Reading modes</h3><p>Compatible with the original VB.NET UIDtoKeyboard modes 1–6.</p><p>EnumVB modeOutputrmUID4Hex14-byte UID, hex, as reported (A1B2C3D4)rmUID4HexReversed24-byte UID, hex, byte-reversedrmUID7Hex37-byte UID, hexrmUID7HexReversed47-byte UID, hex, byte-reversedrmUID4DecReversed5first 4 bytes reversed, then unsigned 32-bit decimalrmUID4Dec6first 4 bytes as little-endian UInt32 decimal</p><p>Hex strings are uppercase, no separators.</p><h3>Demo</h3><p>Open Demo\DFACSReaderDemo.dpr.</p><ul><li>Yenile — refresh reader list</li><li>Reading mode — modes 1–6</li><li>Başlat / Durdur — start / stop monitoring</li><li>Bir kez oku — read UID immediately</li></ul><p>You can compile the demo without installing the package; the demo links DFACSReader.pas directly.</p><h3>Using in your own project</h3><p>With palette (recommended)</p><ol><li>Install dclDFACSReader.dpk.</li><li>Drop TDFACSReader on a form.</li><li>Wire events in the Object Inspector.</li></ol><p>Without palette</p><p>Add these units to the project:</p><ul><li>Source\DFWinSCard.pas</li><li>Source\DFACSReader.pas</li></ul><p>Create the component in code:</p><pre>ACSReader := TDFACSReader.Create(Self);<br>ACSReader.OnUIDRead := ACSReaderUIDRead;<br>ACSReader.LoadReaders(cbxReaders.Items, True);<br>ACSReader.Active := True;</pre><h3>Runtime package (optional)</h3><p>DFACSReader.dpk is a run-only package if you prefer linking against a BPL instead of compiling the units into each EXE. Most VCL apps can ignore it and compile the units statically.</p><h3>How it works</h3><ol><li>SCardEstablishContext / SCardListReadersW — enumerate readers</li><li>Background SCardGetStatusChangeW — wait for card insert / remove</li><li>SCardConnectW + SCardTransmit — send FF CA 00 00 Le</li><li>Status words 90 00 — UID bytes are everything before SW1/SW2</li></ol><p>The old .NET libraries only wrapped this same Windows API. This component calls winscard.dll from Delphi.</p><h3>Troubleshooting</h3><p>SymptomWhat to checkNo readersDriver installed, reader powered, Smart Card service (SCardSvr) running. Click refresh after plugging in.No smart card on ReadUIDCard is not on the antenna, or the card is not ISO 14443.APDU SW not 9000Reader/firmware may not support GET DATA UID, or the card needs a different Le.Component missing from paletteInstall dclDFACSReader.dpk. Search the palette for DFACSReader.Duplicate UID eventsIncrease DuplicateBlockMs.</p><p>Link: <a href="https://github.com/delphifanforum/DFAcsReader">https://github.com/delphifanforum/DFAcsReader</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe7d2d21e06f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Professional VCL splash screen component for Delphi 10.3 Rio and later]]></title>
            <link>https://alenibric.medium.com/professional-vcl-splash-screen-component-for-delphi-10-3-rio-and-later-15ce461b807b?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/15ce461b807b</guid>
            <category><![CDATA[application]]></category>
            <category><![CDATA[delphi]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Mon, 07 Sep 2026 06:27:51 GMT</pubDate>
            <atom:updated>2026-09-07T06:27:51.819Z</atom:updated>
            <content:encoded><![CDATA[<h3>DFSplashScreen</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BVgga6XakRtx4nb4.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/0*w1q-9dOK994ZzHC8.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/0*JnfZ-UCzI4H6694H.png" /></figure><p>Professional VCL splash screen component for Delphi 10.3 Rio and later.</p><ul><li>Website: <a href="https://delphifan.com/">delphifan.com</a></li><li>Email: <a href="/service/mailto:adsdelphi@gmail.com">adsdelphi@gmail.com</a></li><li>Version: 1.0.0</li><li>License: MIT</li></ul><p>Drop TDFSplashScreen on a form, or create it in your .dpr before the main form is created. Size, colors, opacity, rounded corners, logo, background image, progress bar, and fade in/out are all published properties.</p><h3>Requirements</h3><ul><li>Delphi 10.3 Rio or newer</li><li>VCL (Win32 / Win64)</li></ul><h3>Quick start (no package install)</h3><p>Add these units to your project:</p><ul><li>Source/DFSplashScreen.Types.pas</li><li>Source/DFSplashScreen.Form.pas</li><li>Source/DFSplashScreen.pas</li></ul><p>Then show the splash while the application starts:</p><pre>program MyApp;</pre><pre>uses<br>  Vcl.Forms,<br>  DFSplashScreen in &#39;Source\DFSplashScreen.pas&#39;,<br>  DFSplashScreen.Types in &#39;Source\DFSplashScreen.Types.pas&#39;,<br>  DFSplashScreen.Form in &#39;Source\DFSplashScreen.Form.pas&#39;,<br>  uMain in &#39;uMain.pas&#39; {frmMain};</pre><pre>var<br>  Splash: TDFSplashScreen;</pre><pre>begin<br>  Application.Initialize;<br>  Application.MainFormOnTaskbar := True;</pre><pre>  Splash := TDFSplashScreen.Create(nil);<br>  try<br>    Splash.Theme := stDark;<br>    Splash.Title := &#39;My Application&#39;;<br>    Splash.Subtitle := &#39;Loading, please wait&#39;;<br>    Splash.AppVersion := &#39;Version 1.0.0&#39;;<br>    Splash.Copyright := &#39;Copyright (c) 2026&#39;;<br>    Splash.Width := 520;<br>    Splash.Height := 300;<br>    Splash.Opacity := 245;        // 0..255<br>    Splash.CornerRadius := 16;<br>    Splash.ShowSplash;</pre><pre>    Splash.UpdateProgress(30, &#39;Creating forms...&#39;);<br>    Application.CreateForm(TfrmMain, frmMain);<br>    Splash.UpdateProgress(100, &#39;Ready&#39;);<br>    Splash.HideSplash;<br>  finally<br>    Splash.Free;<br>  end;</pre><pre>  Application.Run;<br>end.</pre><h3>Install into the IDE (optional)</h3><p>Do not right-click the project group. Install is only on the package project.</p><ol><li>In Delphi: File → Close All.</li><li>File → Open Packages\DFSplashScreen.dproj (the .dproj, not the .groupproj).</li><li>Confirm 32-bit Windows.</li><li>Project → Options → Description → Usage = <em>Designtime and runtime</em>.</li><li>Right-click DFSplashScreen.bpl in Project Manager.</li><li>Click Install (Turkish IDE: Yükle).</li></ol><p>TDFSplashScreen appears on the DF Controls palette.</p><p>If the menu still has Run instead of Install, the file was opened as an application: close it and open Packages\DFSplashScreen.dproj again.</p><p>You can still create the component in code; installing is only needed for dropping it on a form at design time.</p><h3>Demo</h3><p>Open Demo/DFSplashScreenDemo.dproj, compile, and run. The demo starts with a splash, then lets you change theme, width, height, opacity, radius, colors, logo, background image, and progress style live.</p><h3>Themes</h3><p>ThemeDescriptionstDarkDefault dark UIstLightLight UIstMidnightGitHub-style dark bluestOceanTeal accentstSunsetWarm accentstCustomYour own colors</p><p>Changing a color property automatically switches the theme to stCustom.</p><h3>Main properties</h3><p>PropertyDefaultMeaningTitle, Subtitle, Statussample textHeadline and status lineAppVersion, Copyrightsample textFooterWidth, Height520 x 300Logical size at 96 DPI (auto-scaled)Opacity245Window transparency (0 = invisible, 255 = opaque)CornerRadius16Rounded corners (0 = square)AccentColorWindows-style blueTop bar and progressBackgroundColor, BackgroundAltdarkFill / gradient endTitleColor, TextColorwhite / grayTextProgressColor, ProgressBackColoraccent / trackProgress barProgress, ProgressMin, ProgressMax0 / 0 / 100Determinate progressProgressStylepsBarpsBar, psMarquee, psHiddenProgressHeight4Bar thicknessLogo, LogoPosition, LogoSizeleft / 72PNG, JPEG, BMP, GIFBackgroundImage, OverlayDarkenempty / 80Full-bleed photo with dimmingGradientTrueVertical background gradientFadeInMs, FadeOutMs280 / 220Fade animationStayOnTopTrueAlways on topCloseOnClickFalseClick closes the splashAutoHideInterval0Auto hide after N milliseconds (0 = off)FontNameSegoe UITitle and body font</p><h3>Main methods</h3><pre>Splash.ShowSplash;<br>Splash.UpdateStatus(&#39;Connecting...&#39;);<br>Splash.UpdateProgress(60, &#39;Loading modules...&#39;);<br>Splash.LoadLogo(&#39;C:\Brand\logo.png&#39;);<br>Splash.LoadBackground(&#39;C:\Brand\splash.jpg&#39;);<br>Splash.HideSplash;</pre><pre>Splash.Execute(<br>  procedure<br>  begin<br>    // your startup work<br>  end);</pre><p>UpdateProgress and UpdateStatus are safe to call from a worker thread (they marshal to the main thread).</p><h3>Events</h3><ul><li>OnShow — after the splash is shown</li><li>OnHide — after fade-out completes</li><li>OnTimeout — when AutoHideInterval elapses</li></ul><h3>Tips</h3><ul><li>Call ShowSplash before Application.CreateForm so users see feedback during a slow startup.</li><li>HideSplash waits for the fade-out, so it is safe to Free immediately afterwards in the .dpr.</li><li>Prefer PNG logos with transparency.</li><li>Values for width, height, radius, and logo size are specified at 96 DPI and scaled for the current monitor.</li></ul><p><a href="https://github.com/delphifanforum/DfSplashScreen">https://github.com/delphifanforum/DfSplashScreen</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15ce461b807b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DFLicencer 2.0]]></title>
            <link>https://alenibric.medium.com/dflicencer-2-0-9ba7d43bc6c7?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ba7d43bc6c7</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[delphi]]></category>
            <category><![CDATA[licensing]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Thu, 03 Sep 2026 10:57:53 GMT</pubDate>
            <atom:updated>2026-09-03T10:59:23.282Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l2SnX_IlofafIeIIV3eX6Q.png" /></figure><p>HMAC-SHA256 signed software licensing for Delphi 10.3 Rio and later (VCL / Windows).</p><h3>Why 2.0?</h3><p>Version 1.x used fake encryption (EncodeString) and ContainsStr checks, which were easy to spoof and brittle with dates. 2.0 signs a JSON payload with HMAC-SHA256, and adds optional hardware binding, feature flags, license types, and a drop-in TDFLicencer component.</p><p>Version 1.x keys are not compatible with 2.0.</p><h3>Features</h3><ul><li>Signed license token: DFL2.&lt;payload&gt;.&lt;signature&gt;</li><li>Trial / Standard / Professional / Enterprise / Perpetual</li><li>Expiry date or never-expires</li><li>Grace period after expiry</li><li>Feature flags (reports, export, ...)</li><li>Optional hardware binding (machine ID)</li><li>Application version range (MinVersion / MaxVersion)</li><li>Storage in license.lic or .ini</li><li>Palette component: TDFLicencer (DF Licencer)</li><li>Runtime + design-time packages (Win32 design-time, Win32/Win64 runtime)</li></ul><h3>Package install</h3><ol><li>Open packages\DFLicencer.groupproj in Delphi 10.3+.</li><li>Build DFLicencer (runtime), then DFLicencerDesign.</li><li>Install the design-time package: Component &gt; Install Packages &gt; Add and select bin\Win32\Release\DFLicencerDesign.bpl (output folder may differ).</li><li>TDFLicencer appears on the Tool Palette under DF Licencer.</li></ol><p>Alternatively, add the units from source\ to your project. The demos compile this way; installing the BPL is optional.</p><h3>Quick start</h3><p>Use the same ProductId and SecretKey in the generator and in your application. The secret is compiled into the binary — use your own long random value in production.</p><pre>uses<br>  DFLicencer.Component, DFLicencer.Types;</pre><pre>procedure TFormMain.FormCreate(Sender: TObject);<br>begin<br>  DFLicencer1.ProductId := &#39;com.mycompany.myapp&#39;;<br>  DFLicencer1.SecretKey := &#39;your-long-random-secret&#39;;<br>  DFLicencer1.LicenseFile := &#39;license.lic&#39;;<br>  DFLicencer1.AppVersion := &#39;2.0.0&#39;;<br>  DFLicencer1.HardwareBinding := False;<br>  DFLicencer1.GraceDays := 3;</pre><pre>  DFLicencer1.CheckLicense;<br>  if not DFLicencer1.IsLicensed then<br>  begin<br>    ShowMessage(DFLicencer1.StatusText);<br>    Application.Terminate;<br>    Exit;<br>  end;</pre><pre>  if DFLicencer1.HasFeature(&#39;export&#39;) then<br>    EnableExport;<br>end;</pre><p>Generate a key (in your generator / sales tool):</p><pre>uses<br>  DFLicencer.Core, DFLicencer.Types;</pre><pre>var<br>  Info: TDFLicenseInfo;<br>  Key: string;<br>begin<br>  Info.Clear;<br>  Info.ProductId := &#39;com.mycompany.myapp&#39;;<br>  Info.ProductName := &#39;My App&#39;;<br>  Info.CustomerName := &#39;Acme Ltd&#39;;<br>  Info.LicenseType := ltProfessional;<br>  Info.IssuedAt := Date;<br>  Info.ExpiresAt := EncodeDate(2027, 12, 31);<br>  Info.Features := &#39;reports;export;api&#39;;<br>  Info.Seats := 5;<br>  Key := TDFLicenseCodec.Generate(Info, &#39;your-long-random-secret&#39;);<br>end;</pre><p>Activate in the customer app:</p><pre>DFLicencer1.Activate(PastedKey);</pre><p>If the key is valid, it is saved to LicenseFile.</p><h3>TDFLicencer</h3><p>PropertyDescriptionProductIdProduct identity the license is bound toSecretKeyHMAC secret (must match the generator)LicenseFilelicense.lic or .iniAppVersionUsed for min/max version checksHardwareBindingWhen True, the license is locked to this machineGraceDaysExtra days after expiryAutoCheckValidate in Loaded (skipped at design-time)OnStatusStatus callback</p><p>Methods: CheckLicense, Activate, HasFeature, DaysRemaining, MachineId, IsLicensed, StatusText.</p><h3>Demos</h3><ul><li>demo\Generator — license generator</li><li>demo\SampleApp — paste a key and activate</li></ul><p>Sample Product ID (both demos): com.delphifan.sample<br>Sample secret: change-this-secret-in-production</p><h3>Requirements</h3><ul><li>RAD Studio / Delphi 10.3 Rio or later</li><li>Windows (machine ID is Win32/Win64)</li></ul><p><a href="https://github.com/delphifanforum/DFLicencer2.0">https://github.com/delphifanforum/DFLicencer2.0</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ba7d43bc6c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polly-style resilience pipelines for Delphi 10.3 Rio and later]]></title>
            <link>https://alenibric.medium.com/polly-style-resilience-pipelines-for-delphi-10-3-rio-and-later-4f0679207a98?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f0679207a98</guid>
            <category><![CDATA[resilience]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[delphi]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Thu, 03 Sep 2026 05:56:33 GMT</pubDate>
            <atom:updated>2026-09-03T05:56:33.646Z</atom:updated>
            <content:encoded><![CDATA[<p>A resilience pipeline library. Combine Retry, Timeout, Circuit Breaker, Fallback, Rate Limiter, Concurrency Limiter, and Hedging in one fluent pipeline for REST, SOAP, database, and other remote calls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*V9_3WQLCgqIY08m3MJDMqA.png" /></figure><h3>Installation</h3><p>Add the src folder to your project search path:</p><pre>uses<br>  DFResilience;</pre><p>You can also compile packages/DFResilience.dpk.</p><h3>Quick start</h3><pre>TDFResiliencePipeline<br>  .Create<br>  .AddRetry(3)<br>  .AddTimeout(5000)<br>  .AddCircuitBreaker(5, 30000)<br>  .Execute(<br>    procedure<br>    begin<br>      CallApi;<br>    end<br>  );</pre><h3>Full pipeline</h3><p>Build once and reuse the pipeline when a strategy keeps state, such as a circuit breaker:</p><pre>var<br>  Pipeline: TDFResiliencePipeline;<br>  Response: string;<br>begin<br>  Pipeline :=<br>    TDFResiliencePipeline.Create<br>      .AddRetry(<br>         TDFRetryOptions.Create<br>           .MaxAttempts(5)<br>           .Delay(1000)<br>           .Backoff(TDFBackoffType.Exponential)<br>           .UseJitter(True))<br>      .AddTimeout(10000)<br>      .AddCircuitBreaker(5, 60000)<br>      .Build;</pre><pre>  Response := Pipeline.Execute&lt;string&gt;(<br>    function: string<br>    begin<br>      Result := IdHTTP1.Get(&#39;https://api.example.com/health&#39;);<br>    end);<br>end;</pre><p>Order matters: the first strategy you add is the outermost. AddRetry then AddTimeout means every retry attempt has its own timeout.</p><h3>Strategies</h3><p>StrategyWhat it doesSimple APIRetryRetries transient failures.AddRetry(3)TimeoutRaises EDFTimeoutException when the limit is exceeded.AddTimeout(5000)Circuit BreakerFails fast after a threshold.AddCircuitBreaker(5, 30000)FallbackRuns an alternative path on failure.AddFallback(...)Rate LimiterCaps calls inside a time window.AddRateLimiter(100, 60000)Concurrency LimiterCaps work running at the same time.AddConcurrencyLimiter(10, 20)HedgingStarts a parallel attempt if a call is slow.AddHedging(2, 2000)</p><p>AddRetry(3) means 3 total attempts (do not confuse this with Polly’s MaxRetryAttempts).</p><p>For timeout cancellation, use Context.Token or Context.ThrowIfCancellationRequested inside the callback. If the callback ignores the token, work may continue in the background; the pipeline still raises EDFTimeoutException.</p><h3>Exceptions</h3><ul><li>EDFTimeoutException</li><li>EDFBrokenCircuitException (RetryAfterMs)</li><li>EDFIsolatedCircuitException</li><li>EDFRateLimitedException (RetryAfterMs)</li></ul><p>Retry handles all exceptions except a broken circuit and EAbort. To filter:</p><pre>.AddRetry(<br>  TDFRetryOptions.Create<br>    .MaxAttempts(5)<br>    .Handle(TDFPredicateBuilder.Create.Handle(EIdHTTPProtocolException).Build))</pre><h3>Requirements</h3><ul><li>Delphi 10.3 Rio or later</li><li>RTL (System.Threading, System.SyncObjs, generics)</li></ul><p><a href="https://github.com/delphifanforum/DFResilience">https://github.com/delphifanforum/DFResilience</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f0679207a98" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DFHumanize library for Delphi]]></title>
            <link>https://alenibric.medium.com/dfhumanize-library-for-delphi-b22d91d562bb?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/b22d91d562bb</guid>
            <category><![CDATA[delphi]]></category>
            <category><![CDATA[pascal]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[humanized]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 05:39:51 GMT</pubDate>
            <atom:updated>2026-08-05T05:39:51.474Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/704/0*Oh3ua7lABOwjxvwK.png" /></figure><h3>Features</h3><ul><li>Relative dates: 3 hours ago, yesterday, 2 days from now</li><li>String humanize: OrderStatusCode → Order status code</li><li>Numbers to words (English / Turkish)</li><li>Byte sizes: 1536000 → 1.5 MB</li><li>Lists: A, B and C / A, B ve C</li><li>Non-visual + visual components on the <strong>DF Humanize</strong> palette</li><li>Cultures: hcAuto, hcEnglish, hcTurkish</li></ul><h3>Install</h3><ol><li>Open Packages\DFHumanize.groupproj in Delphi.</li><li>Build <strong>DFHumanize</strong> (runtime package).</li><li>Build <strong>dclDFHumanize</strong> (design package).</li><li><strong>Component → Install Packages → Add</strong><br>select: Lib\Win32\Release\dclDFHumanize.bpl</li><li>(Recommended) Add to Library path:<br>...\DelphiHumanizer\Lib\Win32\Release</li></ol><p>Components appear under palette group <strong>DF Humanize</strong>.</p><p>Optional demo: Demo\DFHumanizeDemo.dproj</p><h3>Components</h3><h3>Non-visual</h3><p><strong>ComponentDescription</strong>TDFHumanizerCentral culture / helpers / AboutTDFHumanizeDateRelative date as TextTDFHumanizeNumberNumber → words / ordinalTDFHumanizeBytesFile size text</p><h3>Visual</h3><p><strong>ComponentDescription</strong>TDFHumanizeLabelLabel with auto-refresh (dates)TDFHumanizeStatusPanelStatus strip: Last update: 12 minutes ago</p><h3>Code API examples</h3><pre>uses<br>  System.SysUtils,<br>  System.DateUtils,<br>  DFHumanize,<br>  DFHumanize.Types;Copy</pre><h3>Dates</h3><pre>// English<br>ShowMessage(Humanize.DateTime(IncHour(Now, -3), hcEnglish));<br>// -&gt; 3 hours ago</pre><pre>ShowMessage(Humanize.DateTime(IncDay(Now, 1), hcEnglish));<br>// -&gt; tomorrow</pre><pre>// Turkish<br>ShowMessage(Humanize.DateTime(IncHour(Now, -3), hcTurkish));<br>// -&gt; 3 saat önce</pre><pre>ShowMessage(Humanize.DateTime(IncDay(Now, -1), hcTurkish));<br>// -&gt; dün</pre><pre>// Auto = OS UI language<br>ShowMessage(Humanize.DateTime(IncMinute(Now, -12), hcAuto));Copy</pre><h3>Strings</h3><pre>ShowMessage(Humanize.StringValue(&#39;OrderStatusCode&#39;));<br>// -&gt; Order status code</pre><pre>ShowMessage(Humanize.StringValue(&#39;dash-separated-name&#39;, lcTitleCase));<br>// -&gt; Dash Separated Name</pre><pre>ShowMessage(Humanize.Dehumanize(&#39;order status code&#39;));<br>// -&gt; OrderStatusCode</pre><pre>ShowMessage(Humanize.Truncate(&#39;Long text to truncate&#39;, 10));<br>// -&gt; Long text…Copy</pre><h3>Numbers</h3><pre>ShowMessage(Humanize.Number(1234, hcEnglish));<br>// -&gt; one thousand two hundred thirty-four</pre><pre>ShowMessage(Humanize.Number(1234, hcTurkish));<br>// -&gt; bin iki yüz otuz dört</pre><pre>ShowMessage(Humanize.Ordinal(21, hcEnglish));<br>// -&gt; 21st</pre><pre>ShowMessage(Humanize.Ordinal(21, hcTurkish));<br>// -&gt; 21.</pre><pre>ShowMessage(Humanize.Quantity(3, &#39;file&#39;, &#39;files&#39;, hcEnglish));<br>// -&gt; 3 files</pre><pre>ShowMessage(Humanize.Quantity(3, &#39;dosya&#39;, &#39;&#39;, hcTurkish));<br>// -&gt; 3 dosyaCopy</pre><h3>Bytes &amp; lists</h3><pre>ShowMessage(Humanize.Bytes(1536000));<br>// -&gt; 1.5 MB</pre><pre>ShowMessage(Humanize.List([&#39;Ankara&#39;, &#39;Izmir&#39;, &#39;Bursa&#39;], hcEnglish));<br>// -&gt; Ankara, Izmir and Bursa</pre><pre>ShowMessage(Humanize.List([&#39;Ankara&#39;, &#39;Izmir&#39;, &#39;Bursa&#39;], hcTurkish));<br>// -&gt; Ankara, Izmir ve BursaCopy</pre><h3>About</h3><pre>ShowMessage(Humanize.Version);<br>// -&gt; 1.0.0</pre><pre>ShowMessage(Humanize.AboutText);<br>// -&gt; DFHumanize 1.0.0 - DelphiFan &lt;adsdelphi@gmail.com&gt; - <a href="https://delphifan.comcopy/">https://delphifan.comCopy</a></pre><p>Download link : <a href="https://github.com/delphifanforum/DFHumanize">https://github.com/delphifanforum/DFHumanize</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b22d91d562bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DFTRBank is a Delphi virtual POS library]]></title>
            <link>https://alenibric.medium.com/dftrbank-is-a-delphi-virtual-pos-library-d27e30af3f8a?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d27e30af3f8a</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[delphi]]></category>
            <category><![CDATA[embarcadero]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 05:38:06 GMT</pubDate>
            <atom:updated>2026-08-05T05:38:06.372Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/645/0*9UEbRx2Yi0BTD-uT.png" /></figure><h3>What is it?</h3><p><strong>DFTRBank</strong> is a Delphi virtual POS library with a single API and a Tool Palette component (TDFTRBank).</p><p>Integrate Nestpay/EST banks, native bank APIs, and payment institutions through one consistent interface for sale, 3-D Secure return, cancel, and refund flows.</p><h3>Features</h3><ul><li>Drop-in VCL component: TDFTRBank</li><li>Shared request/response models</li><li>Bank selection via BankCode</li><li>Sandbox / production switch (TestPlatform)</li><li>Packages for Delphi <strong>10.3 · 10.4 · 11 · 12 · 13</strong></li><li>One-click install scripts</li></ul><h3>Quick install</h3><ol><li>Close Delphi.</li><li>Run the script for your IDE version (see table above).</li><li>Reopen Delphi → <strong>Tool Palette → DFTRBank → TDFTRBank</strong></li></ol><p>Uninstall example: Install_D12.bat /uninstall</p><h3>Quick usage</h3><pre>DFTRBank1.BankCode := BANK_ZiraatBankasi; // &#39;0010&#39;<br>DFTRBank1.MerchantID := &#39;CLIENT_ID&#39;;<br>DFTRBank1.MerchantUser := &#39;API_USER&#39;;<br>DFTRBank1.MerchantPassword := &#39;API_PASS&#39;;<br>DFTRBank1.MerchantStorekey := &#39;STORE_KEY&#39;;<br>DFTRBank1.TestPlatform := True;</pre><pre>Req := TDFTRSaleRequest.Create(True);<br>try<br>  Req.OrderNumber := &#39;ORD-2026-0001&#39;;<br>  Req.Payment3D.Confirm := True;<br>  Req.Payment3D.ReturnURL := &#39;https://yoursite.com/3d-return&#39;;<br>  // fill card + customer fields...</pre><pre>  Resp := DFTRBank1.Sale(Req);<br>  try<br>    // Resp.Statu, Resp.OrderNumber, Resp.TransactionId, Resp.Message<br>  finally<br>    Resp.Free;<br>  end;<br>finally<br>  Req.Free;<br>end;Copy</pre><h3>Supported providers</h3><p>See the Turkish tables above for the full bank/payment institution code list (Nestpay, bank APIs, and payment orgs).</p><h3>Operations</h3><p>Sale · Sale3DResponse · Cancel · Refund · installment queries</p><p>Cancel/refund not available for: Garanti, Yapı Kredi, Kuveyt Türk, Vakıf Katılım.</p><h3>Notes</h3><ul><li>Nestpay merchants typically need storetype=3d.</li><li>Akbank native API (0046) ≠ Nestpay (9046).</li><li>Treat card data as PCI-sensitive — never log PANs/CVV in production.</li><li>Always validate in the provider’s test environment first.</li></ul><p><a href="https://github.com/delphifanforum/DFTRBank">https://github.com/delphifanforum/DFTRBank</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d27e30af3f8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practical Guide to HTTPSSE in Delphi 13.1]]></title>
            <link>https://alenibric.medium.com/practical-guide-to-httpsse-in-delphi-13-1-a4f0c471fc35?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4f0c471fc35</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[delphi-programming]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[https]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 13:00:26 GMT</pubDate>
            <atom:updated>2026-03-26T13:00:26.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*KRw_Vwu6bsxSOt-cPwjGsw.png" /></figure><p>System.Net.HTTPSSE is the core unit in Delphi 13.1 used to handle Server-Sent Events (SSE). <br> SSE is a one-way real-time communication protocol based on HTTP, where the server pushes data to the client.<br> <br> Compared to WebSocket, SSE is more lightweight and suitable for scenarios such as stock market data, real-time notifications, and log streaming.<br> <br> This guide explains its usage in detail, including core components, basic usage, advanced techniques, and error handling.</p><h3>1. Core Components and Concepts</h3><p>Key classes in System.Net.HTTPSSE:<br> <br> THTTPSSEClient — Core client class for establishing SSE connections and receiving events <br> THTTPSSEEvent — Encapsulates a single SSE event (ID, Event, Data, Retry) <br> THTTPSSEState — Enum representing connection state (Disconnected / Connecting / Connected) <br> <br> Prerequisites:<br> — Delphi 13.1 or later <br> — Server must support SSE (Content-Type: text/event-stream) <br> — Include System.Net.HTTPSSE unit</p><h3>2. Basic Usage (Core Workflow)</h3><p>Complete example including connection, event handling, and disconnection:</p><p>constructor TForm1.Create(AOwner: TComponent);<br> begin<br> inherited;<br> FSSEClient := THTTPSSEClient.Create(nil);<br> FSSEClient.OnEvent := OnSSEEvent;<br> FSSEClient.OnStateChanged := OnSSEStateChanged;<br> end;</p><p>destructor TForm1.Destroy;<br> begin<br> if FSSEClient.State = THTTPSSEState.sseConnected then<br> FSSEClient.Disconnect;<br> FSSEClient.Free;<br> inherited;<br> end;</p><p>procedure TForm1.btnConnectClick(Sender: TObject);<br> var<br> LHeaders: TNetHeaders;<br> begin<br> SetLength(LHeaders, 1);<br> LHeaders[0].Name := ‘Accept’;<br> LHeaders[0].Value := ‘text/event-stream’;<br> <br> FSSEClient.Connect(‘http://localhost:8080/sse&#39;, LHeaders, True);<br> end;</p><p>procedure TForm1.btnDisconnectClick(Sender: TObject);<br> begin<br> if FSSEClient.State = THTTPSSEState.sseConnected then<br> FSSEClient.Disconnect;<br> end;</p><p>procedure TForm1.OnSSEEvent(Sender: TObject; const AEvent: THTTPSSEEvent);<br> begin<br> Memo1.Lines.Add(‘ID: ‘ + AEvent.ID);<br> Memo1.Lines.Add(‘Event: ‘ + AEvent.Event);<br> Memo1.Lines.Add(‘Data: ‘ + AEvent.Data);<br> Memo1.Lines.Add(‘Retry: ‘ + IntToStr(AEvent.Retry) + ‘ms’);<br> end;</p><p>procedure TForm1.OnSSEStateChanged(Sender: TObject; const AState: THTTPSSEState);<br> begin<br> case AState of<br> sseDisconnected: Memo1.Lines.Add(‘Disconnected’);<br> sseConnecting: Memo1.Lines.Add(‘Connecting…’);<br> sseConnected: Memo1.Lines.Add(‘Connected’);<br> end;<br> end;</p><h3>Key Methods</h3><p>Connect method:<br> — Requires URL and headers<br> — Must include Accept: text/event-stream<br> — Supports auto-reconnect<br> — Works asynchronously<br> <br> Disconnect method:<br> — Closes connection and frees resources<br> <br> OnEvent:<br> — Triggered when server sends data<br> <br> OnStateChanged:<br> — Triggered when connection state changes</p><h3>3. Advanced Techniques</h3><p>HTTPS Configuration:</p><p>FSSEClient.Client.SSLHandler := TSSLHandler.Create(nil);<br> FSSEClient.Client.SSLHandler.SSLOptions.VerifyCertificates := False;<br> FSSEClient.Client.SSLHandler.SSLOptions.Method := sslvTLSv1_2;</p><p>JSON Parsing:</p><p>var<br> LJSONObj: TJSONObject;<br> begin<br> LJSONObj := TJSONObject.ParseJSONValue(AEvent.Data) as TJSONObject;<br> Memo1.Lines.Add(LJSONObj.GetValue&lt;string&gt;(‘title’));<br> end;</p><p>Custom Reconnect Logic and Timeout Settings:</p><p>FSSEClient.Client.Timeout := 10000;<br> FSSEClient.Client.ReadTimeout := 300000;</p><h3>4. Error Handling and Common Issues</h3><p>Common errors and solutions:<br> <br> 404 — Wrong SSE endpoint <br> 415 — Missing Accept header <br> SSL Exception — Certificate validation failure <br> Socket Error — Network interruption <br> <br> Solutions:<br> — Verify endpoint <br> — Add required headers <br> — Configure SSL properly <br> — Enable auto reconnect</p><p>Debug Tips:</p><p>- Enable HTTP logging in Delphi <br> — Test endpoint via browser/Postman <br> — Log full event data</p><h3>5. Node.js SSE Server Example</h3><p>const http = require(‘http’);<br> <br> const server = http.createServer((req, res) =&gt; {<br> if (req.url === ‘/sse’) {<br> res.writeHead(200, {<br> ‘Content-Type’: ‘text/event-stream’,<br> ‘Cache-Control’: ‘no-cache’,<br> ‘Connection’: ‘keep-alive’,<br> ‘Access-Control-Allow-Origin’: ‘*’<br> });<br> <br> let count = 0;<br> setInterval(() =&gt; {<br> count++;<br> res.write(`id: ${count}\n`);<br> res.write(`event: message\n`);<br> res.write(`data: Message ${count}\n\n`);<br> }, 2000);<br> } else {<br> res.writeHead(404);<br> res.end(‘Not Found’);<br> }<br> });<br> <br> server.listen(8080);</p><h3>Conclusion</h3><p>THTTPSSEClient is the core for SSE in Delphi 13.1. <br> Use proper headers, handle events and states, configure SSL, and implement reconnection strategies for stable real-time applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4f0c471fc35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Slack Error Notification System & .NET Integration]]></title>
            <link>https://alenibric.medium.com/slack-error-notification-system-net-integration-0063acec1995?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/0063acec1995</guid>
            <category><![CDATA[aspnet]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Mon, 27 Oct 2025 09:29:32 GMT</pubDate>
            <atom:updated>2025-10-27T09:29:32.852Z</atom:updated>
            <content:encoded><![CDATA[<h3>Slack Error Notification System &amp; .NET Integration</h3><h3>Slack Error Notification System &amp; .NET Integration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Em4H1puyhY9sz4J9dHlGiw.png" /></figure><h3>🎯 General Flow</h3><ol><li>Create an app in Slack and obtain a Bot Token</li><li>Add this bot to your Slack channel</li><li>Test the chat.postMessage API (e.g., in Postman)</li><li>Add a small service (helper class) to our .NET project that automatically sends these requests</li><li>Connect it in try-catch blocks or as Middleware</li></ol><h3>🧩 1. Creating a Slack App</h3><ol><li>Go to: <a href="https://api.slack.com/apps">https://api.slack.com/apps</a></li><li>Click “Create New App” → Select “From Scratch”</li><li>App name: for example, ErrorNotifier</li><li>Select your own Slack workspace</li></ol><h3>🧰 2. Configure Permissions (Scopes)</h3><ol><li>Go to the <strong>OAuth &amp; Permissions</strong> tab from the left menu</li><li>Add the following permission under “Bot Token Scopes”:</li></ol><pre>chat:write</pre><ol><li>Click the “Install App to Workspace” button at the top of the page</li><li>Click “Allow” in the popup window</li><li>Slack will show you a <strong>Bot User OAuth Token</strong>, usually in this format:</li></ol><pre>xoxb-1234567890123-ABCDEFGHIJKLMN</pre><p>Save this token somewhere (we’ll put it in appsettings.json in .NET)</p><h3>🧭 3. Determine the Slack Channel</h3><p>To find the ID of the channel where you want to send messages:</p><ol><li>Enter the channel in Slack</li><li>Click “Channel details (i)” in the top right → “About” → Look at the “Channel ID” section</li><li>Example: C07ABCDEF12</li></ol><h3>⚙️ 4. Testing the chat.postMessage Request</h3><p>You can do a simple test with Postman or curl:</p><pre>POST https://slack.com/api/chat.postMessage<br>Headers:<br>  Authorization: Bearer xoxb-1234567890123-ABCDEFGHIJKLMN<br>  Content-Type: application/json<br>Body (raw JSON):<br>{<br>  &quot;channel&quot;: &quot;C07ABCDEF12&quot;,<br>  &quot;text&quot;: &quot;Error notification: Test message&quot;<br>}</pre><p>If it returns &quot;ok&quot;: true, the system is working.</p><h3>Implementation: Global Error Handling Middleware</h3><p>I’ll show you the global error catching middleware (ExceptionMiddleware) structure. This structure catches all exceptions, logs them, and sends them to our SlackNotifier.</p><h3>⚙️ 1. SlackNotifier Class</h3><p>This class sends messages to Slack.</p><pre>using System.Net.Http;<br>using System.Text;<br>using System.Text.Json;<br>using System.Threading.Tasks;</pre><pre>public class SlackNotifier<br>{<br>    private readonly HttpClient _httpClient;<br>    private readonly string _slackToken;<br>    private readonly string _channelId;</pre><pre>    public SlackNotifier(string slackToken, string channelId)<br>    {<br>        _httpClient = new HttpClient();<br>        _slackToken = slackToken;<br>        _channelId = channelId;<br>    }</pre><pre>    public async Task SendErrorAsync(string errorMessage, string stackTrace = null, string environment = &quot;Production&quot;)<br>    {<br>        var blocks = new object[]<br>        {<br>            new { type = &quot;header&quot;, text = new { type = &quot;plain_text&quot;, text = &quot;🔥 Error Notification&quot;, emoji = true } },<br>            new { type = &quot;section&quot;, fields = new object[]<br>                {<br>                    new { type = &quot;mrkdwn&quot;, text = $&quot;*Environment:* {environment}&quot; },<br>                    new { type = &quot;mrkdwn&quot;, text = $&quot;*Time:* {DateTime.Now:yyyy-MM-dd HH:mm:ss}&quot; }<br>                }<br>            },<br>            new { type = &quot;divider&quot; },<br>            new { type = &quot;section&quot;, text = new { type = &quot;mrkdwn&quot;, text = $&quot;*Message:* {errorMessage}&quot; } },<br>            new { type = &quot;section&quot;, text = new { type = &quot;mrkdwn&quot;, text = $&quot;```{stackTrace}```&quot; } },<br>            new { type = &quot;context&quot;, elements = new object[]<br>                {<br>                    new { type = &quot;mrkdwn&quot;, text = &quot;🧠 Automatic error notification system (SlackNotifier)&quot; }<br>                }<br>            }<br>        };</pre><pre>        var payload = new<br>        {<br>            channel = _channelId,<br>            blocks<br>        };</pre><pre>        var content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, &quot;application/json&quot;);<br>        <br>        _httpClient.DefaultRequestHeaders.Clear();<br>        _httpClient.DefaultRequestHeaders.Add(&quot;Authorization&quot;, $&quot;Bearer {_slackToken}&quot;);<br>        <br>        var response = await _httpClient.PostAsync(&quot;https://slack.com/api/chat.postMessage&quot;, content);<br>        var body = await response.Content.ReadAsStringAsync();<br>        <br>        if (!response.IsSuccessStatusCode)<br>            Console.WriteLine($&quot;Slack sending error: {body}&quot;);<br>    }<br>}</pre><h3>🧩 2. Exception Middleware</h3><p>This middleware will catch every error in the pipeline and send it to Slack.</p><p>Create a new file: Middlewares/ExceptionMiddleware.cs</p><pre>using System;<br>using System.Net;<br>using System.Threading.Tasks;<br>using Microsoft.AspNetCore.Http;<br>using Microsoft.Extensions.Logging;</pre><pre>public class ExceptionMiddleware<br>{<br>    private readonly RequestDelegate _next;<br>    private readonly ILogger&lt;ExceptionMiddleware&gt; _logger;<br>    private readonly SlackNotifier _slackNotifier;</pre><pre>    public ExceptionMiddleware(RequestDelegate next, ILogger&lt;ExceptionMiddleware&gt; logger, SlackNotifier slackNotifier)<br>    {<br>        _next = next;<br>        _logger = logger;<br>        _slackNotifier = slackNotifier;<br>    }</pre><pre>    public async Task InvokeAsync(HttpContext context)<br>    {<br>        try<br>        {<br>            await _next(context);<br>        }<br>        catch (Exception ex)<br>        {<br>            _logger.LogError(ex, &quot;Unexpected error caught.&quot;);<br>            await HandleExceptionAsync(context, ex);<br>        }<br>    }</pre><pre>    private async Task HandleExceptionAsync(HttpContext context, Exception ex)<br>    {<br>        context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;<br>        context.Response.ContentType = &quot;application/json&quot;;</pre><pre>        // Notify Slack (should be changed to Development or Production)<br>        await _slackNotifier.SendErrorAsync(ex.Message, ex.StackTrace, environment: &quot;Development&quot;);</pre><pre>        var result = System.Text.Json.JsonSerializer.Serialize(new { error = ex.Message });<br>        await context.Response.WriteAsync(result);<br>    }<br>}</pre><h3>📱 Slack Message Appearance</h3><p>The message will appear in Slack like this:</p><pre>🔥 Error Notification<br>Environment: Production | Time: 2025-10-27 23:42:13<br>Message: NullReferenceException: Object reference not set...<br>[stack trace here as code block]<br>🧠 Automatic error notification system (SlackNotifier)</pre><h3>🧭 3. Add to Program.cs or Startup.cs</h3><p><strong>Program.cs</strong> (ASP.NET Core 6/7/8 minimal API structure):</p><pre>var builder = WebApplication.CreateBuilder(args);</pre><pre>// Add Slack notifier to DI container<br>builder.Services.AddSingleton(new SlackNotifier(<br>    slackToken: &quot;xoxb-9301340834948-9760752381911-twGA0i3zLUaoTfEtETCmyUWNB&quot;,<br>    channelId: &quot;C09NMQ384GK&quot;<br>));</pre><pre>var app = builder.Build();</pre><pre>// Register the middleware<br>app.UseMiddleware&lt;ExceptionMiddleware&gt;();</pre><pre>// Other endpoints<br>app.MapControllers();</pre><pre>app.Run();</pre><p>If you’re using the classic Startup.cs, just add app.UseMiddleware&lt;ExceptionMiddleware&gt;(); to the Configure method.</p><h3>🧨 4. Testing Time</h3><p>Deliberately throw an error in an endpoint:</p><pre>[HttpGet(&quot;test-error&quot;)]<br>public IActionResult TestError()<br>{<br>    throw new Exception(&quot;Test error! Should appear in Slack.&quot;);<br>}</pre><p>When you call /test-error from the browser, the message will instantly appear in your Slack channel with the error message, stack trace, and timestamp.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0063acec1995" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Cryptographic Tools in Delphi Applications]]></title>
            <link>https://alenibric.medium.com/using-cryptographic-tools-in-delphi-applications-2fdacb128a2a?source=rss-ee1b144a9dd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fdacb128a2a</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[delphi]]></category>
            <dc:creator><![CDATA[Alen IBRIC]]></dc:creator>
            <pubDate>Fri, 26 Sep 2025 11:51:07 GMT</pubDate>
            <atom:updated>2025-09-26T11:51:07.230Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Using Cryptographic Tools in Delphi Applications" src="https://cdn-images-1.medium.com/max/1024/1*-D5t_X70rAbjnhUB3LGnzA.jpeg" /></figure><p>Where can this be useful? For instance, storing password hashes instead of actual passwords in databases is a solid approach. When a user enters their password, you calculate its hash and compare it with the database value. If an attacker gains access to this database, they won’t be able to retrieve the original passwords since hash functions are one-way operations. They’re also unlikely to find another password that produces the same hash.</p><p>Now let’s return to digital signatures. As mentioned earlier, signing an entire message isn’t practical. The main goal of digital signatures isn’t message secrecy, but ensuring that the sender is who they claim to be and that the message hasn’t been altered after signing. The typical approach is: calculate a message hash (usually 16–64 bytes), encrypt it with the sender’s private key, and transmit it alongside the original message. The recipient calculates the message hash, decrypts the signature using the sender’s public key, and compares the results. This procedure is called verification.</p><h3>Popular Algorithms</h3><p>Let’s move from abstract concepts to naming specific algorithms. Among symmetric algorithms, we have:</p><ul><li><strong>DES</strong> (developed by IBM and approved by the US government in 1977 as an official standard): A block cipher that, despite its popularity, has known vulnerabilities and documented break attempts</li><li><strong>3-DES</strong>: Triple encryption using DES with three different keys</li><li><strong>RC2</strong> (block cipher) and <strong>RC4</strong> (stream cipher)</li><li><strong>IDEA</strong> (block cipher)</li></ul><p>Each has its own strengths and weaknesses.</p><p>Among asymmetric algorithms, <strong>RSA</strong> stands out, named after Ron Rivest, Adi Shamir, and Len Adleman who developed it in 1977. The algorithm’s core principle is that multiplying two numbers is much easier than factoring their product. Let me explain this algorithm in detail:</p><ol><li>Generate two large prime numbers p and q</li><li>Calculate n = p × q</li><li>Choose a number e (typically around 10,000) that&#39;s coprime with φ = (p-1)(q-1) - meaning e and φ share no common divisors except 1</li><li>Generate d such that e × d ≡ 1 (mod φ) - this means (e × d - 1) is divisible by φ</li><li>Publish n and e as the public key, keep d secret as the private key. Numbers p and q should be destroyed or kept equally secret</li></ol><p>Messages are encrypted using: y = x^e (mod n), where x is the original message and y is encrypted. Decryption uses the private key d: x = y^d (mod n).</p><p>The algorithm’s security relies on the fact that recovering private key d requires knowing p and q, which can only be obtained by factoring n. If p and q are sufficiently large, this becomes practically impossible. Currently, experts recommend choosing p and q so that n is at least 1024 bits long.</p><p>For hashing algorithms, we have:</p><ul><li><strong>MD4</strong> (128-bit hash)</li><li><strong>MD5</strong> (developed in 1991, 128-bit hash, replaced MD4, but vulnerabilities allowing collision attacks were discovered in 2004)</li><li><strong>SHA-1</strong> (developed in 1995, 160-bit hash, was most popular for a long time, but suffered the same fate as MD5 in early 2005. Bruce Schneier stated: “SHA-1 has been broken”)</li><li><strong>SHA-224, SHA-256, SHA-384, SHA-512</strong></li></ul><h3>CryptoAPI</h3><p>Cryptographic functions are part of the Windows operating system, accessible through the CryptoAPI interface. Basic capabilities have been available since Windows 95, with continuous expansions over time. CryptoAPI function descriptions can be found in MSDN, literature, or Delphi help files. These functions are contained in advapi32.dll and crypt32.dll libraries. You can import them manually or use the Wcrypt2.pas file included with this article.</p><h3>Connecting to Crypto Providers and Key Containers</h3><p>The first function we’ll examine is:</p><pre>function CryptAcquireContext(phProv: PHCRYPTPROV;<br>                            pszContainer: LPAWSTR;<br>                            pszProvider: LPAWSTR;<br>                            dwProvType: DWORD;<br>                            dwFlags: DWORD): BOOL; stdcall;</pre><p>In most cases, working with Windows cryptographic capabilities begins with this function, which connects to a cryptographic provider and returns its handle in the phProv parameter. A cryptographic provider is a DLL - an independent software module that actually executes cryptographic algorithms.</p><p>Providers vary in their feature sets (some are limited to digital signatures only), supported algorithms (some encrypt with RC2, others with DES), and other capabilities. Each operating system has its own set of providers, but all include the Microsoft Base Cryptographic Provider v1.0.</p><p>When calling CryptAcquireContext, you must specify the provider name and type (in parameters pszProvider and dwProvType). The provider type determines available functions and supported algorithms:</p><p><strong>Type PROV_RSA_FULL:</strong></p><ul><li>Key exchange: RSA algorithm</li><li>Digital signature: RSA algorithm</li><li>Encryption: RC2 and RC4 algorithms</li><li>Hashing: MD5 and SHA algorithms</li></ul><p><strong>Type PROV_RSA_SIG:</strong></p><ul><li>Key exchange: not supported</li><li>Digital signature: RSA algorithm</li><li>Encryption: not supported</li><li>Hashing: MD5 and SHA algorithms</li></ul><p>Microsoft Base Cryptographic Provider v1.0 is type PROV_RSA_FULL and is used by default for this type (if you specify nil for pszProvider).</p><p>The pszContainer parameter specifies the key container name. Each provider maintains a database storing user keys grouped in containers. Only key pairs for asymmetric algorithms are saved; session keys aren&#39;t stored since they shouldn&#39;t be reused.</p><p>Each container has a name and contains one key pair each for digital signatures and key exchange. Depending on the provider, the database might be stored in files, registry, or hardware, but this doesn’t affect how programmers work with key containers.</p><p>If you specify nil for pszContainer, the system uses a container named after the logged-in user. However, this isn&#39;t recommended: if two applications use the same container, one might modify or destroy keys needed by the other. It&#39;s better to use containers named after your application.</p><p>The dwFlags parameter can be zero or one of these values:</p><ul><li><strong>CRYPT_VERIFYCONTEXT</strong>: For applications that shouldn’t access private keys in containers. Such applications can only use hashing functions, signature verification, or symmetric encryption. In this case, pszContainer must be nil.</li><li><strong>CRYPT_NEWKEYSET</strong>: Creates a new key container, but doesn’t create the keys themselves.</li><li><strong>CRYPT_DELETEKEYSET</strong>: Deletes the container and its stored keys. If this flag is set, no provider connection occurs and phProv is undefined.</li><li><strong>CRYPT_MACHINE_KEYSET</strong>: By default, key containers are saved as user-specific. For basic providers, this means containers are saved in user profiles. This flag can be combined with others to specify that the container is machine-wide (stored in All Users profile).</li></ul><p>On success, the function returns true; otherwise false. GetLastError returns the error code.</p><pre>function CryptReleaseContext(hProv: HCRYPTPROV; dwFlags: DWORD): BOOL; stdcall;</pre><p>Releases the cryptographic provider and key container context. hProv is the provider handle from CryptAcquireContext. dwFlags is reserved and must be zero.</p><p>Here’s an example using these functions:</p><pre>uses Wcrypt2;</pre><pre>procedure CryptProc;<br>var<br>  Prov: HCRYPTPROV;<br>begin<br>  CryptAcquireContext(@Prov, nil, nil, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);<br>  // Work with CryptoAPI functions<br>  // ...<br>  CryptReleaseContext(Prov, 0);<br>end;</pre><h3>Hashing and Digital Signatures</h3><pre>function CryptCreateHash(hProv: HCRYPTPROV;<br>                        Algid: ALG_ID;<br>                        hKey: HCRYPTKEY;<br>                        dwFlags: DWORD;<br>                        phHash: PHCRYPTHASH): BOOL; stdcall;</pre><p>This function creates a hash object in the system and returns its handle in phHash. Data input to the hash object is transformed and its hash is stored internally.</p><p>The hProv parameter requires the provider handle from CryptAcquireContext. Algid specifies which hashing algorithm to use. For Microsoft Base Cryptographic Provider, valid values are: CALG_MAC, CALG_MD2, CALG_MD5, CALG_SHA. Usually (when not using algorithms requiring secret keys like MAC), set hKey to zero. dwFlags is reserved for future use and must be zero.</p><pre>function CryptDestroyHash(hHash: HCRYPTHASH): BOOL; stdcall;</pre><p>Destroys a hash object created with CryptCreateHash.</p><pre>function CryptHashData(hHash: HCRYPTHASH;<br>                      const pbData: PBYTE;<br>                      dwDataLen: DWORD;<br>                      dwFlags: DWORD): BOOL; stdcall;</pre><p>Adds data to a hash object. Can be called multiple times when data is processed in chunks. For Microsoft Base Cryptographic Provider, dwFlags must be zero.</p><pre>function CryptSignHash(hHash: HCRYPTHASH;<br>                      dwKeySpec: DWORD;<br>                      sDescription: LPAWSTR;<br>                      dwFlags: DWORD;<br>                      pbSignature: PBYTE;<br>                      pdwSigLen: PDWORD): BOOL; stdcall;</pre><p>Calculates a digital signature from a hash value. dwKeySpec specifies which key to use: AT_SIGNATURE or AT_KEYEXCHANGE (logically, use AT_SIGNATURE). Keys must exist in the container. sDescription can contain a descriptive string but isn&#39;t recommended as it reduces security.</p><p>If you don’t know the required buffer size, set pbSignature to nil and the function will return the needed size in pdwSigLen.</p><pre>function CryptVerifySignature(hHash: HCRYPTHASH;<br>                             const pbSignature: PBYTE;<br>                             dwSigLen: DWORD;<br>                             hPubKey: HCRYPTKEY;<br>                             sDescription: LPAWSTR;<br>                             dwFlags: DWORD): BOOL; stdcall;</pre><p>Verifies a digital signature. hPubKey is the public key handle corresponding to the private key used for signing.</p><p>Here’s a simplified example (without proper error handling):</p><p><strong>Creating a signature:</strong></p><pre>function SignMessage(Message: String): String;<br>var<br>  Prov: HCRYPTPROV;<br>  Hash: HCRYPTHASH;<br>  BufLen: DWORD;<br>begin<br>  Result := &#39;&#39;;<br>  CryptAcquireContext(@Prov, nil, nil, PROV_RSA_FULL, 0);<br>  CryptCreateHash(Prov, CALG_MD5, 0, 0, @Hash);<br>  CryptHashData(Hash, PByte(Message), Length(Message), 0);<br>  <br>  BufLen := 0;<br>  CryptSignHash(Hash, AT_SIGNATURE, nil, 0, nil, @BufLen);<br>  if BufLen &gt; 0 then begin<br>    SetLength(Result, BufLen);<br>    CryptSignHash(Hash, AT_SIGNATURE, nil, 0, PByte(Result), @BufLen);<br>  end;<br>  <br>  CryptDestroyHash(Hash);<br>  CryptReleaseContext(Prov, 0);<br>end;</pre><p><strong>Verifying a signature:</strong></p><pre>function VerifySign(Message, Sign: String): Boolean;<br>var<br>  Prov: HCRYPTPROV;<br>  Hash: HCRYPTHASH;<br>  PublicKey: HCRYPTKEY;<br>begin<br>  CryptAcquireContext(@Prov, nil, nil, PROV_RSA_FULL, 0);<br>  CryptCreateHash(Prov, CALG_MD5, 0, 0, @Hash);<br>  CryptHashData(Hash, PByte(Message), Length(Message), 0);<br>  <br>  // Import public key for signature verification (covered later)<br>  // ...<br>  <br>  Result := CryptVerifySignature(Hash, PByte(Sign), Length(Sign), PublicKey, nil, 0);<br>  <br>  // Destroy public key handle<br>  // ...<br>  <br>  CryptDestroyHash(Hash);<br>  CryptReleaseContext(Prov, 0);<br>end;</pre><h3>Password-Based Encryption</h3><p>CryptoAPI uses symmetric algorithms for encryption, with keys generated two ways: randomly or from user data like passwords. The latter requires that identical passwords produce identical keys.</p><pre>function CryptDeriveKey(hProv: HCRYPTPROV;<br>                       Algid: ALG_ID;<br>                       hBaseData: HCRYPTHASH;<br>                       dwFlags: DWORD;<br>                       phKey: PHCRYPTKEY): BOOL; stdcall;</pre><p>User data (password) is first hashed, and the hash object handle is passed as hBaseData. For Microsoft Base Cryptographic Provider, Algid can be CALG_RC2 or CALG_RC4. The upper 16 bits of dwFlags can specify key size in bits or be zero (for default size). Lower 16 bits can include flags like CRYPT_EXPORTABLE and CRYPT_CREATE_SALT.</p><h3>Encryption and Decryption</h3><pre>function CryptEncrypt(hKey: HCRYPTKEY;<br>                     hHash: HCRYPTHASH;<br>                     Final: BOOL;<br>                     dwFlags: DWORD;<br>                     pbData: PBYTE;<br>                     pdwDataLen: PDWORD;<br>                     dwBufLen: DWORD): BOOL; stdcall;</pre><p>The Final parameter should be true if this is the only or last data block. pbData points to the buffer containing data to encrypt; encrypted data replaces the original. To determine the required buffer size, pass nil for pbData.</p><pre>function CryptDecrypt(hKey: HCRYPTKEY;<br>                     hHash: HCRYPTHASH;<br>                     Final: BOOL;<br>                     dwFlags: DWORD;<br>                     pbData: PBYTE;<br>                     pdwDataLen: PDWORD): BOOL; stdcall;</pre><p>Parameters are similar to CryptEncrypt. pdwDataLen should contain the ciphertext length and will receive the plaintext length after decryption.</p><h3>Key Generation and Import/Export</h3><pre>function CryptGenKey(hProv: HCRYPTPROV;<br>                    Algid: ALG_ID;<br>                    dwFlags: DWORD;<br>                    phKey: PHCRYPTKEY): BOOL; stdcall;</pre><p>Generates random session keys and key pairs. Algid can also be AT_KEYEXCHANGE or AT_SIGNATURE for generating key pairs.</p><pre>function CryptGetUserKey(hProv: HCRYPTPROV;<br>                        dwKeySpec: DWORD;<br>                        phUserKey: PHCRYPTKEY): BOOL; stdcall;</pre><p>Retrieves key pairs from containers using AT_KEYEXCHANGE or AT_SIGNATURE.</p><pre>function CryptExportKey(hKey: HCRYPTKEY;<br>                       hExpKey: HCRYPTKEY;<br>                       dwBlobType: DWORD;<br>                       dwFlags: DWORD;<br>                       pbData: PBYTE;<br>                       pdwDataLen: PDWORD): BOOL; stdcall;</pre><p>Exports keys to binary buffers. dwBlobType values:</p><ul><li>SIMPLEBLOB: Session key</li><li>PUBLICKEYBLOB: Public key</li><li>PRIVATEKEYBLOB: Complete key pair</li></ul><pre>function CryptImportKey(hProv: HCRYPTPROV;<br>                       pbData: PBYTE;<br>                       dwDataLen: DWORD;<br>                       hPubKey: HCRYPTKEY;<br>                       dwFlags: DWORD;<br>                       phKey: PHCRYPTKEY): BOOL; stdcall;</pre><p>Imports previously exported keys.</p><h3>Secure Message Transfer Process</h3><ol><li>Recipient exports their public exchange key and sends it to the sender</li><li>Sender generates a random session key and encrypts the message with it</li><li>Sender imports recipient’s public exchange key and exports the session key encrypted with it</li><li>Encrypted message is sent along with encrypted session key (digital envelope)</li><li>Recipient imports the session key (decrypting with their private exchange key) and uses it to decrypt the message</li></ol><h3>Important Security Notes</h3><p>Due to historical US export restrictions, the base cryptographic provider only supports 40-bit keys for symmetric algorithms. The recommended 128-bit length for RC2 and RC4 requires using salt values. Use CRYPT_CREATE_SALT flag when generating keys:</p><pre>CryptGenKey(Prov, CALG_RC2, CRYPT_EXPORTABLE or CRYPT_CREATE_SALT, @Key);</pre><p>Salt values must be manually managed during export/import using CryptGetKeyParam and CryptSetKeyParam.</p><h3>Additional Libraries</h3><p>Several useful cryptographic libraries complement CryptoAPI:</p><ul><li><strong>HashLib 1.03</strong>: Implements numerous hashing algorithms including MD4, MD5, CRC32, HAVAL-128, SHA-1, SHA-256, TIGER-128, GOST, RIPEMD-128</li><li><strong>FGInt</strong>: Excellent library for working with large integers required for RSA operations</li><li><strong>DCPCrypt</strong>: Comprehensive component library for cryptographic functions</li><li><strong>RSATool2v17</strong>: RSA number generator for p, q, e, n, d values</li></ul><p>This guide provides the foundation for implementing robust cryptographic functionality in Delphi applications using Windows CryptoAPI.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fdacb128a2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>