public-keys
Uma chave pública é uma chave criptográfica que pode ser compartilhada com qualquer pessoa e é usada para verificar a autenticidade de uma assinatura digital ou para criptografar dados.
Public keys are a fundamental component of asymmetric cryptography, also known as [public-key cryptography](/pt/terms/public-key-cryptography). In this system, a pair of mathematically related keys is generated: a public key and a private key. The public key can be freely distributed without compromising security, while the private key must be kept secret by its owner.
The primary functions of public keys are:
- Encryption: Data encrypted using a recipient's public key can only be decrypted using the corresponding private key. This ensures confidentiality, as only the intended recipient can read the message. Anyone can use the public key to encrypt a message for the owner of the private key.
- Signature Verification: A user can create a digital signature for a message using their private key. Others can then use the corresponding public key to verify that the signature is authentic and that the message has not been tampered with since it was signed. This provides authenticity and integrity.
The mathematical relationship between the keys is based on computationally hard problems, such as the factorization of large numbers (RSA) or the discrete logarithm problem (Diffie-Hellman, Elliptic Curve Cryptography). It is computationally infeasible to derive the private key from the public key alone.
Public keys are typically represented as long strings of alphanumeric characters. They are often distributed through public key infrastructure (PKI), which includes mechanisms like digital certificates to bind a public key to an identity, helping to prevent impersonation. Trade-offs in choosing cryptographic algorithms involve balancing security levels, key size, computational performance, and resistance to future threats (like quantum computing).
graph LR
Center["public-keys"]:::main
Pre_cryptography["cryptography"]:::pre --> Center
click Pre_cryptography "/terms/cryptography"
Pre_asymmetric_encryption["asymmetric-encryption"]:::pre --> Center
click Pre_asymmetric_encryption "/terms/asymmetric-encryption"
Center --> Child_wallet_address["wallet-address"]:::child
click Child_wallet_address "/terms/wallet-address"
Rel_private_keys["private-keys"]:::related -.-> Center
click Rel_private_keys "/terms/private-keys"
Rel_digital_signatures["digital-signatures"]:::related -.-> Center
click Rel_digital_signatures "/terms/digital-signatures"
Rel_hashing["hashing"]:::related -.-> Center
click Rel_hashing "/terms/hashing"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧠 Teste de conhecimento
🧒 Explique como se eu tivesse 5 anos
Think of a [public key](/pt/terms/public-key) like your home mailbox address. Anyone can see it and drop a letter (encrypted message) in, but only you have the special key ([private key](/pt/terms/private-key)) to open the mailbox and read the letters.
🤓 Expert Deep Dive
Public keys are the public component of an asymmetric key pair, generated using algorithms like RSA, ECC (Elliptic Curve Cryptography), or Diffie-Hellman. In RSA, the public key consists of an exponent 'e' and a modulus 'n' (product of two large primes), used for encryption (C = M^e mod n). Decryption requires the private key, which includes the exponent 'd' derived from the prime factors of 'n'. The security relies on the difficulty of factoring 'n'.
In ECC, public keys are points on an elliptic curve, derived by scalar multiplication of a base point (G) with the private key (k): Q = k * G. Verification of a signature (created using the private key 'k') involves checking an equation using the public key 'Q', the message hash, and random nonces, leveraging the difficulty of the Elliptic Curve Discrete Logarithm Problem (ECDLP).
Public keys are essential for establishing secure communication channels (e.g., TLS/SSL), verifying digital signatures, and managing cryptocurrency wallets. The concept of a "trust anchor" is crucial in PKI, where a root certificate's public key is implicitly trusted, and subsequent certificates are verified hierarchically. Vulnerabilities can arise from weak key generation, improper implementation (e.g., side-channel attacks), or the eventual threat of quantum computers breaking current asymmetric algorithms, necessitating research into post-[quantum cryptography](/pt/terms/post-quantum-cryptography).