---
id: change/bcapps/9402
type: change
title: "#9402 Fix RSA private key PEM import"
summary: RSA private key import from PEM format now works correctly by using the proper RSA cryptographic service provider type instead of the base RSA type.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit rsa impl.
system: administration
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:12:24.818Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 9bd8b05a7d30d2fca2b9ba137735834a246e4971
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/9402
    title: "microsoft/BCApps#9402: Fix RSA private key PEM import"
    date: "2026-07-17"
    commit: 9bd8b05a7d30d2fca2b9ba137735834a246e4971
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/1476
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 9402
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/9402
kind: pr
base_branch: main
major: "30"
merged_at: "2026-07-17T10:02:30Z"
author: JesperSchulz
author_type: User
community_contribution: false
labels:
  - "AL: System Application"
  - "Team: Integrations"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 3
  additions: 34
  deletions: 4
  al: 1
apps:
  - System Application
objects_touched:
  - key: codeunit/1476
    page: codeunit/1476
    type: codeunit
    id: 1476
    name: RSA Impl.
    app: System Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 619464
systems:
  - administration
quote: null
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #9402 Fix RSA private key PEM import

> RSA private key import from PEM format now works correctly by using the proper RSA cryptographic service provider type instead of the base RSA type.

[Pull request](https://github.com/microsoft/BCApps/pull/9402) · merged into `main` (BC30) on 2026-07-17 by JesperSchulz · 3 files (+34 -4), 1 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Fixes a runtime failure when RSA.ToSecretXmlString is called with a PEM private key
- The PEM is now imported into the RSACryptoServiceProvider type that RSAEncryptionHelper.ImportFromPem requires
- PEM key material stays wrapped as SecretText outside the existing non-debuggable helper
- The test app gets friend access so it can reuse the internal PEM export helper
- A test was added for importing a private key from PEM. The public API is unchanged
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 1476 "RSA Impl."](../../objects/codeunit/1476.md), System Application: modified

## Context

- Work items: AB#619464
- Labels: AL: System Application, Team: Integrations
- Systems: administration

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
