Cliente TLS (HTTPS)

Iniciado por keniaboy, 11 Enero 2016, 23:58 PM

0 Miembros y 1 Visitante están viendo este tema.

keniaboy

Buenas.

Estoy intentando hacer un pequeño "cliente" para conectarse a un servidor SSL determinado.

Con algunos criterios especificos:

a) No debe depender de librarias ni frameworks.
b) Todo tiene que poder correr con muy bajos recursos.

Para esto la idea principal es implementar solo un "cipherSuit" así implementar la menor cantidad de ciphers, hash, etc.

Basados en la documentacion del rfc2246 me inclino por implementar TLS_DHE_RSA_WITH_AES_256_CBC_SHA

A fuerza de la especificacion y wireshark ya esta la parte "facil"

1) Send Hello Client Check
2) Receive Server Hello
3) Receive Server Certificate
4) Receive Server KeyExchange
5) Receive Server Done
6) Send ClientKeyExchange
7) Send ChangeCipherSpec

Ahora quedan los ultimos pasos donde la informacion ya va cifrada.

En este punto ya tenemos
Client Secret Exponent (PrivateKey)
Client Public Key (PublicKey)
Server Public Generator G
Server Public Prime Modulus M
Server Public Key PublicKey

// Encript (Encrypted Handshake Message)
8) Send PreMasterKey -- RSA encrypted premaster secret message --

Meaning of this message:
If RSA is being used for key agreement and authentication, the
client generates a 48-byte premaster secret, encrypts it using
the public key from the server's certificate or the temporary RSA
key provided in a server key exchange message, and sends the
result in an encrypted premaster secret message. This structure
is a variant of the client key exchange message, not a message in
itself.

Lo cifro con la ServerPublicKey ... pero ¿con que algoritmo?

Y despues quedan otros pasos...
// Claro
9) Receive NewSessionTicket
10) Receive ChangeCipherSpec
// Encript (Encrypted Handshake Message)
11) ??
12) Application data (ahí esta el HTTP)