Skip to content

Commit bbad017

Browse files
Elin FokineElin Fokine
authored andcommitted
Update the docs about overriding X509KeyStorageFlags.
1 parent 2ac0861 commit bbad017

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

docs/articles/bankid.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ This will use the real REST API for BankID, connecting to the Test environment.
216216

217217
It will automatically register both the root and client certificate, even though this behaviour can be disabled. A scenario might be that you want to use the same flow for both test and prod and therefore make sure that fetching the certificate from KeyVault works by trying that out for test. It could also be useful if you are running an older version of Active Login which contains an expired version of the test certificate. You can then disable using the embedded, expired certificate and provide the valid test certificate yourself.
218218

219-
BankId provides the client certificate for the test environment in three different versions FPTestcert5_20240610.p12, FPTestcert5_20240610.pem and FPTestcert5_20240610-legacy.pfx. Use `FPTestcert5_20240610.p12` for newer applications and environments that support modern encryption methods. Use `FPTestcert5_20240610.pem` if your application requires PEM format. Use `FPTestcert5_20240610-legacy.pfx ` for older applications requiring older algorithms such as Windows Server earlier versions than 2022. The format of the client certificate can be configured. By default `FPTestcert5_20240610-legacy.pfx `is used.
220-
221219
```csharp
222220
services
223221
.AddBankId(bankId =>
@@ -226,7 +224,7 @@ services
226224
});
227225
```
228226

229-
Disable adding the certificates:
227+
#### Disable adding the certificates
230228

231229
```csharp
232230
services
@@ -236,7 +234,9 @@ services
236234
});
237235
```
238236

239-
Specify client certificate format:
237+
#### Specify client certificate format
238+
239+
BankId provides the client certificate for the test environment in three different versions FPTestcert5_20240610.p12, FPTestcert5_20240610.pem and FPTestcert5_20240610-legacy.pfx. Use `FPTestcert5_20240610.p12` for newer applications and environments that support modern encryption methods. Use `FPTestcert5_20240610.pem` if your application requires PEM format. Use `FPTestcert5_20240610-legacy.pfx ` for older applications requiring older algorithms such as Windows Server earlier versions than 2022. The format of the client certificate can be configured. By default `FPTestcert5_20240610-legacy.pfx `is used.
240240

241241
```csharp
242242
services
@@ -246,6 +246,23 @@ services
246246
});
247247
```
248248

249+
#### Override default X509KeyStorageFlags
250+
251+
By default, `X509KeyStorageFlags.DefaultKeySet` is used when loading the embedded client certificate for the test environment.
252+
253+
If this default does not work in your environment, it is possible to override the `X509KeyStorageFlags` used when loading the certificate. This allows you to configure certificate handling in a way that is compatible with your specific hosting or security requirements.
254+
255+
```csharp
256+
services
257+
.AddBankId(bankId =>
258+
{
259+
bankId.UseTestEnvironment(
260+
keyStorageFlags: X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable
261+
);
262+
});
263+
```
264+
265+
249266
### Production environment
250267

251268
This will use the real REST API for BankID, connecting to the Production environment. It requires you to have the client certificates described under _Preparation_ above.

0 commit comments

Comments
 (0)