Skip to content

Cryptography and PKI Interview Questions for Cyber Security

24 Cryptography and PKI questions with answers for cyber security roles — 9 easy, 6 medium, 9 hard.

About Cryptography and PKI

Understand how encryption, hashing and digital signatures protect data at rest and in transit. This topic covers AES-GCM, RSA and elliptic curves, password hashing with Argon2id, TLS certificates, PKI, revocation, HSMs, key management and post-quantum cryptography, with hands-on OpenSSL and GPG commands used in daily security work.

Sheet progressStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

What is PKI?

Save to ▾
Show answer
Public Key Infrastructure is the system of certificate authorities, certificates, policies and revocation services that binds public keys to identities. A CA signs a certificate saying this public key belongs to this domain or user. Browsers and operating systems trust a set of root CAs, which sign intermediate CAs, which sign end-entity certificates. Enterprises run internal PKI for device certificates, VPN, Wi-Fi 802.1X and code signing.
02

What is a digital signature and how does it work?

Save to ▾
Show answer
A digital signature proves who created data and that it has not changed. The signer hashes the data and signs the hash with their private key using algorithms like RSA-PSS, ECDSA or Ed25519. Anyone with the public key can verify it. Signatures give integrity, authentication and non-repudiation, and are used in software updates, TLS certificates, e-sign documents and signed emails.
03

What is a salt and why is it used in password hashing?

Save to ▾
Show answer
A salt is a unique random value stored with each password hash. It makes identical passwords produce different hashes, so precomputed rainbow tables are useless and attackers must crack each hash separately. Salts are not secret. A pepper is an additional secret kept outside the database. Combined with slow algorithms like Argon2id, bcrypt or scrypt, salting makes offline cracking much more expensive.
04

What is the difference between encoding, encryption and obfuscation?

Save to ▾
Show answer
Encoding, like Base64 or URL encoding, changes data format for transport and is reversible by anyone, so it gives no security. Encryption makes data unreadable without a key. Obfuscation makes code or data harder to understand but does not use a secret key, so a determined analyst can reverse it. A common mistake is treating Base64 credentials in config files as protected.
05

A developer wants to write their own encryption algorithm for customer data. How do you respond?

Save to ▾
Show answer
I would advise against it. Custom cryptography almost always has flaws that experts would find, and it fails audits. Instead, use well-reviewed libraries such as libsodium, platform crypto APIs, or the cloud KMS with AES-GCM and envelope encryption. I would offer to help choose the right library and key management design, and include a security review in the feature's pull request.
06

How do you inspect a certificate and check its chain?

Save to ▾
Show answer
Use OpenSSL to view the fields and verify the chain against the CA bundle. openssl x509 -in cert.pem -noout -subject -issuer -dates -ext subjectAltName openssl verify -CAfile chain.pem cert.pem openssl s_client -connect portal.example.in:443 -showcerts Check the SAN matches the hostname, the dates are valid, and the server sends intermediate certificates.
07

How do you encrypt and decrypt a file using GPG?

Save to ▾
Show answer
For sharing, use the recipient's public key; for personal storage, use symmetric mode with a strong passphrase. gpg --encrypt --recipient analyst@example.in report.pdf gpg --output report.pdf --decrypt report.pdf.gpg gpg --symmetric --cipher-algo AES256 backup.tar Verify the recipient key fingerprint out of band before trusting it.
08

Tell me about a time you learned a difficult technical topic quickly.

Save to ▾
Show answer
Situation: in my final year project I needed TLS mutual authentication for an IoT prototype within two weeks. Task: understand PKI enough to build it. Action: I read the TLS 1.3 overview, set up a small CA with OpenSSL, issued device certificates and tested failures deliberately. Result: the demo worked, and I documented the steps so classmates could reuse them, which helped our team score well.
09

Describe a time you had to admit you did not know something in a technical discussion.

Save to ▾
Show answer
Situation: in a design review, an architect asked me whether our VPN supported post-quantum key exchange. Task: give an accurate answer. Action: I said I did not know rather than guessing, checked the vendor documentation and release notes that afternoon and shared a short summary with options. Result: the team trusted my answers more, and the finding was added to our cryptography roadmap.
10

What is forward secrecy?

Save to ▾
Show answer
Forward secrecy means that if a server's long-term private key is stolen later, previously recorded sessions still cannot be decrypted. It is achieved with ephemeral key exchange, such as ECDHE, where a new key pair is created for each session and discarded. TLS 1.3 makes forward secrecy mandatory by removing static RSA key exchange, which is one reason older TLS configurations are considered weak.
11

What is certificate revocation and how is it checked?

Save to ▾
Show answer
Revocation invalidates a certificate before expiry, for example when its private key leaks. Methods are CRLs, which are signed lists of revoked serial numbers, and OCSP, where the client asks a responder about one certificate. OCSP stapling lets the server attach a fresh response to the handshake. Because revocation checking is unreliable, the industry is moving to much shorter certificate lifetimes, which reduces exposure.
12

What is a man-in-the-middle attack on TLS and how do certificates prevent it?

Save to ▾
Show answer
In a MITM attack, an attacker intercepts traffic and pretends to be the server. Certificates prevent this because the client checks that the server certificate chains to a trusted root, matches the hostname and is valid. An attacker cannot produce a valid certificate without the private key or a compromised CA. Certificate warnings that users click through, and apps that skip validation, break this protection.
13

A TLS certificate expired on the main customer portal and caused an outage. How do you prevent this in future?

Save to ▾
Show answer
First renew and deploy the certificate to restore service. For prevention, build a certificate inventory from scanning and CT logs, automate issuance and renewal with ACME where possible, and set alerts at 30, 14 and 7 days before expiry to a team mailbox, not an individual. Assign an owner per certificate and add expiry checks to monitoring dashboards, since shorter lifetimes are coming.
14

How do you create a private key and CSR with OpenSSL?

Save to ▾
Show answer
Generate a key, then a certificate signing request to send to a CA. openssl ecparam -genkey -name prime256v1 -out server.key openssl req -new -key server.key -out server.csr \ -subj "/CN=portal.example.in" \ -addext "subjectAltName=DNS:portal.example.in" openssl req -in server.csr -noout -text Keep server.key private with restricted file permissions.
15

How would you hash passwords correctly in Python?

Save to ▾
Show answer
Use a dedicated password hashing library with Argon2id, which handles salts and parameters automatically. from argon2 import PasswordHasher ph = PasswordHasher() stored = ph.hash(password) try: ph.verify(stored, attempt) if ph.check_needs_rehash(stored): stored = ph.hash(attempt) except Exception: deny_login() Never use plain SHA-256 or MD5 for passwords.
16

Why is AES-GCM preferred over AES-CBC?

Save to ▾
Show answer
AES-GCM is an authenticated encryption mode, so it gives confidentiality and integrity together, detecting any tampering through its authentication tag. AES-CBC gives only confidentiality and needs a separate MAC; mistakes in combining them caused padding oracle attacks. GCM is also fast with hardware support. Its main rule is never reusing a nonce with the same key, because reuse breaks both confidentiality and integrity.
17

What is the role of a Hardware Security Module?

Save to ▾
Show answer
An HSM is tamper-resistant hardware that generates, stores and uses cryptographic keys without exposing them. Keys never leave the device in plain form. Banks and payment processors use HSMs for PIN processing, card keys and signing, and CAs protect root keys with them. Cloud offerings include managed HSM and KMS services. HSMs are often required for compliance standards such as PCI DSS and certified to FIPS 140-3.
18

What is key management and why is it hard?

Save to ▾
Show answer
Key management covers generating, distributing, storing, rotating, backing up and destroying keys. It is hard because strong encryption is useless if keys sit in code, config files or shared drives. Good practice is a central KMS or vault, envelope encryption with data keys wrapped by master keys, automatic rotation, strict IAM on key usage and logging every decrypt call. Losing keys can also mean losing data permanently.
19

Your CISO asks whether the company needs to act on quantum computing risk now. What do you advise?

Save to ▾
Show answer
Large quantum computers could break RSA and elliptic curve cryptography using Shor's algorithm. NIST published post-quantum standards in 2024: ML-KEM for key exchange, and ML-DSA and SLH-DSA for signatures. Attackers can harvest encrypted traffic now and decrypt it later, so long-lived sensitive data is at risk. Organisations should inventory cryptography, prefer crypto agility, and test hybrid key exchange that browsers already support.
20

What is Certificate Transparency?

Save to ▾
Show answer
Certificate Transparency requires publicly trusted CAs to log every issued certificate in public append-only logs. Browsers require proof of logging before trusting a certificate. Domain owners can monitor these logs to detect certificates issued for their domains without permission, for example by a compromised CA or a phishing actor. Security teams also use CT logs for subdomain discovery and asset inventory.
21

You find an application storing user passwords as unsalted MD5. What do you recommend?

Save to ▾
Show answer
MD5 is fast and broken, so these hashes can be cracked quickly if leaked. Recommend Argon2id or bcrypt with proper cost settings. To migrate without forcing resets, wrap existing hashes: compute Argon2id over the MD5 value now, and on next login replace it with a direct Argon2id hash of the password. Also check whether the database was ever exposed, and enforce MFA.
22

A private key for an internal code-signing certificate was found on a shared drive. What actions do you take?

Save to ▾
Show answer
Treat it as compromised. Revoke the certificate with the CA, issue a new one with the key generated and stored in an HSM or cloud key service, and restrict signing to the build pipeline. Search for any binaries signed with the old key after the exposure time and investigate them. Remove the file, check drive access logs to see who opened it, and update the key handling policy.
23

How do you build a cryptography inventory for an organisation?

Save to ▾
Show answer
Combine several sources: scan network services for TLS versions, ciphers and certificate keys; query CT logs and internal PKI for issued certificates; use code scanning to find crypto library calls and hardcoded keys; and export KMS and HSM key lists. Record algorithm, key length, owner, data sensitivity and expiry. This inventory supports compliance, certificate renewals and planning the post-quantum migration.
24

How would you set up envelope encryption for application data in the cloud?

Save to ▾
Show answer
Create a customer managed key in the cloud KMS with strict IAM so only the app role can use it. The app asks KMS for a data key, encrypts records locally with AES-GCM using the plaintext data key, stores the encrypted data key next to the data, and discards the plaintext key. To decrypt, it sends the encrypted data key to KMS. Enable key rotation and audit logging.

Frequently asked questions

How important is Cryptography and PKI in Cyber Security interviews?

Understand how encryption, hashing and digital signatures protect data at rest and in transit. This topic covers AES-GCM, RSA and elliptic curves, password hashing with Argon2id, TLS certificates, PKI, revocation, HSMs, key management and post-quantum cryptography, with hands-on OpenSSL and GPG commands used in daily security work.

How should I use the Cryptography and PKI sheet?

Go top to bottom — easy to hard. Answer before opening each answer, tick what you solved and save misses to Last-Minute Revision.