Scrivio Interview library

Secrets and cryptography

17 questions in 5 subtopics.

Secret management and Vault

ConceptFoundations6 min read
How does a Spring Boot application read secrets from HashiCorp Vault with Spring Cloud Vault, and why is that better than putting them in application.yml or environment variables?
DesignIntermediate7 min read
Design database credential handling for a Spring Boot service using Vault dynamic secrets. What happens when a lease expires, and how does the connection pool cope?
LeadershipAdvanced5 min read
Secret scanning found 1,200 credentials in your company's Git history and CI logs. How would you run the clean-up and change practices?
LeadershipPrincipal6 min read
Your security strategy aims to eliminate long-lived static secrets (database passwords, API keys, cloud keys) from applications. How would you plan this over several years?

Encryption at rest and in transit

CodingFoundations6 min read
Configure a Spring Boot 3.1 or later service to serve HTTPS using a PKCS12 keystore and to call another service with mutual TLS. Which feature lets you reuse the configuration?
DesignIntermediate6 min read
A service stores national ID numbers and bank details in PostgreSQL. The database volume is already encrypted. What else would you do, and how would you implement field-level encryption in a Spring Data JPA application?
DesignAdvanced6 min read
Define the encryption-in-transit standard for 100 services in a Kubernetes environment. Would you rely on a service mesh for mTLS or on application-level TLS?
LeadershipPrincipal6 min read
Enterprise customers ask to control the encryption keys for their data in your SaaS product (customer-managed keys). How would you decide whether to offer this and what would it mean for the architecture?

Java cryptography APIs

ConceptFoundations6 min read
Explain the difference between MessageDigest, Mac, Signature and Cipher in the Java Cryptography Architecture, and when to use SecureRandom.
DebuggingFoundations7 min read
Review this code and explain what is wrong:
Cipher c = Cipher.getInstance("AES");
c.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(FIXED_IV));
byte[] out = c.doFinal(data);
LeadershipPrincipal6 min read
Post-quantum cryptography standards are arriving (recent JDKs add ML-KEM and ML-DSA). How would you prepare a large Java estate for a change of cryptographic algorithms over the next decade?

Key rotation

ConceptFoundations6 min read
Why should applications rotate secrets regularly, and why does rotation often cause outages in practice?
ScenarioIntermediate7 min read
You must rotate the AES key used to encrypt customer data in a database with 500 million rows, without downtime. Describe the approach.
LeadershipAdvanced6 min read
Write a key and credential rotation policy for your organisation, covering signing keys, encryption keys, database passwords and API keys. What makes such a policy work in practice?

Base64 encoding

ConceptFoundations6 min read
A colleague stores API keys in the database 'encrypted with Base64'. Explain what Base64 is, why that is not encryption, and what to use instead.
CodingFoundations6 min read
Encode a 32-byte random token for use in a URL and decode it back in Java. Which Base64 variant do you choose and why?
DebuggingIntermediate7 min read
A signature check fails for some requests: the client sends an HMAC as Base64 in a query parameter, and about 1 in 10 requests fail. What is the likely cause?