Asymmetric encryption · التشفير غير المتماثل
Two keys instead of one
- Symmetric encryption has a problem: you must somehow share the secret key first.
- Asymmetric encryption uses a pair of keys: a public key and a private key.
مفتاحين بدلاً من واحد
- التشفير المتماثل لديه مشكلة: يجب عليك بطريقة ما مشاركة المفتاح السري مسبقًا.
- التشفير غير المتماثل يستخدم زوجًا من المفاتيح: مفتاح عام ومفتاح خاص.
The padlock idea
- Your public key is like an open padlock you hand out to everyone.
- Anyone can lock a message shut with it — but only your private key can open it.
- So people send you secrets safely without ever sharing a secret key. That is the breakthrough.
فكرة القفل
- مفتاحك العام يشبه قفلاً مفتوحاً تسلمه للجميع.
- يمكن لأي شخص قفل رسالة به — لكن لا يمكن فتحه إلا بـمفتاحك الخاص.
- لذلك يرسلون لك الأسرار أماناً دون مشاركة مفتاح سري أبداً. هذا هو الإنجاز الكبير.
A tiny RSA
- RSA is real asymmetric encryption. With tiny numbers you can see it work:
- Encrypting and decrypting use different keys, yet the message comes back.
RSA صغيرة جداً
- RSA تشفير غير متماثل حقيقي. بأرقام صغيرة يمكنك رؤية كيف يعمل:
n, e, d = 33, 3, 7 # public key (e, n), private key (d, n)
cipher = (7 ** e) % n # lock 7 with the public key
print((cipher ** d) % n) # unlock with the private key -> 7
- التشفير والفك يستخدمان مفاتيح مختلفة، ومع ذلك تعود الرسالة كما هي.
Where you use it daily
- It also works in reverse for digital signatures (next lessons).
- Every time you see HTTPS, asymmetric encryption is quietly setting up a secure connection.
Covers: IGCSE 2.3 (asymmetric, public/private keys), A-Level 17.1, AP CSP.
حيث تستخدمه يومياً
- يعمل أيضاً بالعكس لـالتواقيع الرقمية (في الدروس التالية).
- كل مرة ترى فيها HTTPS، يكون التشفير غير المتماثل يقوم بهدوء بإعداد اتصال آمن.
يغطي: IGCSE 2.3 (غير متماثل، المفاتيح العامة/الخاصة)، A-Level 17.1، AP CSP.
Common mistakes
- A public key encrypts; only the matching private key decrypts.
- Never share the private key.
أخطاء شائعة
- المفتاح العام يشفر؛ والمفتاح الخاص المطابق فقط يفك الشيفرة.
- لا تشارك المفتاح الخاص أبداً.
Public & private keys · المفاتيح العامة والخاصة
Anyone encrypts with your public key; only your private key decrypts. · أي شخص يشفر باستخدام مفتاحك العام؛ فقط مفتاحك الخاص يفك التشفير.
Here is a tiny RSA with public key (e, n) and private key (d, n). Encrypt message with the public key (cipher = message**e % n), then decrypt with the private key (plain = cipher**d % n). Print plain — it should return to the original. · إليك RSA صغير بمفتاح عام (e, n) ومفتاح خاص (d, n). قم بتشفير message باستخدام المفتاح العام (cipher = message**e % n)، ثم فك التشفير باستخدام المفتاح الخاص (plain = cipher**d % n). اطبع plain — يجب أن يعود إلى القيمة الأصلية.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.
The same keys also work in reverse — that is a digital signature. Sign with the private key (sig = message**d % n), then let anyone verify with the public key (sig**e % n). Print whether the verified value equals message. · نفس المفاتيح تعمل أيضًا عكس الاتجاه — وهذا هو التوقيع الرقمي. قم بالتوقيع بالمفتاح الخاص (sig = message**d % n)، ثم دع أي شخص يتحقق منه بالمفتاح العامة (sig**e % n). اطبع ما إذا كانت القيمة المُتحقّقة تساوي message.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.