- C U R S I LLO - Criptografía y certificación GnuPG y...
Transcript of - C U R S I LLO - Criptografía y certificación GnuPG y...
![Page 1: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/1.jpg)
nesys-st.com Seguridad Telemática Avanzada
- C U R S I LLO -- C U R S I LLO -
Criptografía y certificaciónCriptografía y certificación
GnuPG y OpenSSLGnuPG y OpenSSL07/06
![Page 2: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/2.jpg)
nesys-st.com Seguridad Telemática Avanzada
Objetivo:
Entender los conceptos detrás de la criptografía moderna, así como la problemática de la gestión de la confianza. Herramientas de aplicación criptográfica.
Dirigido a:
Gente con conocimientos básicos de redes, comunicaciones y sistemas basados en GNU/Linux
Profesor: [email protected]
![Page 3: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/3.jpg)
nesys-st.com Seguridad Telemática Avanzada
Duración: 6 horasFechas del curso: 10/07/2006 ~ 11/07/2006Horario: 16:00 - 19:00
julio de 2006
lu ma mi ju vi sá do 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2324 25 26 27 28 29 30 31
![Page 4: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/4.jpg)
nesys-st.com Seguridad Telemática Avanzada
- Índice -
Tema 1 Introducción a necesidades de seguridad
* Protocolos vulnerables, analizadores de redes
* Necesidades para la seguridad en las comunicaciones
o Privacidad
o Autenticación
o Integridad
o No repudio
![Page 5: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/5.jpg)
nesys-st.com Seguridad Telemática Avanzada
- Índice -
Tema 2 Introducción a la criptografía
* Bases de la criptografía, definiciones
* Criptografía simétrica ? Clave privada
* Criptografía asimétrica ? Clave pública
* Criptografía no reversible ? Hashing y HMAC
* Criptografía híbrida - Esquema de comunicaciones seguras
* Autenticación y firma digital
![Page 6: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/6.jpg)
nesys-st.com Seguridad Telemática Avanzada
- Índice -
Tema 3 Criptografía y la gestión de la confianza
* Modelos de Confianza: centralizada, cruzada y distribuida * PKI distribuida o Gestión personal de la confianza o Prácticas GPG y OpenPGP * PKI centralizadas o PKI y sus componentes: CAs, RAs, Directorios... o Autoridades de Certificación y Registro o Petición generación, distribución, validación y revocación de certificados o Prácticas OpenSSL, generación, gestión y revocación de certs * PKI desde el lado del cliente o Usos de certificados, formatos... o Aplicaciones: VPN, HTTPS, etc...
![Page 7: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/7.jpg)
nesys-st.com Seguridad Telemática Avanzada
TEMA 1: INTRODUCCIÓN A LAS NECESIDADES DE SEGURIDAD
![Page 8: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/8.jpg)
nesys-st.com Seguridad Telemática Avanzada
Objetivos de la seguridad de las comunicaciones
• Se trata de garantizar la confidencialidad, autenticidad, integridad, no repudio, control de acceso y disponibilidad de la información presente en las comunicaciones
• Esta información incluirá un posible intercambio de datos de autenticación de los comunicantes
• Todo esto se puede conseguir ayudado de la criptografía a través de la implantación de criptosistemas
![Page 9: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/9.jpg)
nesys-st.com Seguridad Telemática Avanzada
Conceptos teóricos I
* Confidencialidad: requiere que la información sea accesible
únicamente por las entidades autorizadas.
* Autenticidad: requiere una identificación correcta del origen del
mensaje, asegurando que la entidad no es falsa.
* Integridad: requiere que la información sólo pueda ser modificada
por las entidades autorizadas.
![Page 10: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/10.jpg)
nesys-st.com Seguridad Telemática Avanzada
Conceptos teóricos II
* No repudio: ofrece protección a un usuario frente a otro usuario
que niegue posteriormente que en realidad se realizó cierta
comunicación.
* Control de acceso: requiere que el acceso a los recursos
(información, capacidad de cálculo, nodos de comunicaciones,
entidades físicas, etc.) sea controlado y limitado por el sistema
destino.
* Disponibilidad: requiere que los recursos del sistema informático
estén disponibles a las entidades autorizadas cuando los necesiten.
![Page 11: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/11.jpg)
nesys-st.com Seguridad Telemática Avanzada
Amenazas a la seguridad I
✗ Interrupción: un recurso se vuelve no disponible. Este es un
ataque contra la disponibilidad.✗ Intercepción: una entidad no autorizada consigue acceso a un
recurso. Este es un ataque contra la confidencialidad. ✗ Modificación: una entidad no autorizada no sólo consigue acceder
a un recurso, sino que es capaz de manipularlo. Ataque contra la
integridad.✗ Fabricación: una entidad no autorizada inserta objetos falsificados
en el sistema. Este es un ataque contra la autenticidad.
![Page 12: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/12.jpg)
nesys-st.com Seguridad Telemática Avanzada
Amenazas a la seguridad II
![Page 13: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/13.jpg)
nesys-st.com Seguridad Telemática Avanzada
MECANISMOS DE SEGURIDAD I
- Intercambio de autenticación: corrobora que una entidad, ya
sea origen o destino de la información, es la deseada.
(Contraseñas, Certificados ...)
- Cifrado: garantiza que la información no es inteligible para
individuos, entidades o procesos no autorizados. (Cifrado de datos
con AES ...)
- Integridad de datos: para verificar que los datos no han sido
modificados en el trayecto (Hash o resumen de un mensaje)
![Page 14: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/14.jpg)
nesys-st.com Seguridad Telemática Avanzada
MECANISMOS DE SEGURIDAD II
- Firma digital: se enviará junto con los datos ordinarios,
garantizará la autenticidad y el no repudio de los datos
- Unicidad: consiste en añadir a los datos un número de
secuencia, la fecha y hora, un número aleatorio, o alguna
combinación de los anteriores, que se incluyen en la firma digital o
integridad de datos para darnos la unicidad en el tiempo.
![Page 15: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/15.jpg)
nesys-st.com Seguridad Telemática Avanzada
TEMA 2: CRIPTOGRAFÍA
![Page 16: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/16.jpg)
nesys-st.com Seguridad Telemática Avanzada
● La criptografía es la técnica, ciencia o arte de la escritura secreta.
● A la transformación del mensaje original en el mensaje cifrado (criptograma) le llamamos cifrado, y a la inversa, el paso del criptograma al mensaje original le llamamos descifrado.
● Estos pasos se realizan mediante un conjunto de reglas preestablecidas entre los comunicantes, definidas por el algoritmo, y dependientes (hace únicas las operaciones) de un valor numérico al que llamamos clave.
● El criptoanálisis es el conjunto de técnicas que intenta encontrar la clave utilizada en un algoritmo entre dos comunicantes.
![Page 17: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/17.jpg)
nesys-st.com Seguridad Telemática Avanzada
Definición
● Un conjunto finito (alfabeto), que permite representar tanto el texto en claro como el criptograma.
● A bajo nivel: bits,● A más alto nivel: caracteres ASCII o MIME.
● Un conjunto finito denominado espacio de claves. Constituido por la totalidad de las claves posibles del criptosistema.
● Familias de transformaciones aritmético-lógicas --> ● transformaciones de cifrado● transformaciones de descifrado
![Page 18: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/18.jpg)
nesys-st.com Seguridad Telemática Avanzada
Definición
• Partiendo de un mensaje M (compuesto por elementos del alfabeto) se consigue un criptograma C (también compuesto por elementos del alfabeto)
• El algoritmo de cifrado será un conjunto de funciones matemáticas que cogen como entrada el mensaje M y una clave de cifrado K
• Al criptograma C y a otra clave K’ (la de descifrado) se le aplica el algoritmo de descifrado y se consigue de nuevo M
![Page 19: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/19.jpg)
nesys-st.com Seguridad Telemática Avanzada
Cifrado vs Codificación
NO ES LO MISMO EL CIFRADO QUE LA CODIFICACIÓN
• Codificación: representación de la información de distintas formas, según diferentes criterios (lenguajes, alfabetos…), pero no necesariamente con cifrado
– Por ejemplo, un número decimal puede codificarse como hexadecimal, y no por ello se convierte en un criptograma.
![Page 20: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/20.jpg)
nesys-st.com Seguridad Telemática Avanzada
Algoritmo vs Clave
• Algoritmo: Descripción precisa de una sucesión de instrucciones que permiten llevar a cabo un trabajo en un número finito de pasos.
• Clave: Un valor numérico usado que hace que las operaciones hechas sean únicas. – Las claves son los valores concretos que junto con los algoritmos
criptográficos se usan para generar un texto cifrado concreto. Básicamente son números muy grandesnúmeros muy grandes
– Para computación, en bits -> Nº de bits de la clavePara computación, en bits -> Nº de bits de la clave– Un bit más -> doble seguridadUn bit más -> doble seguridad
![Page 21: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/21.jpg)
nesys-st.com Seguridad Telemática Avanzada
Criptosistemas abiertos VS cerrados
● Abiertos La fortaleza está en la clave usada y no en el algoritmo. Sistemas abiertos
● Cerrados La fortaleza reside en la clave y en el algoritmo. Sistemas propietarios
![Page 22: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/22.jpg)
nesys-st.com Seguridad Telemática Avanzada
Criptoanálisis y criptología
• Criptoanálisis: Técnicas orientadas a la ruptura de los códigos de la criptografía.
• Criptología: Ciencia que estudia las bases matemáticas de la criptografía y el criptoanálisis.
![Page 23: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/23.jpg)
nesys-st.com Seguridad Telemática Avanzada
• Antiguo Egipto: Escritura de jeroglíficos• Cifrado Cesar: Sustituir cada letra por otra 3 más allá en el abecedario• San Bernardino: Irregularidad de los símbolos• Tarjetas con agujeros perforados• Cifrado de Vignere: Cifrado por sustitución con uso de una clave• Primera y segunda guerra mundial: La dificultad de códigos daba
robustez
Historia
¡¡PREHISTORIA!!
• Explosión en el area de la computación• Explosión de la criptografía actual DES y RSA en los 70• Sistemas híbridos…
![Page 24: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/24.jpg)
nesys-st.com Seguridad Telemática Avanzada
Cifrado Cesar
![Page 25: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/25.jpg)
nesys-st.com Seguridad Telemática Avanzada
Criptografía Fuerte
• Del inglés strong cryptography
• La criptografía puede ser fuerte o débil• Se mide según el tiempo y esfuerzo (recursos usados)
necesarios para romperla
“There are two kinds of cryptography in this world: cryptography that will stop your kid sister from reading your files, and cryptography that will stop major governments from reading your files. Our trade is about the latter.”
![Page 26: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/26.jpg)
nesys-st.com Seguridad Telemática Avanzada
Tipos
• Reversible: Del mensaje cifrado se puede obtener el mensaje en claro original
• Irreversible: Del mensaje cifrado no se puede obtener el mensaje en claro original (hashing o resumen)
![Page 27: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/27.jpg)
nesys-st.com Seguridad Telemática Avanzada
Tipos
Hoy en día existen dos tipos de criptosistemas reversiblesreversibles:
● De clave simétrica (SKC): Una sola clave para cifrar y descifrar. También llamada de clave privada
● De clave asimétrica (PKC): Una clave cifrará y otra descifrará los mensajes, dichas claves estarán relacionadas de alguna manera (de modo que sea computacionalmente imposible sacar una de la otra)
¡DIFERENCIAMOS ENTRE ALGORITMO Y CLAVE!
![Page 28: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/28.jpg)
nesys-st.com Seguridad Telemática Avanzada
Cifrado con criptosistemas de clave secretaMedio de
k Transmisión kM C
Texto TextoBase Criptograma Base
EKMT DK
MC
protegida
Integridad
C’ no permitido
Intruso
EK
Confidencialidad
protegida
M no permitido
DK
La confidencialidad y la integridad se lograrán si se protegen las claves en el cifrado y en el descifrado. Es
decir, se obtienen simultáneamente si se protege la clave secreta.
DES, TDES, IDEA, CAST, RIJNDAEL
Criptosistemas simétricos
![Page 29: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/29.jpg)
nesys-st.com Seguridad Telemática Avanzada
Características
• La mayor dificultad La distribución de la clave– ¿Cómo se da a conocer la clave al receptor del mensaje?
¿Se necesita otro canal para esta transmisión?
• El procesado requerido es más simple y rápido que el de clave pública
![Page 30: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/30.jpg)
nesys-st.com Seguridad Telemática Avanzada
Clave simétrica (SKC)
• Algoritmos usados:1. DES: Nunca ha sido roto (salvo por fuerza bruta). Sujeto a las
leyes U.S.A.2. IDEA: Se usa en Europa. No está sujeto a leyes3. RC5: Su seguridad no está completamente probada4. Triple DES: Mejora del DES. Cifrado múltiple5. AES: Salto generacional del cifrado DES (estándar USA actual)6. TWOFISH: Evolución del blowfish. Libre y muy efectivo
![Page 31: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/31.jpg)
nesys-st.com Seguridad Telemática Avanzada
Clave simétrica (SKC)
• Ej: DES– De bloque, con bloques de 64 bits– Se le somete a 16 iteraciones– Clave de 56 bits (más 8 de paridad)
• Ataques típicos:1.Criptoanálisis diferencial2.Criptoanálisis lineal
![Page 32: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/32.jpg)
nesys-st.com Seguridad Telemática Avanzada
Problemas
• No sirve en relaciones que no son simétricas– yo tengo un secreto compartido con el banco; pero no
acepto que el banco firme órdenes como si fueran mías
• Y es un problema complejo distribuirlas y mantenerlas– si tuviéramos un canal seguro te contaría un secreto
para establecer un canal seguro :-)
![Page 33: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/33.jpg)
nesys-st.com Seguridad Telemática Avanzada
Esquemas
• Esquemas de cifrado:– De bloque: Encripta por bloques de datos. Hay diferentes
modos de implementación (EBC y CBC)
– De streams: Bit a bit. Con mecanismo de realimentación (CFB y OFB)
– De hash
![Page 34: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/34.jpg)
nesys-st.com Seguridad Telemática Avanzada
Clave simétrica (SKC)
• Velocidad de cifrado alcanzada por los diferentes algoritmos
![Page 35: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/35.jpg)
nesys-st.com Seguridad Telemática Avanzada
Cifrado con clave pública del receptorIntercambio de claves RSA
Intruso
Medio deClave públicadel usuario B Transmisión
M
CUsuario A Criptograma
EBMT DB
M
C
Clave privadadel usuario B
Usuario B protegida
Confidencialidad
M no permitido
DB
Observe que se cifra con la clave pública del destinatario.
Las claves de EB y DB son “inversas”
Intercambio: RSA y DH
Un sistema similar es el intercambio de clave de
Diffie y Hellman DH
Criptosistemas asimétricos (1)
![Page 36: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/36.jpg)
nesys-st.com Seguridad Telemática Avanzada
Cifrado con clave privada del emisorFirma digital RSA
Intruso
CriptogramaC
Medio deClave privadadel usuario A Transmisión
M
Usuario A
DAMT EA
M
C
Clave públicadel usuario A
Usuario B
DA
protegida
Integridad
C’ no permitidoObserve que se cifra con la clave privada del emisor.
Las claves de EA y DA son “inversas”
Se firma sobre un hash H(M) del mensaje, por ejemplo MD5 o SHA-1
Firmas: RSA y DSS
La firma DSS está basada en el algoritmo de cifra de El Gamal
Criptosistemas asimétricos (2)
![Page 37: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/37.jpg)
nesys-st.com Seguridad Telemática Avanzada
Tipos de cifra con sistemas asimétricos
Criptosistemas de clave pública
C
Integridad
Confidencialidad
La confidencialidad y la integridad se obtienen por separado
Firma digital
Información cifrada
Autenticación del usuario A;
integridad de M
EB DBDAM EA
M
Usuario A
Usuario B
k privadade A
k públicade A
k pública
de B
k privadade B
DA DB
![Page 38: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/38.jpg)
nesys-st.com Seguridad Telemática Avanzada
Clave asimétrica (PKC)
• Razón matemática para la existencia de este tipo de criptografía Dificultad matemática para hallar funciones inversas– Multiplicación vs Factorización– Exponenciación vs Logaritmos– Curvas elípticas
• El destinatario da a conocer su clave pública para posibilitar la recepción y el envío de mensajes
![Page 39: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/39.jpg)
nesys-st.com Seguridad Telemática Avanzada
Ejemplo – Distribución de claves
![Page 40: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/40.jpg)
nesys-st.com Seguridad Telemática Avanzada
Clave asimétrica (PKC)
• Ejemplo Diffie – Hellman:– Sea p = 97, g = 5– A elige su secreto: a = 36
• Publica su clave pública: Pa = 5^36 mod 97 = 50
– B elige su secreto: b = 58• Publica su clave pública: Pb = 5^68 mod 97 = 44
– A calcula k = Pba = 44^36 mod 97 = 75– B calcula k = Pab = 50^58 mod 97 = 75
• Esa será la clave a usar en las comunicaciones entre A y B
![Page 41: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/41.jpg)
nesys-st.com Seguridad Telemática Avanzada
Ejemplo: RSA (firma digital)
• Se cogen dos primos enteros muy grandes (p y q) y se calcula su producto p x q = n (el módulo)
• Se escoge un número e (menor que n), que sea relativamente primo a (p-1)(q-1), (e y (p-1)(q-1) no tienen factores en común salvo el número 1)
• Se busca otro número d, tal que (exd -1) es divisible por (p-1)(q-1)
• Los valores e y d se les denomina los exponentes público y privado, respectivamente
• La clave pública es el par (n,e), y la clave privada el par (n,d). • Los factores generadores p y q pueden ser destruidos o
mantenidos en secreto junto a la clave privada
![Page 42: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/42.jpg)
nesys-st.com Seguridad Telemática Avanzada
Clave asimétrica (PKC)
• Ejemplo RSA– Se cifra con la pública del receptor y así sólo el receptor puede
descifrarla
![Page 43: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/43.jpg)
nesys-st.com Seguridad Telemática Avanzada
Clave asimétrica (PKC)
![Page 44: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/44.jpg)
nesys-st.com Seguridad Telemática Avanzada
Clave asimétrica (PKC)
• Aplicaciones y usos:1.Intercambio de claves privadas2.Firma digital: se cifra un resumen del mensaje
• Las claves a emplear para que se considere seguro son mucho mayores que en SKC
• Difícil de implementar y lentitud del proceso de cálculo ¡¡No se usa para cifrar mensajes!! ¡¡Se usa para distribuir claves!!
![Page 45: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/45.jpg)
nesys-st.com Seguridad Telemática Avanzada
Clave asimétrica (PKC)
• Ideal para la distribución de claves
![Page 46: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/46.jpg)
nesys-st.com Seguridad Telemática Avanzada
Características PKC
![Page 47: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/47.jpg)
nesys-st.com Seguridad Telemática Avanzada
Funciones Hash
• Para resolver el problema de la integridad de los mensajes
• Realiza una transformación a un mensaje consiguiendo otro mensaje de longitud constante Valor de Hash
• Requerimientos:1. La entrada puede ser de cualquier longitud2. La salida tiene longitud fija (128, 160 o 256 bits)3. La transformación es de cálculo fácil4. La inversa es computacionalmente imposible5. Libre de colisiones
![Page 48: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/48.jpg)
nesys-st.com Seguridad Telemática Avanzada
Funciones Hash
• Algoritmos: MD5, SHA1
•Se usa para dos funciones:1.Integridad de mensajes2.Firmas digitales (autenticidad y no-repudio)
![Page 49: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/49.jpg)
nesys-st.com Seguridad Telemática Avanzada
HMAC
•Message Authentication Code
•Añade un password al hash
•Sólo el que posee la clave puede generar el hash
Los últimos estudios demuestran que existen colisiones en las funciones SHA-1 y MD5
![Page 50: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/50.jpg)
nesys-st.com Seguridad Telemática Avanzada
Proceso Hash
![Page 51: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/51.jpg)
nesys-st.com Seguridad Telemática Avanzada
MD5
• Inventado por Rivest RFC 1321• Coge un mensaje de entrada de longitud arbitraria y
produce una salida de 128 bits (message digest o resumen)
• Se trata de que computacionalmente sea imposible producir dos mensajes que tengan el mismo resumen, o que se pueda producir un mensaje con un resumen pre-especificado
• Para aplicaciones de firma digital: Un archivo grande se “comprime” de manera segura antes de aplicarle la clave privada para su transmisión por medio de un criptosistema PKC
![Page 52: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/52.jpg)
nesys-st.com Seguridad Telemática Avanzada
Ejemplos
• Para la integridad del SW• Vamos a descargarnos un SW:
– El propio calculador de Hash MD5– http://www.vonwangelin.com/md5/– Nos dice el hash MD5 de su ejecutable
![Page 53: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/53.jpg)
nesys-st.com Seguridad Telemática Avanzada
¿Qué usar, simétricos o asimétricos?
Los sistemas de clave pública son muy lentos pero tienen firma digital.Los sistemas de clave secreta son muy rápidos pero no tienen firma digital.
Cifrado de la información: Sistemas de clave secreta
Firma e intercambio de claves de sesión:Sistemas de clave pública
¿Qué hacer?
![Page 54: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/54.jpg)
nesys-st.com Seguridad Telemática Avanzada
Firma digitalsobre H(M)
Cifrado simétrico
Intercambio clave de sesión K usandoEB(M) en emisión y DB(C) en recepción
Autenticacióndel usuario e
integridad
K K
M EA M
Usuario A
k privadade A
Usuario B
k públicade A
Cifrado asimétrico
k secreta
KDA K
C
k secreta
Sistema híbrido de cifra y firma
![Page 55: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/55.jpg)
nesys-st.com Seguridad Telemática Avanzada
¿Por qué 3 técnicas?
• Cada esquema está optimizado para una aplicación
1. Hash: integridad de datos2. SKC: confidencialidad de los datos3. PKC: Intercambio de claves, autenticación y no-repudio
• Conseguimos un criptosistema híbrido
• Vemos resumen:– http://en.wikipedia.org/wiki/Cryptography
![Page 56: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/56.jpg)
nesys-st.com Seguridad Telemática Avanzada
Longitud de las claves
• En la criptografía el tamaño importael tamaño importa– La longitud de las claves es la encargada de proveer mayor
seguridad a los algoritmos de cifrado contra los ataques de fuerza bruta
• Cada día es mayor la capacidad de cálculo del hardware
![Page 57: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/57.jpg)
nesys-st.com Seguridad Telemática Avanzada
Longitud de claves
• Comparativa de nivel de seguridad en PKC y SKC
![Page 58: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/58.jpg)
nesys-st.com Seguridad Telemática Avanzada
Longitud de las claves (1995!!)TABLE 1. Minimum Key Lengths for Symmetric Ciphers.
Type of Attacker Budget Tool
Time and CostPer Key Recovered
Key Length NeededFor ProtectionIn Late-1995
40 bits 56 bits
Pedestrian Hacker
Tiny
Scavanged
computertime
1 week Infeasible 45
$400 FPGA 5 hours($0.08)
38 years($5,000)
50
Small Business $10,000 FPGA 12 minutes($0.08)
18 months($5,000)
55
Corporate Department $300K
FPGA 24 seconds($0.08)
19 days($5,000)
60
ASIC 0.18 seconds($0.001)
3 hours($38)
Big Company $10M
FPGA 7 seconds($0.08)
13 hours($5,000)
70
ASIC 0.005 seconds($0.001)
6 minutes($38)
Intelligence Agency $300M ASIC 0.0002
seconds($0.001)
12 seconds
($38)
75
![Page 59: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/59.jpg)
nesys-st.com Seguridad Telemática Avanzada
Los sistemas actuales utilizan algoritmo público y claves secretas, debido a:
· Los algoritmos públicos se pueden fabricar en cadena, tanto chips de hardware como aplicaciones software. · Los algoritmos públicos están más probados, ya que toda la comunidad científica puede trabajar sobre ellos buscando fallos o agujeros. Un algoritmo secreto puede tener agujeros detectables sin necesidad de conocer su funcionamiento completo.
· Es más fácil y más seguro transmitir una clave que todo el funcionamiento de un algoritmo.
![Page 60: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/60.jpg)
nesys-st.com Seguridad Telemática Avanzada
Criptoanálisis - Ataques
• Dependerán de lo que los atacantes dispongan• Suponemos que el atacante tiene acceso al texto cifrado• Entonces puede:
–Sólo captura texto cifrado–Conoce (o puede adivinar) parte del texto plano–Puede cifrar el texto que quiera
• Múltiples tipos:– http://en.wikipedia.org/wiki/Category:Cryptographic_attacks
• En todo caso, siempre existirá un ataque, conocido el algoritmo, la “fuerza bruta”.
La única protección: Longitud de claves
![Page 61: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/61.jpg)
nesys-st.com Seguridad Telemática Avanzada
Criptoanálisis - Ataques
• Criptoanálisis diferencial:– Leves diferencias en entradas, qué diferentes salidas
producen– Busca comportamientos no aleatorios del algoritmo
• detección de patrones estadísticos– Necesita chosen-plaintext-atack
• Criptoanálisis lineal:– Se trata de buscar aproximaciones afines de la acción del
cifrado
![Page 62: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/62.jpg)
nesys-st.com Seguridad Telemática Avanzada
Problemas
• Temas legales en la criptografía:– Limitaciones en legislación USA para la exportación
• Clasifica la criptografía como munición• Según el tamaño de la clave de los algoritmos
–PGP y PGPi– Digital Millennium Copyright Act (DMCA)
• Criminaliza la producción y distribución de ciertas técnicas y tecnologías criptoanalíticas
• Sobre todo las destinadas a “romper” tecnologías de aseguración de copyright (DRM)
• fuente: wikipedia
![Page 63: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/63.jpg)
nesys-st.com Seguridad Telemática Avanzada
AUTENTICACIÓN Y FIRMA DIGITAL
![Page 64: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/64.jpg)
nesys-st.com Seguridad Telemática Avanzada
Autenticación de mensajes
• Requerimiento básico de seguridad: Asegurar la procedencia de los mensajes.
– Cartas lacradas en la edad media– Tarjetas identificadoras, claves de acceso, etc.
• Objetivos:1. El mensaje procede de la persona que dice remitirlo2. Nadie ha modificado el mensaje en cuestión
• Se usan firmas digitales y certificados Sustitutos de la firma manuscrita
![Page 65: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/65.jpg)
nesys-st.com Seguridad Telemática Avanzada
Firmas digitales
• Necesidad del equivalente electrónico a la firma manuscrita
• Aseguran la procedencia de un mensaje Autenticidad y no repudio
• ¡¡Valor legal!!
• Implicaciones económicas, legales y jurídicas
• Ley de firma electrónica RD 17/9/1999
![Page 66: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/66.jpg)
nesys-st.com Seguridad Telemática Avanzada
Firmas digitales
• Propiedades:– Personal– Infalsificable– Fácil de autenticar– No repudio– Fácil de generar
• ¡Aún más segura que la manuscrita!
![Page 67: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/67.jpg)
nesys-st.com Seguridad Telemática Avanzada
Firmas digitales
• La firma debe depender del “mensaje” a firmar (¡No siempre la misma!)– Previene sustitución
• Determinista: Dos firmas del mismo mensaje dan mismo resultado
• Es un bloque de datos unívoco, sólo ha podido generar la persona que lo firma– Con PKC, mediante su clave privada
• En vez de cifrar un mensaje completo con la clave privada (proceso tedioso) se cifra el resumen (hash) de un mensaje – Se envía junto con el mensaje
![Page 68: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/68.jpg)
nesys-st.com Seguridad Telemática Avanzada
Firmas digitales
• Esquema de firma, siempre hay dos partes:
– Algoritmo de firma
– Algoritmo de verificación
![Page 69: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/69.jpg)
nesys-st.com Seguridad Telemática Avanzada
Firmas digitales
• Una de las formas de realizar firma digital es la siguiente forma:– A genera un resumen del mensaje (función hash (conocida y
pública)), y lo cifra usando PKC con su clave privada (F(H(M)))
– A envía el par mensaje original + resultado anterior a B – B calcula dos cosas:
• Con el mensaje saca el hash• Con PKC y clave pública de A descifra F(H(M)))
– Si ambos resúmenes son iguales se acepta la firma
![Page 70: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/70.jpg)
nesys-st.com Seguridad Telemática Avanzada
Firmas digitales
• Usa PKC + Hashing
• Con la firma digital conseguimos:
integridad
autenticación
no repudio
• Ejemplo: DSS (Digital Signature Standard)– Algoritmo DSA de firma– SHA-1 como Hash
![Page 71: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/71.jpg)
nesys-st.com Seguridad Telemática Avanzada
TEMA 3: CRIPTOGRAFÍA Y GESTIÓN DE LA CONFIANZA
![Page 72: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/72.jpg)
nesys-st.com Seguridad Telemática Avanzada
Modelos de confianza - TRUST
• TRUST: creencia personal en que algo es verdadero• El uso de la criptografía requiere el establecimiento de
relaciones de confianza, es decir, en algún momento se tiene que confiar en que algo es verdad
• Public Key Infrastructure: Mecanismo de distribución de “confianza”
• Existen varios modelos:1. Modelo de confianza distribuida, GPG/PGP2. Modelo de confianza centralizada, CA3. Modelo de confianza cruzado, delegación
![Page 73: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/73.jpg)
nesys-st.com Seguridad Telemática Avanzada
Es el conjunto de hardware, software, gente, políticas y procedimientos necesarios para crear, gestionar, guardar, distribuir y revocar certificados basados en criptografía de clave pública.
IETF-PKIX
PKI's
![Page 74: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/74.jpg)
nesys-st.com Seguridad Telemática Avanzada
PKI's
• Una PKI es el conjunto de servicios de seguridad que posibilitan el uso y administración de: – Certificados y criptografía de clave pública– en sistemas de computación distribuidos– incluyendo claves, certificados y políticas
![Page 75: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/75.jpg)
nesys-st.com Seguridad Telemática Avanzada
PKI's
• Normalmente basados en certificados X.509• Las PKIs garantizan la seguridad en los negocios
electrónicos• No hay una sola tecnología ni un estándar único de PKIs• Debería existir una estructura mundial de PKI que soporte
políticas y regulaciones internacionales Variedad de intereses, no es posible…
![Page 76: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/76.jpg)
nesys-st.com Seguridad Telemática Avanzada
Componentes de una PKI
• Una PKI y sus mecanismos proveen:
– Autenticación Vía certificados digitales– Control de acceso Vía gestión de claves– Confidencialidad Vía cifrado– Integridad Vía firmas digitales– No repudio Vía firmas digitales
![Page 77: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/77.jpg)
nesys-st.com Seguridad Telemática Avanzada
Componentes de una PKI
• Una PKI consiste de: – Una Autoridad Certificadora (CA) que expide y verifica certificados
digitales. Estos certificados contienen las claves públicas– Una autoridad de registro (RA), que actúa como verificador del CA
antes de que un certificado sea expedido a un solicitante – Uno o más directorios donde se almacenan los certificados (con
sus claves públicas), normalmente en directorios que siguen el estándar X.500 con acceso LDAP
– Un sistema de gestión de certificados
![Page 78: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/78.jpg)
nesys-st.com Seguridad Telemática Avanzada
Componentes de un PKI
![Page 79: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/79.jpg)
nesys-st.com Seguridad Telemática Avanzada
Certificados digitales
• Cogemos una clave pública de un repositorio de Internet, ¿Cómo sabemos que realmente corresponde al destinatario deseado? – Certificados digitales, así la identidad del dueño no puede
ser falsificada
• Una tercera identidad interviene en la administración de las claves públicas y asegura que las claves públicas tienen un usuario claramente identificado
![Page 80: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/80.jpg)
nesys-st.com Seguridad Telemática Avanzada
¿Qué es un certificado digital?
• Un certificado digital es un documento con diversos datos, entre otros:– Nombre de un usuario – Su clave pública– Firmado por una Autoridad de Certificación (CA)
• Como emisor y receptor confiarán en esa CA, el usuario que tenga un certificado expedido por ella se podrá autenticar ante el otro
![Page 81: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/81.jpg)
nesys-st.com Seguridad Telemática Avanzada
Certificados digitales
• Se trata de una credencial que contiene información acerca de la entidad certificadora (CA) y de la entidad certificada (usuario)
• Caso de DNI paralelismo• El formato será el de un fichero digital intransferible y no
modificable• Una CA da fe de la firma de una entidad certificada
![Page 82: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/82.jpg)
nesys-st.com Seguridad Telemática Avanzada
Certificados digitales
• Funciones de los certificados:1. Establecer identidades: Asocia una clave pública a un
individuo u otra entidad2. Asignar una autoridad: Establece qué acciones podrá
realizar el poseedor del certificado3. Securiza la información confidencial
• Ejemplo: X.509• Existen muchas CAs, que proveen los certificados (Verisign,
Thawte, FNMT, Izenpe...)
![Page 83: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/83.jpg)
nesys-st.com Seguridad Telemática Avanzada
Aplicaciones de los Certificados
• Algunas de las aplicaciones más habituales en las que se utilizan certificados digitales son:– Para la autenticación de Servidores Web---> Certificados de
Servidor Web– Para la autenticación de Clientes Web---> Certificados de Cliente
Web– Para la protección de correos electrónicos ---> Certificado de
correo electrónico– Para el sellado de tiempos ---> Certificado de tiempo
![Page 84: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/84.jpg)
nesys-st.com Seguridad Telemática Avanzada
Autoridades de Certificación
La Autoridad de Certificación es un ente u organismo que, de acuerdo con unas políticas y algoritmos, certificará -por ejemplo- claves públicas de usuarios o servidores.
A B
certificado de A
certificado de B
Autoridad de Certificación AC
AC
El usuario A enviará al usuario B su certificado (la clave pública firmada por AC) y éste comprobará con esa autoridad su autenticidad. Lo mismo en sentido contrario.
clave pública AC
clave pública AC
![Page 85: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/85.jpg)
nesys-st.com Seguridad Telemática Avanzada
Características de una Autoridad Certificadora
• Algunas de las funciones de una entidad de certificación son:– Emisión de certificados para nuevos usuarios. Acreditan que la
clave pública pertenece al usuario a quien se atribuye y su vigencia.
– Evita la generación de certificados falsos, sólo los válidos se encuentran firmados por la autoridad certificadora.
– Rutinas para modificar o dar de baja un certificado.– Generar listas de revocación (CRL).– Comunicarse con otros centros de certificación (estructuras
jerárquicas)
![Page 86: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/86.jpg)
nesys-st.com Seguridad Telemática Avanzada
El sistema debe tener:• Una política de certificación• Un certificado de la CA• Los certificados de los usuarios (X.509)• Los protocolos de autenticación, gestión y obtención de
certificados:– Se obtienen de bases de datos (directorio X.500, LDAP)– O bien directamente del usuario en tiempo de conexión
(WWW con SSL)
Elementos de una AC
![Page 87: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/87.jpg)
nesys-st.com Seguridad Telemática Avanzada
• Deberá definirse una política de certificación– Ámbito de actuación y estructura– Relaciones con otras ACs
• Deberá definirse el procedimiento de certificación para la emisión de certificados:– Verificación on-line– Verificación presencial
• Deberá generarse una Lista de Certificados Revocados
Algunas características de diseño de la AC
![Page 88: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/88.jpg)
nesys-st.com Seguridad Telemática Avanzada
• Puesta en marcha de la AC:– Generará su par de claves– Protegerá la clave privada con una passphrase– Generará el certificado de la propio AC
• Distribución del certificado de la AC:– A través del d Directorio X.500– Por medio de páginas Web
• Podrá certificar a usuarios (servidores y a clientes):
– Tipos de certificados según la profundidad en el registro
• Clase 1, 2, 3 y 4
Funcionamiento de una AC, pasos
![Page 89: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/89.jpg)
nesys-st.com Seguridad Telemática Avanzada
• X.509 está basado en criptografía asimétrica y firma digital. • En X.509 se define un framework (una capa de
abstracción) para suministrar servicios de autenticación a los usuarios del directorio X.500.
• La autenticación se realiza mediante el uso de certificados.
Certificados digitales X.509
- Un certificado contiene: el nombre de la CA, el nombre del usuario, la clave pública del usuario y cualquier otra información como puede ser un timestamp.
- El certificado se cifra con la clave privada de la CA.- Todos los usuarios poseen la clave pública del CA.
![Page 90: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/90.jpg)
nesys-st.com Seguridad Telemática Avanzada
Función hash que se cifra con la clave privada de la AC
Formato del certificado digital X.509
Versión
Nº de serie
AlgoritmoParámetros
Autoridad de Certificación
Inicio de la validezCaducidad de la validez
Nombre del usuario
AlgoritmoParámetros
Clave pública del usuario
Firma de la AC
Identificador del algoritmo
Período de validez
Clave pública que se firma
![Page 91: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/91.jpg)
nesys-st.com Seguridad Telemática Avanzada
• V: Versión del certificado (actualmente V3).• SN: Número de serie (bajo la CA)• AI: identificador del algoritmo de firma • CA: Autoridad certificadora (issuer)• TA: Periodo de validez
• A: Propietario de la clave pública que se está firmando (subject)• P: Clave pública más identificador de algoritmo utilizado y más
parámetros si son necesarios.• Y{I}:Firma digital de Y por I usando la clave privada de la entidad
certificadora
Campos del certificado digital X.509
![Page 92: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/92.jpg)
nesys-st.com Seguridad Telemática Avanzada
• Esto no es un certificado• Se trata de un formato de datos (normalmente un archivo) en cuál se
realiza una solicitud de un certificado x509 por parte de un usuario• Se complementa con la clave privada (normalmente en otro archivo)• Los datos que lleva serán parte de los que lleva un certificado, pero le
faltará la parte de compromiso– Subject– Clave pública– Algoritmo de firma
Certificate Request
![Page 93: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/93.jpg)
nesys-st.com Seguridad Telemática Avanzada
• Es otro certificado emitido por la CA• Está vez no nos certifica una identidad (subject)• Se trata de una lista identificadora de los certificados revocados
(anulados para su funcionamiento) por la CA• Dos tipos:
– CRL absoluta– Delta CRL
• Dos estados de revocación (según x509):– Revoked, anulado sin vuelta a atrás– Hold, estado reversible de invalidez temporal
• Las CRL se deben publicar por parte de la PKI– De forma periódica, mediante algún tipo de recurso: http, ftp,
etc...– On-line: Protocolo de consulta de CRLs --> OCSP
Certificate Revocation List
![Page 94: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/94.jpg)
nesys-st.com Seguridad Telemática Avanzada
SOFTWARE PKI
![Page 95: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/95.jpg)
nesys-st.com Seguridad Telemática Avanzada
PGP - Pretty Good Privacy
• Es un software que provee un esquema de e-mail basado en criptografía de clave pública, con posibilidad de cifrado y firma de documentos
• Mantiene “anillos de confianza”, donde guarda tanto las claves privadas como las claves públicas de las personas en quién se confía, vinculadas a sus direcciones de e-mail
![Page 96: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/96.jpg)
nesys-st.com Seguridad Telemática Avanzada
PGP - Pretty Good Privacy
• La confianza será siempre una decisión personal del usuario Confianza distribuida
• Usa diferentes algoritmos de cifrado (posibilidad de elegir)• Usa PKC, para la gestión de claves y para la firma electrónica y
comunicaciones• Se accede a la clave privada por medio de un password (SKC)• Es de uso muy sencillo
![Page 97: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/97.jpg)
nesys-st.com Seguridad Telemática Avanzada
Sistema PGP – Pretty Good Privacy
- Creador: Philip Zimmermann
- Criptosistema mixto basado en anillos de confianza.
- Flexible y potente, admite certificados y se puede integrar con otros modelos de PKI ya existentes
![Page 98: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/98.jpg)
nesys-st.com Seguridad Telemática Avanzada
GnuPG - Gnu Privacy Guard- Implementación de PGP bajo licencia GNU (GPL)
- Basado en el esquema de PGP, propone un sistema de comunicaciones basado en criptografía asimétrica, dónde la confianza está distribuida a cada uno de los usuarios
- Creador/mantenedor: Comunidad Open Source
- También basado en anillos de confianza.
- Flexible y potente, admite certificados y se puede integrar con otros modelos de PKI ya existentes
![Page 99: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/99.jpg)
nesys-st.com Seguridad Telemática Avanzada
PGP (Pretty Good Privacy)
-----BEGIN PGP PUBLIC KEY BLOCK-----Version: PGP 8.0.3
mQGiBECLvKwRBAD1bvGrXekHpgG3Kn8qMqiE7pwC40ECqTiQcfz4qc9nqHPKxiFUQO03HUB4ng50lJcaIr32W36O8I/vRdCpgpPi3emdLTLwG3Ix81hyHfFLr8l/U+qzojf5bwcZizi+UQ+j9okyAfW+25nnzSprQHN9/RoUUhVbaXESCLG0Cy1UvQCg/7Dtx4SEodAFSvLlEalQ2Hd/2ikEAM7xI6aTNLb269dJI7hgOXnR9qQ6jXOJbV5BitOEkD26XkX5YJT5ToBYF8eGgSwCUO4YMlnM3R7ThzwJ4eQVBJ61g61qHLxCiy8mqHQg5R13q2XhX0SeGEEsfuUZ1ESEonpKULg2Sp72RZ7ZeIJGKsNyAbu6cd3UbPzIgHd1B3MsA/9tf5poCGbi+hSCIbFr2E6DBJnUtvcmolnGYdwuRAyugVxSCaD0wL4l+S2r02XPUMq9Yu7mTnb3iKFH+orVADhFqW4A0nNZTsXjJyWErDGc5WoA7Uo0PlTcbfedYUA2vjYN2qY904pjPHsdZJ47JTovX7DA23n8GX7xvxEOsDezHLQgYWFndWlycmUgPGFhZ3VpcnJlQG5lc3lzLXN0LmNvbT6JAFgEEBECABgFAkCLvKwICwkIBwMCAQoCGQEFGwMAAAAACgkQGJs03V+uAD6IuQCeO3XcBlWTdoLArFngYPMYfF9KwxcAnR5UJvgIlUfFlEY1lAwfnbYGHyz6uQINBECLvKwQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFuuUs4INoBp1ajFOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89PY3bzpnhV5JZzf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa8L9GAFgr5fSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsYjY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICB/9I0lON7ASjN+Acf2DqHBeg92aJMX3jVcCM/0JpvVMEmLhMqTf1/pnUKgs3fHPyoUJn2rU/rvqJ7Ynu0L4OG7wMzmIrzBk6Zb3A70gsuD9m26yWZe95PW654G7HItqPjWQrF4fGkkafSf8gmQFAasQJ0kBtWAgmOpv518GtaakMSwVBGrXANaH2xEZbvE8Cb2ZAQ//GptWR81SgRutVkqOAI8D2shayK6KYHKNIyEBmmTKRrlmWR2gJtwLtq/PcysiaWy15Ss2am/+mbAlPUig/OGfxaAX5me+zAvXOCDYBlIjZ6MhCtCFzmg31P9v69n25sDl7fgGM9uDfLFuIVKZPiQBMBBgRAgAMBQJAi7ysBRsMAAAAAAoJEBibNN1frgA+8e8AoKbhCxR+m/AFqhnLNZ4GG++EyqSZAKClvWm/fLfjK5kti07v5uLehSq24g===cHzL-----END PGP PUBLIC KEY BLOCK-----
-----BEGIN PGP PRIVATE KEY BLOCK-----Version: PGP 8.0.3
lQHXBECLvKwRBAD1bvGrXekHpgG3Kn8qMqiE7pwC40ECqTiQcfz4qc9nqHPKxiFUQO03HU14ng50lJcaIr32W36O8I/vRdCpgpPi3emdLTLwG3Ix81hyHfFLr8l/U+qzojf5bwcZizi+UQ+j9okyAfW+25nnzSprQHN9/RoUUhVbaXESCLG0Cy1UvQCg/7Dtx4SEodAFSvLlEalQ2Hd/2ikEAM7xI6aTNLb269dJI7hgOXnR9qQ6jXOJbV5BitOEkD26XkX5YJT5ToBYF8eGgSwCUO4YMlnM3R7ThzwJ4eQVBJ61g61qHLxCiy8mqHQg5R13q2XhX0SeGEEsfuUZ1ESEonpKULg2Sp72RZ7ZeIJGKsNyAbu6cd3UbPzIgHd1B3MsA/9tf5poCGbi+hSCIbFr2E6DBJnUtvcmolnGYdwuRAyugVxSCaD0wL4l+S2r02XPUMq9Yu7mTnb3iKFH+orVADhFqW4A0nNZTsXjJyWErDGc5WoA7Uo0PlTcbfedYUA2vjYN2qY904pjPHsdZJ47JTovX7DA23n8GX7xvxEOsDezHP8JAwJ3g2RYoajMrGAA7yPiEoOXvtuVgAjKzLHcAbOvayuWILNv6IighZDIuGedRiSuAVY7tCBhYWd1aXJyZSA8rWFndWlycmVAbmVzeXMtc3QuY29tPp0CWQRAi7ysEAgA9kJXtwh/CBdyorrWqULzBej5UxE5T7bxbrlLOCDaAadWoxTpj0BV89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeSWc39uK50T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0iP1YTknbzSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF040zT9fBdXQ6MdGGzeMyEstSr/POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQClCbAkbTCD1mpF1Bn5x8vYlLIhkmuquiXsNV6TILO7ACAgf/SNJTjewEozfgHH9g6hwXoPdmiTF941XAjP9Cab1TBJi4TKk39f6Z1CoLN3xz8qFCZ9q1P676ie2J7tC+Dhu8DM5iK8wZOmW9wO9ILLg/ZtuslmXveT1uueBuxyLaj41kKxeHxpJGn0n/IJkBQGrECdJAbVgIJjqb+dfBrWmpDEsFQRq1wDWh9sR0W7xPAm9mQEP/xqbVkfNUoEbrVZKjgCPA9rIWsiuimByjSMhAZpkyka5ZlkdoCbcC7avz3MrImlsteUrNmpv/pmwJT1IoPzhn8WgF+pnvswL1zgg2AZSI2ejIQrQhc5oN9T/b+vZ9ubA5e34BjPbg3yxbiFSmT/8JAwJKFY+lJ+Pbn2B5SF6mbOBlgbMMp/+XeeIb+7Uz9dL+XHKDDgMDXHGXpuXZezFx6IoM4NXlgK4yXLDpO2TEtmXTFEgRLWw9dgA==jBw7-----END PGP PRIVATE KEY BLOCK-----
![Page 100: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/100.jpg)
nesys-st.com Seguridad Telemática Avanzada
PGP (Pretty Good Privacy)-----BEGIN PGP MESSAGE-----Version: PGP 8.0.3
qANQR1DBwU4DPTkmezh5CM0QB/9yL+0Yqndji+j3+lTICW4OTGEOYmm478D9LEcBp1SNqcUF6/CHnMI2mqjMIh7x8oMbHtUoZVeoYLUjO7LbZugI0qauR2dDtke+r/cuVpJp2KNBS+H/qdGPOXF6CIWhdKAwrUwlu85FqdkNnst3k2EUZ+qz9ThPFx2uBVx7/i3dlF3250Sg0QmWk8uw1IkCmecjUV+2FI64mEBA1bPiMPxmYMB6eI7HJW39U3ZfuaOgIHD8/K8kFi2yl+8gwvbtob11/KNGQbLfi9d4UGgjVhj0pYLfVNcTjeRZeFlZjuv1fzcS5NquHsiunwHltvGI7mKbsWd5X8AISAR4ExZ3k7ovB/9DpSrRbNRSV3yPfnp0bu3IrBEydujTS4PozESpmVGOm9eOeAPJm4VobZbF8AJR1YAHbpYVVR0UhXJ7RAXzwCstYeEiZLcfYQxH0uFjjxlouG27/htGJ6Qq1wn/N+b61vb3WS2SkLQmYSOv9GArnGQ3uS/y3lwv/6gOcUP3uUf6P70eSzqSlJdZdbEqbpqVhOdhuqf+b40k+4+g4qGlmfRhj2gVWvjTpEpn75JVM76yRqzq0fTJxoWzol0yWy4/FuiO+GiRE3E8V7u7oTwzj+ksUcuz/1Uqyy7yNe6Vlu0kH/X2XDK8CDISsRcqji4wpYIVzVNTd8GK1xNzdVzWFy260pQBV+x1cDsYIFUaVLthEsBRgTKnFKfq9Um1MFADdzJ6BR5JViURk7ZDPICoJ9Lm7DKjw19t+k1G8S+8VSpVEW5FAh9X02beUgzoClYQAkLxl30xMsP9UBybGBrHtaJG1bc4BF7pP5NBnKb/4IludrBhZCqAUK++qIRFbDfv5QIxyVZyVnTGfUUMCnqZdSr1D0SmQHDD=Xa3L-----END PGP MESSAGE-----
*** PGP SIGNATURE VERIFICATION ****** Status: Good Signature*** Signer: aaguirre <[email protected]> (0x5FAE003E)*** Signed: 09/09/2005 10:16:49*** Verified: 09/09/2005 10:17:20*** BEGIN PGP DECRYPTED/VERIFIED MESSAGE ***
MENSAJE CIFRADO
*** END PGP DECRYPTED/VERIFIED MESSAGE ***
-----BEGIN PGP SIGNED MESSAGE-----Hash: SHA1
MENSAJE CIFRADO
-----BEGIN PGP SIGNATURE-----Version: PGP 8.0.3
iQA/AwUBQyFGgxibNN1frgA+EQJ15ACg+FGVWbBQ0rLKm4CsRotxp7mR8kwAoPSjz2QSryPMOv7pak0E76igFO7p=j0Nb-----END PGP SIGNATURE-----
*** PGP SIGNATURE VERIFICATION ****** Status: Good Signature*** Signer: aaguirre <[email protected]> (0x5FAE003E)*** Signed: 09/09/2005 10:23:31*** Verified: 09/09/2005 10:25:33*** BEGIN PGP VERIFIED MESSAGE ***
MENSAJE CIFRADO
*** END PGP VERIFIED MESSAGE ***
![Page 101: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/101.jpg)
nesys-st.com Seguridad Telemática Avanzada
OpenSSL es un trabajo derivado de SSLeay. SSLeay fue desarrollado originalmente por Eric A. Young y Tim J. Hudson en 1995. En Diciembre de 1998, el desarrollo de SSLeay fue interrumpido y la primera versión de OpenSSL fue liberada (0.9.1c) , utilizando SSLeay 0.9.1b como punto de partida. OpenSSL se compone de dos partes:
1.librería criptográfica 2.conjunto de aplicaciones SSLExisten versiones para distintas plataformas http://www.openssl.org
OpenSSL
OpenSSL> Standard commandsasn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa dsaparam enc engine errstr gendh gendsa genrsa nseq ocsp passwd pkcs12 pkcs7 pkcs8 rand req rsa rsautl s_client s_server s_time sess_id smime speed spkac verify version x509 Message Digest commands (see the `dgst' command for more details)md2 md4 md5 rmd160 sha sha1 Cipher commands (see the `enc' command for more details)aes-128-cbc aes-128-ecb aes-192-cbc aes-192-ecb aes-256-cbc aes-256-ecb base64 bf bf-cbc bf-cfb bf-ecb bf-ofb cast cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des des-cbc des-cfb des-ecb des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb rc4 rc4-40
![Page 102: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/102.jpg)
nesys-st.com Seguridad Telemática Avanzada
OpenSSL[root@nesys209 ssl]# rpm -i openssl-0.9.7a-35.rpm
[root@nesys209 ssl]# openssl versionOpenSSL 0.9.7a Feb 19 2003
[root@nesys209 ssl]# openssl version -dOPENSSLDIR: "/usr/share/ssl"
[root@nesys209 ssl]# ls -slatotal 364 drwxr-xr-x 7 root root 4096 sep 7 22:30 .4 drwxr-xr-x 161 root root 4096 jun 29 13:45 ..4 drwx------ 3 root root 4096 jun 14 09:42 CA0 lrwxrwxrwx 1 root root 19 jun 14 09:42 cert.pem -> certs/ca-bundle.crt4 drwxr-xr-x 2 root root 4096 jun 24 19:10 certs4 drwxr-xr-x 2 root root 4096 mar 25 2004 lib4 drwxr-xr-x 3 root root 4096 jun 16 12:01 misc8 -rw-r--r-- 1 root root 7655 sep 7 22:30 openssl.cnf4 drwxr-xr-x 2 root root 4096 jun 24 19:10 private
Archivo de configuración de openssl
[root@nesys209 ssl]# cat /usr/share/ssl/openssl.cnf
![Page 103: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/103.jpg)
nesys-st.com Seguridad Telemática Avanzada
OpenSSL •Hashing#openssl md5 a.txt#openssl sha1 a.txt#openssl sha1 -out a_hash.txt a.txt
•Cifrado simétrico 3DES#openssl enc -des3 -salt -in a.txt -out cifra_a.bin -pass pass:CLAVE
Descifrado 3DES#openssl enc -des-ede3-cbc -d -in cifra_a.bin -out descifra_a_3des.txt -pass pass:CLAVE
•Cifrado simétrico BLOWFISH#openssl bf-cfb -salt -in a.txt -out cifra_a.bin -pass pass:CLAVE
Descifrado BLOWFISH#openssl bf-cbc -salt -d -in cifra_a.bin -out descifra_a_blow.txt -pass pass:CLAVE
•Codificación de la información#openssl base64 -in cifra_a.bin -out cifra_a_base64.txt
![Page 104: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/104.jpg)
nesys-st.com Seguridad Telemática Avanzada
OpenSSL
Construyendo una Autoridad de Certificación
Creamos la estructura del entorno de la PKI
# mkdir /tmp/newca# cd /tmp/newca# mkdir certs private# chmod g-rwx,o-rwx private# echo '01' > serial# touch index.txt# ls -las
4 drwxr-xr-x 4 root root 4096 sep 10 17:20 .4 drwxrwxrwt 9 root root 4096 sep 10 17:19 ..4 drwxr-xr-x 2 root root 4096 sep 10 17:19 certs0 -rw-r--r-- 1 root root 0 sep 10 17:20 index.txt4 drwx------ 2 root root 4096 sep 10 17:19 private4 -rw-r--r-- 1 root root 3 sep 10 17:20 serial
![Page 105: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/105.jpg)
nesys-st.com Seguridad Telemática Avanzada
OpenSSL /usr/share/ssl/openssl.cnf
[ CA_default ]dir = /tmp/newca # Where everything is keptcerts = $dir/certs # Where the issued certs are keptcrl_dir = $dir/crl # Where the issued crl are keptdatabase = $dir/index.txt # database index file.new_certs_dir = $dir/certs # default place for new certs.certificate = $dir/cacert.pem # The CA certificateserial = $dir/serial # The current serial numbercrl = $dir/crl.pem # The current CRLprivate_key = $dir/private/privkey.pem # The private keyRANDFILE = $dir/private/.rand # private random number filex509_extensions = usr_cert # The extentions to add to the cert. . .# crl_extensions = crl_extdefault_days = 365 # how long to certify fordefault_crl_days= 30 # how long before next CRLdefault_md = md5 # which md to use.preserve = no # keep passed DN ordering[ req ]default_bits = 2048default_keyfile = privkey.pemdistinguished_name = req_distinguished_nameattributes = req_attributes
![Page 106: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/106.jpg)
nesys-st.com Seguridad Telemática Avanzada
OpenSSL Construyendo una Autoridad de Certificación
+ Construyendo el certificado de la CA autofirmado#openssl req -x509 -days 3650 -newkey rsa -out cacert.pem -outform PEM –keyout cakey.pem
Información del certificado#openssl x509 -in cacert.pem -text -noout
+ Se han realizado dos pasos en uno, crear el CSR de la CA y luego convertirlo en un certificado x509 rellenándole los campos necesarios
+ Generación de una petición del certificado (request)
# openssl req -newkey rsa:1024 -keyout userkey.pem -keyform PEM -outuserreq.pem -outform PEM
Información de la petición del certificado (request)#openssl req -in userreq.pem -text -noout
![Page 107: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/107.jpg)
nesys-st.com Seguridad Telemática Avanzada
OpenSSL [root@nesys209 newca]# cat userkey.pem -----BEGIN RSA PRIVATE KEY-----Proc-Type: 4,ENCRYPTEDDEK-Info: DES-EDE3-CBC,CE2D5DC9F9275BE0
fPVuz1E2dFPb5ja3dSQrgUyJ1Z0vMMPyuREAL53eoUAplkBQnkutKyiK13GXFlHTmb4kYswgy4koa/Jj9AjO10jTUdQ0bKF4F69w/hWLKl7CcOdTiZpCFXtE/b8kS/+dKecw/4YEfDW2V+rrlYu8QaMUSvTBGjlrT2wlJIdTpn78uEjdEeyjDmf5VL8yyeSbFqKZa1zgE3qCUedpL24NCYBUESCoMUH4YtdXn4hvxaHkdgBigDS3LW9Ztedo+tCyqqYBqO9LBQAgYVgYoxe37BKw++mBAo32AbP9KUY/TqW3atsGEzeTKgt8XErvkEsJNquuxjwEQClOcoASF5ox8TOEAGMic7iUKlmIZB37a4n7on075Wenoez7/i/EuFR6YMxABMVZ9jTcPJfNJViKpCUFEli8vGgBF83iifbGgYaCfRyCcyvB5fFBzmkYHft4uVaJJLoaxotLj8FHTPPeCQqtfgpESPSVrq+funfDtZJiKzUB3JATeyshK8Zc0OR8REu51+jWD9CY5piRDvfk6JEvsSv2vXt6rbFXGkzysasrbgcb722dpkLNTWDTJxElUyCfLJflCxZ08lXbG6oaMIHxhbaewcEyovxOTHIFbYzL+y3xetwDD3I3f+XhikB/l9eC+MUIaFzSS9rFXOzxULzZ3gdCUMHkcIRUY7J1e6mYmBs6Z3g4lchKVe1/cxrdB6AtRxIJIJFLwBumXGnXvBHTfTdAcN6Ical32zyL2DOgY4yy/sdwUA8yFEoavK0gg9aQhgULjdPAcuvxloF4YE8UosBhu0VqzdhMtiY5oosK5A/AAC7cNg==-----END RSA PRIVATE KEY-----
[root@nesys209 newca]# cat userreq.pem -----BEGIN CERTIFICATE REQUEST-----MIIBxTCCAS4CAQAwgYQxCzAJBgNVBAYTAkVTMRAwDgYDVQQIEwd2aXpjYXlhMRAwDgYDVQQHEwdTb25kaWNhMQ4wDAYDVQQKEwVORVNZUzEMMAoGA1UECxMDUEtJMREwDwYDVQQDEwhuZXN5czIwOTEgMB4GCSqGSIb3DQEJARYRaW5mb0BuZXN5cy1zdC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAK393j3aF0hBgsRR1lbwfswo99b2rzXHB5npgq6BjKind1IaWfDcy/zMF+fcYWD1o2A5s6R0XoKaIDTKFVd3P338uL8HuIoMcfY2e6kL7FmvjCtDBP8mdOtBp7YNb3j1wVQYkivJoIUwLFZpYDJBwGFWWq1RK405PklL7ltgOxPNAgMBAAGgADANBgkqhkiG9w0BAQQFAAOBgQAAQH24mSdPnzbYM11pIltXlZPUYuxSDUrt2eq6snGrMgnKprZDqObKixkM/8nQnhT1Jv/buVKGJpf8iivMWgSHED/KVB3fwmnJ/Qy6gQgQLJ/ip7SufpjTtMVMg4ETG/bbvtn9tBkLNcZ9jkcPATUVaajuHaQ5ExmjCcJfCfurvA==-----END CERTIFICATE REQUEST-----
![Page 108: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/108.jpg)
nesys-st.com Seguridad Telemática Avanzada
OpenSSL Generación de un certificado a partir del request (CSR)#openssl ca -in userreq.pem...-----BEGIN CERTIFICATE-----MIIEADCCAuigAwIBAgIBATANBgkqhkiG9w0BAQQFADCBhDELMAkGA1UEBhMCRVMxEDAOBgNVBAgTB3ZpemNheWExEDAOBgNVBAcTB1NvbmRpY2ExDjAMBgNVBAoTBU5FU1lTMQwwCgYDVQQLEwNQS0kxETAPBgNVBAMTCG5lc3lzMjA5MSAwHgYJKoZIhvcN...IppRmJrZ7HCOsgOkhsoYe4EIYcZRoqgZFK0dehcRWG4/auXmKFO+XtdYorjYEU0/07PI2LtOyEjA2lgCEk5pH/khbAI=-----END CERTIFICATE-----
[root@nesys209 newca]# cat index.txtV 060910160943Z 01 unknown . . .
Revocación de certificados# cp certs/01.pem testcert.pem# openssl ca -revoke usercert.pemUsing configuration from openssl.cnfEnter PEM pass phrase:Revoking Certificate 01.Data Base Updated
[root@nesys209 newca]# cat index.txtR 060910160943Z 050910161743Z 01 unknown . . .
![Page 109: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/109.jpg)
nesys-st.com Seguridad Telemática Avanzada
OpenSSL
Generación de una lista de revocación
#openssl ca -gencrl -out exampleca.crl
[root@nesys209 newca]# cat exampleca.crl -----BEGIN X509 CRL-----MIIB4TCByjANBgkqhkiG9w0BAQQFADCBhDELMAkGA1UEBhMCRVMxEDAOBgNVBAgTB3ZpemNheWExEDAOBgNVBAcTB1NvbmRpY2ExDjAMBgNVBAoTBU5FU1lTMQwwCgYD...pzZzTn8qjaa04D3DDOaque8XTILCLJWk7gUrMGR0VrAbghr79B69gFAJWKMKRJ/YgmOO85lAAfr1waQEb6ooCBK2LpZONOpiCKMAwLKAvFQnSCfcrWIlrXmJMhXvPjabSFbI6V4=-----END X509 CRL-----
#openssl crl -in exampleca.crl -text -noout
Certificate Revocation List (CRL): Version 1 (0x0) Signature Algorithm: md5WithRSAEncryption Issuer: /C=ES/ST=vizcaya/L=Sondica/O=NESYS/OU=PKI/CN=nesys209/[email protected] Last Update: Sep 10 16:21:38 2005 GMT Next Update: Oct 10 16:21:38 2005 GMTRevoked Certificates: Serial Number: 01 Revocation Date: Sep 10 16:17:43 2005 GMT Signature Algorithm: md5WithRSAEncryption ba:93:b1:5c:e9:21:03:b3:ed:ec:f6:17:89:f6:41:61:36:ab:
![Page 110: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/110.jpg)
nesys-st.com Seguridad Telemática Avanzada
Formatos de certs
• PKCS: Public Key Cryptography Standards. Estándares emitidos por RSA http://www.rsasecurity.com/rsalabs/pkcs/. – PKCS#1: Especificación del algoritmo RSA– PKCS#8: Formato para claves privadas – PKCS#10: Formato para requests de certificados (CSRs) – PKCS#12: Formato combinado para claves-certs (pfx, p12)
• ASN.1, DER y PEM: – ASN.1 estándar de descripción de datos portables. En crypto
Descripción de claves. – DER codifica los datos en un stream de bytes– PEM Coge el stream, lo codifica Base64 y le añade una cabecera y un
pie de página.
![Page 111: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/111.jpg)
nesys-st.com Seguridad Telemática Avanzada
Certificados y formatos de clavesPEM
Puede contener todas las claves privadas (RSA y DSA), claves públicas (RSA y DSA) y certificados (x509). Es el formato por defecto para OpenSSL. Guarda datos codificados en Base64 y formato DER, rodeado de cabeceras ASCII, de tal forma que es muy adecuado para transferencias entre sistemas.
DER
Puede contener todas las claves privadas, públicas y certificados. Se guarda de acuerdo con el formato ASN1 DER. Suele ser el utilizado por los navegadores
PKCS#12
También conocido como PFX (ext .p12 y .pfx). Puede contener todas las claves privadas, públicas y certificados. Se guardan los datos en binario. Lo usa Microsoft.
![Page 112: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/112.jpg)
nesys-st.com Seguridad Telemática Avanzada
To PKCS#12 (Netscape, IE etc) from PEM
openssl pkcs12 -export -in pem-certificate-and-key-file -out pkcs-12-certificate-and-key-file openssl pkcs12 -export -in pem-certificate-file -inkey pem-key-file -out pkcs-12-certificate-and-key-file
From PKCS#12 to PEM
openssl pkcs12 -in pkcs-12-certificate-file -out pem-certificate-fileopenssl pkcs12 -in pkcs-12-certificate-and-key-file -out pem-certificate-and-key-file
From PEM/DER to DER/PEM - DSA Keys
openssl dsa -inform PEM|DER -outform DER|PEM -in pem-file|der-file -out der-file|pem-file
From PEM/DER to DER/PEM - RSA Keys
openssl rsa -inform PEM|DER -outform DER|PEM -in pem-file|der-file -out der-file|pem-file
Conversión de certificados
![Page 113: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/113.jpg)
nesys-st.com Seguridad Telemática Avanzada
Ejercicios
1. Manejo de GPG– Creación par de claves, gestión de anillos, cifrado,
firma, descifrado y validación…– Validación de firmado de SW putty– http://www.gnupg.org/gph/en/manual.html
2. Manejo OpenSSL:– Creación de una CA, creación de requests, firmado
de certs, gestión de CRLs– Creación de una PKI de tres niveles– Uso de la PKI bajo OpenVPN
![Page 114: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/114.jpg)
nesys-st.com Seguridad Telemática Avanzada
Recursos a utilizar durante el curso
• PCs con sistemas GNU/linux en red• Salida a internet• Distros live-CD de GNU/linux de seguridad• Proyector• Presentaciones de seguridad y documentos• Laboratorios con sistemas y redes• Recursos en internet• Recursos compartidos entre alumnos y profesor vía FTP
Contacto durante el curso: [email protected]
![Page 115: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/115.jpg)
nesys-st.com Seguridad Telemática Avanzada
REFERENCIAS
Openssl.org, gnupg.org, openvpn.org,
seguridaddigital.info
Wikipedia
UPM, Jorge Ramió Aguirre, J.L. Mañas
Jérémy Chartier
NESYS-ST.COM
Boletín Cryptogram 15/09/98, www.counterpane.com
Applied Cryptography, B.Schneier
www.kriptopolis.org
![Page 116: - C U R S I LLO - Criptografía y certificación GnuPG y OpenSSLe-ghost.deusto.es/docs/2006/cursillos/cripto/0607_UD_Cursillo.pdf · nesys-st.com Seguridad Telemática Avanzada Objetivo:](https://reader031.fdocument.pub/reader031/viewer/2022021909/5bee14c309d3f2f6028c1c7c/html5/thumbnails/116.jpg)
nesys-st.com Seguridad Telemática Avanzada
Licencia