實現加解密機制。
Implement encryption and decryption mechanism.
新增加密工廠實例至 DI 容器中。
-
Add crypto factory instance to DI container
builder.Services.AddSingleton<ICryptoFactory, CryptoFactory>();
注入
ICryptoFactory
並建立ICryptoAlgorithm
來加解密資料。
- Create
ICryptoAlgorithm
with injectedICryptoFactory
to encrypt or decrypt your data.