Capítulo 2 de 8

Keys, signatures and key custody

Key pairs, what a signature proves, RSA versus ECDSA, and where private keys should live.

Unos 12 minutos de lectura

Al terminar este capítulo podrá

  • Describe the relationship between a public and private key
  • Explain what signing and verifying mean mathematically, in outline
  • Compare RSA and ECDSA key sizes and explain why they differ
  • Choose appropriate storage for a private key

01A pair, not a password

A key pair is generated together. The two keys are mathematically linked: what one does, the other can undo or check. Crucially, you cannot compute the private key from the public key in any practical time. That one-way relationship is the whole basis of public key cryptography.

Public key
Published freely. Used to encrypt to you and to verify your signatures.
Private key
Secret. Used to decrypt and to sign. Compromise means impersonation until the certificate expires or is revoked.
Key pair
The two keys considered as a unit. Generated together; never mix halves from different pairs.
Key size
A number describing how large the underlying values are. Bigger is slower but harder to break.

02What a signature proves

Signing takes a message and the signer's private key and produces a signature. Anyone with the public key can verify that signature against the message. Verification succeeds only if the exact message was signed by the matching private key.

  1. 1

    Hash the message

    The signer computes a fixed-length digest, for example with SHA-256, so long messages can be handled efficiently.

  2. 2

    Sign the digest

    The hash is transformed using the private key to produce the signature.

  3. 3

    Send message and signature

    Both travel together. The signature is not secret; it is proof.

  4. 4

    Verify

    The receiver hashes the message again and checks the signature against the public key. Any change to the message makes verification fail.

Notice what this gives you. A signature proves origin (only the private key holder could make it) and integrity (the message has not changed). It does not encrypt anything, and it does not prove the signer had good intentions.

03RSA and ECDSA in one page each

Two families dominate today. You do not need the mathematics to work in PKI, but you do need to know how to choose and what breaks.

FamilyHow it works in outlineCommon sizesNotes
RSASecurity rests on the difficulty of factoring a very large number into two primes2048, 3072, 4096 bitsSimple to reason about, widely supported, larger keys and slower signatures
ECDSASecurity rests on the difficulty of the elliptic-curve discrete logarithm problemP-256, P-384Much smaller keys for equivalent security, faster on constrained devices

For new work, RSA 3072 or ECDSA P-256 are defensible defaults. The important point is not which you pick, but that you know which one each system uses — because the day you must migrate, that inventory is what saves you.

04Key custody: the part people skip

The certificate is public. The private key is the credential. Almost every serious PKI failure is a private key that leaked, was copied to a laptop, or was generated in the wrong place.

  • Never commit a private key to source control, and never paste it into a ticket or chat
  • On servers, prefer a hardware security module (HSM) or the operating system keystore over a plain file
  • On workstations, TPM-backed storage prevents simple file copies
  • Separate duties: the person who can export a key should not be the person who can approve its use without oversight
  • Rotate deliberately, and record who holds each copy

Para recordar

  • Key pairs are generated together; the private key cannot be derived from the public one
  • A signature proves origin and integrity, never intent or authorisation
  • RSA and ECDSA offer comparable strength at very different key sizes
  • Key custody, not algorithm choice, is where most real incidents happen