CLOUD CONCEPT

Public-Key Cryptography

Public-key cryptography uses mathematically related public and private keys to support encryption, digital signatures, and secure key establishment.

Cloud Concepts Hub →

What is Public-Key Cryptography

A public key can be distributed, while its corresponding private key must remain secret and under its owner's control. This separation enables cloud systems to authenticate servers and users, establish encrypted connections, and verify signed data without sharing a single secret with every participant.

Public-key cryptography, also called asymmetric cryptography, uses a pair of mathematically related keys. Disclosing the public key should not make deriving the private key computationally feasible when appropriate algorithms and key sizes are used. Depending on the algorithm, the pair supports encryption, digital signatures, or key agreement. These operations are distinct: RSA can support encryption and signatures through different schemes, while Ed25519 is a signature algorithm, not an encryption algorithm.

For confidentiality, an appropriate encryption scheme allows someone to encrypt data with the recipient's public key so that only the corresponding private key can decrypt it. For signatures, the private key signs data and the public key verifies the signature. A signature provides integrity and evidence that the signer controls the private key; it does not hide the signed data. Describing signing as simply encrypting with a private key is misleading and does not accurately describe modern signature schemes.

Cloud connections typically combine asymmetric and symmetric cryptography. During a modern TLS handshake, certificates and signatures authenticate the server, while key agreement establishes shared secrets from which symmetric traffic keys are derived. Symmetric encryption then protects application traffic efficiently. Public-key cryptography is generally not used to encrypt large application payloads directly because it is more computationally expensive and, for encryption schemes such as RSA-OAEP, has strict message-size limits.

A certificate binds a public key to an identity through an issuer's signature. An X.509 server certificate includes identity information, validity dates, and extensions such as subject alternative names. Clients must validate the certificate chain, validity period, intended usage, and requested hostname. Possessing a certificate alone does not prove ownership: the server must also demonstrate control of the corresponding private key. A certificate signing request contains the public key and requested identity information, not the private key.

For a local HTTPS development endpoint, OpenSSL can generate a private key and a self-signed certificate. For example, run openssl req -x509 -newkey rsa:3072 -sha256 -days 7 -keyout dev.key -out dev.crt -subj '/CN=localhost' -addext 'subjectAltName=DNS:localhost'. This command prompts for a passphrase to protect the private key. A self-signed certificate is not automatically trusted by browsers or other clients; explicitly configure trust in the development environment rather than disabling certificate validation. For teams, a dedicated development certificate authority can provide a more manageable trust model.

SSH uses public-key cryptography for authentication without requiring an X.509 certificate. Generate a development key pair with ssh-keygen -t ed25519 -f ~/.ssh/dev_ed25519 and choose a passphrase. Install only the .pub file's contents in the target user's authorized_keys file, and keep the private key on the client with restrictive permissions, such as chmod 600 ~/.ssh/dev_ed25519. SSH authentication proves possession through a signature; it does not send the private key to the server. Verify the server's host-key fingerprint separately to avoid connecting to an impostor.

In cloud environments, certificate managers automate certificate issuance and deployment, virtual machines accept SSH public keys, and managed key services protect asymmetric private keys for signing or decryption. Keep development and production keys separate, never commit private keys to source control, and plan certificate renewal and key replacement. A passphrase protects a stored private-key file but does not eliminate risk after the key is unlocked. Replacing a compromised SSH key also requires removing its old public key from every authorized location; issuing a new pair alone does not revoke access.

Key aspects of Public-Key Cryptography

Public-key cryptography depends on protected private keys, authentic public keys, appropriate algorithms, and correctly managed trust relationships.

Separate public and private keys

Distribute public keys as needed, but restrict access to private keys. Public keys are not confidential, yet their authenticity must be verified before trusting them.

Algorithm-specific capabilities

Choose algorithms according to the required operation: encryption, signing, or key agreement. Do not assume that every asymmetric key type supports all three.

Certificates bind keys to identities

Certificates associate a public key with an identity through an issuer's signature. Correct validation requires a trusted chain and checks such as hostname matching and expiration.

Proof of private-key possession

TLS and SSH use cryptographic proofs to establish that a peer controls its private key without transmitting that key. SSH user authentication and SSH server host authentication are separate checks.

Hybrid encryption for efficiency

Protocols typically use asymmetric operations to authenticate peers and establish secrets, then symmetric encryption to protect bulk data. This avoids the performance and message-size limitations of direct asymmetric encryption.

Key and trust lifecycle management

Protect private keys with appropriate storage, permissions, and access controls, and renew certificates before expiration. After compromise, replace keys and remove or revoke the old trust relationships wherever they remain valid.

Cloud services for Public-Key Cryptography

These services address different parts of public-key operations. EC2 applies SSH key pairs to instance access, while ACM manages TLS certificates for supported application endpoints. AWS Private CA supplies certificates for internal trust domains, which require explicit trust configuration on clients. AWS KMS provides protected asymmetric operations for application workflows without distributing private keys. A development environment might use a locally generated SSH key for EC2 access and an ACM-managed certificate for its HTTPS endpoint. Keep these credentials separate: an SSH key pair, a TLS certificate and private key, and a KMS key serve different purposes and are not interchangeable.

Amazon EC2 image Amazon EC2

EC2 key pairs support SSH access to Linux instances by placing the public key on the instance while the client retains the private key. You can import a locally generated public key; EC2-generated private key material is available for download only when the key pair is created.

Open Amazon EC2 →
AWS Private Certificate Authority image AWS Private Certificate Authority

AWS Private CA issues certificates under a private certificate hierarchy for internal identities and endpoints. Clients must explicitly trust the appropriate private CA; these certificates are not automatically trusted by public browsers.

Open AWS Private Certificate Authority →