Cryptography Fundamentals
- 47Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- βPrevious card
- βNext card
What does the word 'crypto' mean in Greek?
Hidden
Or swipe the card
47 cards
What does the word 'crypto' mean in Greek?
Hidden
What is the definition of cryptography?
The study (or science) of techniques of secret communication or secret writing.
What is the Node.js crypto module based on?
OpenSSL β it is a JavaScript wrapper on top of OpenSSL.
What are the two main types of encryption discussed?
Symmetric encryption (shared key) and asymmetric encryption (public/private key pair).
In cryptographic examples, what do the names Alice, Bob, and Eve represent?
Alice and Bob are two parties trying to communicate securely; Eve is an eavesdropper or malicious actor.
What is the purpose of encryption?
To allow two parties to communicate over an insecure channel without worrying about an eavesdropper understanding the original message.
What are the three inputs to a symmetric encryption algorithm?
Plaintext, key, and (optionally) an initialization vector (IV).
What is ciphertext?
The encrypted output that looks meaningless without the key.
What does AES stand for and what kind of algorithm is it?
Advanced Encryption Standard; it is a symmetric encryption standard widely used today.
What does 'AES-256-CBC' refer to?
AES with a 256-bit key (AES-256) and Cipher Block Chaining (CBC) mode.
Why is an initialization vector (IV) used in CBC mode?
To ensure that encrypting the same plaintext with the same key produces different ciphertext each time, preventing pattern analysis.
In Node.js crypto, how is an IV generated?
Using
crypto.randomBytes(size)to get a buffer of random bytes.What Node.js function returns a list of supported cipher algorithms?
crypto.getCiphers()How does Alice encrypt a message using Node.js crypto with AES-256-CBC?
She creates a cipher object using
crypto.createCipheriv(algorithm, key, iv), callscipher.update(plaintextBuffer), thencipher.final()to get the ciphertext.What is the Node.js function to decrypt with a symmetric algorithm?
crypto.createDecipheriv(algorithm, key, iv)Why should a human-memorable password not be used directly as a symmetric key?
Because passwords have low entropy, making them vulnerable to brute-force attacks; attackers can guess common passwords.
What is a Key Derivation Function (KDF)?
A function that derives a strong, long key from a weaker input such as a password.
What is a notable property of a KDF?
It is designed to be slow (CPU-heavy and memory-heavy) on purpose.
What is a 'salt' in the context of KDFs?
A random value used as an additional input to the KDF, unique per derivation.
Name three KDFs available in Node.js crypto.
scrypt (secure crypt), HKDF, and PBKDF2.
How is scrypt used in Node.js?
crypto.scrypt(password, salt, keylen, callback)or its synchronous counterpart; it returns the derived key.Why should
Math.random()not be used for cryptographic purposes?It is not cryptographically secure; its output can be predicted by an attacker.
What functions in Node.js crypto generate cryptographically secure random values?
crypto.randomBytes(size),crypto.randomFill(buffer),crypto.randomInt(min, max), andcrypto.randomUUID().What is the key distribution problem?
The challenge of securely sharing a symmetric key between two parties who cannot meet offline.
What is the Diffie-Hellman key exchange?
A method that allows two parties to generate a shared secret key over an insecure channel, without pre-sharing a key.
What are the steps of Diffie-Hellman key exchange?
- Alice chooses a prime, generator, and her private key; computes her public key and sends it to Bob. 2. Bob uses the same prime and generator with his private key to compute his public key; sends it to Alice. 3. Both compute the shared key using the other's public key.
What is the Node.js API for Diffie-Hellman key exchange?
crypto.createDiffieHellman(primeLength)orcrypto.createDiffieHellman(prime, generator); then usedh.generateKeys(),dh.getPublicKey(),dh.getPrivateKey(), anddh.computeSecret(otherPublicKey).What is a disadvantage of Diffie-Hellman key exchange?
It requires a separate key exchange with each party you want to communicate with, making it cumbersome for many parties.
What is RSA?
An asymmetric encryption algorithm that uses a public/private key pair; named after its inventors Rivest, Shamir, and Adleman.
In RSA, which key is used for encryption and which for decryption?
Encryption uses the public key; decryption uses the private key.
How does Bob generate an RSA key pair in Node.js?
Using
crypto.generateKeyPair('rsa', options, callback)with options likemodulusLength; it providespublicKeyandprivateKey.How does Alice encrypt a message with Bob's RSA public key?
Using
crypto.publicEncrypt(publicKey, buffer)with optional padding.How does Bob decrypt an RSA-encrypted message?
Using
crypto.privateDecrypt(privateKey, buffer)with the same padding configuration.What recent concern has been raised about RSA?
Quantum computers can potentially break RSA encryption; it is showing its age.
What is signing in cryptography?
Creating a digital signature with a private key to prove that a message came from the claimed sender and has not been altered.
How does Alice sign a message in Node.js?
Using
crypto.sign(algorithm, data, privateKey), where algorithm is the hash function (e.g., 'SHA256').How does Bob verify a signature from Alice?
Using
crypto.verify(algorithm, data, publicKey, signature)which returns true or false.What does HMAC stand for?
Hash-based Message Authentication Code.
What problem does signing alone not solve?
It does not prove that a public key truly belongs to a specific identity (e.g., Alice); an attacker could claim to be Alice and post a different public key.
What is a digital certificate?
A document that binds a public key to an entity (subject) and is signed by a trusted issuer (CA).
What are the four components of a certificate?
- Subject (who it is issued to) 2. Claim/property (e.g., public key) 3. Issuer (who issued it) 4. Signature (by issuer).
What is a Certificate Signing Request (CSR)?
A message sent from an applicant to a certificate authority (CA) to request a certificate; it contains the public key and subject info, to be signed by the CA.
How does Bob verify Alice's certificate using Carol's certificate?
Bob reads Carol's certificate to get Carol's public key, then uses that key to verify the signature on Alice's certificate.
What is a certificate chain (or hierarchy)?
A chain of certificates where each certificate is signed by the next one up to a root certificate that is inherently trusted.
How do you read a certificate in Node.js?
Using
new crypto.X509Certificate(certBuffer)to parse a PEM or DER certificate.What property on an X509Certificate gives the common name (CN) of the subject?
certificate.subject(e.g.,'CN=Alice'), or via.subjectstring containing the distinguished name.What is the Web Crypto API?
A browser-based API for performing cryptographic operations in JavaScript, similar to Node.js crypto but with different interfaces.

Ask anything
We've read this whole study set, so questions about it get the best answers.