From c31b0e4d10d4099133ec26285d6810a950f8f1d3 Mon Sep 17 00:00:00 2001 From: ghpZ54K8ZRwU62zGVSePPs97yAv9swuAY0mVDR4 <22887031+ghpZ54K8ZRwU62zGVSePPs97yAv9swuAY0mVDR4@users.noreply.github.com> Date: Sun, 9 Nov 2025 16:59:12 +0800 Subject: [PATCH] simplify key pair assignment in rsa tutorial removed unnecessary type casting for public and private keys . --- tutorials/rsa.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tutorials/rsa.md b/tutorials/rsa.md index 8912a449..a2bf7b48 100644 --- a/tutorials/rsa.md +++ b/tutorials/rsa.md @@ -128,14 +128,13 @@ generate the key pair. ```dart final pair = keyGen.generateKeyPair(); -final myPublic = pair.publicKey as RSAPublicKey; -final myPrivate = pair.privateKey as RSAPrivateKey; +final myPublic = pair.publicKey; +final myPrivate = pair.privateKey; ``` It returns an `AsymmetricKeyPair`, so the type for the `publicKey` and `privateKey` members are the abstract classes -`PublicKey` and `PrivateKey`. The members will need to be cast into -an `RSAPublicKey` and `RSAPrivateKey` to use them as RSA keys. +`PublicKey` and `PrivateKey`. ## Signing and verifying