diff --git a/Projs/PD1/internal/server/datastore.go b/Projs/PD1/internal/server/datastore.go index d8ace3d..0ee3b66 100644 --- a/Projs/PD1/internal/server/datastore.go +++ b/Projs/PD1/internal/server/datastore.go @@ -90,7 +90,7 @@ func (ds DataStore) GetMessage(toUID string, position int) protocol.Packet { err := row.Scan(&serverMessage.FromUID, &serverMessage.ToUID, &serverMessage.Subject, &serverMessage.Body, &serverMessage.Timestamp) if err == sql.ErrNoRows { log.Printf("No message with NUM %v for UID %v\n", position, toUID) - errorMessage := fmt.Sprintf("MSG SERVICE: unknown message!") + errorMessage := fmt.Sprintln("MSG SERVICE: unknown message!") return protocol.NewReportErrorPacket(errorMessage) } @@ -217,7 +217,7 @@ func (ds DataStore) userExists(uid string) bool { err := ds.db.QueryRow(query, uid).Scan(&count) if err != nil || count == 0 { log.Printf("user with UID %v does not exist\n", uid) - return false + return false } return true } diff --git a/Projs/PD1/internal/server/server.go b/Projs/PD1/internal/server/server.go index 54b62da..127dac0 100644 --- a/Projs/PD1/internal/server/server.go +++ b/Projs/PD1/internal/server/server.go @@ -7,8 +7,6 @@ import ( "log" ) -//TODO: LOGGING SYSTEM - func clientHandler(connection networking.Connection[protocol.Packet], dataStore DataStore) { defer connection.Conn.Close() diff --git a/Projs/PD1/server.db b/Projs/PD1/server.db index 0ec34a2..c995c32 100644 Binary files a/Projs/PD1/server.db and b/Projs/PD1/server.db differ diff --git a/Projs/PD2/README.md b/Projs/PD2/README.md new file mode 100644 index 0000000..40b2122 --- /dev/null +++ b/Projs/PD2/README.md @@ -0,0 +1,214 @@ +# Relatório do Projeto de Desenvolvimento 1 + +## Introdução + +A comunicação eficaz dentro de uma organização é essencial para a eficiência do seu funcionamento. No entanto, num ambiente cada vez mais digital, garantir a segurança e autenticidade das comunicações tem-se vindo a tornar uma preocupação fundamental. Em resposta a esta necessidade, este primeiro projeto de desenvolvimento visa criar um serviço de mensagens seguro e autenticado. + +Para contextualizar o projeto, consideremos uma organização onde informações confidenciais são frequentemente trocadas entre membros de equipas distribuídas geograficamente. Neste cenário, é crucial que as mensagens enviadas e recebidas sejam protegidas contra acessos não autorizados e manipulação por partes externas. Além disso, garantir que a identidade do remetente e a integridade da mensagem sejam verificadas é essencial para manter a confiança e a segurança das comunicações internas. + +Perante estas necessidades, o projeto de desenvolvimento propõe a criação de um sistema cliente/servidor que oferece um serviço de mensagens seguro e autenticado. Através deste sistema, os membros da organização poderão trocar mensagens com garantias de autenticidade, protegendo assim a confidencialidade e integridade das comunicações. + +Ao longo deste relatório iremos detalhar as decisões mais importantes tomadas no desenvolvimento do projeto, bem como as medidas de segurança implementadas para garantir a confidencialidade, integridade e autenticidade das mensagens trocadas entre os utilizadores. + +Algumas notas sobre o projeto: + +- Optamos por escolher **Golang** como linguagem visando uma implementação mais eficiente, robusta e segura ao nível de concorrência. O modelo de concorrência baseado em goroutines e canais facilita a criação de programas concorrentes e sistemas distribuídos. Com uma sintaxe simples, semelhante a **C**, o **Go** promove a escrita de código legível e de alta qualidade. Além disso, o **Go** possui um ecossistema robusto de bibliotecas e ferramentas, tornando-o uma escolha adequada para o desenvolvimento de sistemas distribuídos e serviços de back-end. + +- Implementamos algumas funcionalidades extra, como o armazenamento dos dados no servidor numa base de dados **sqlite3** + +Nas secções seguintes iremos detalhar cada componente do sistema, bem como as funcionalidades implementadas. + + + +## Análise de Risco + +Esta análise de risco do sistema visa identificar as potenciais vulnerabilidades e ameaças que possam comprometer a segurança do sistema de mensagens. É essencial considerar os diversos fatores que podem impactar a integridade, confidencialidade e disponibilidade das mensagens trocadas entre os utilizadores. + +### Potenciais Vulnerabilidades + +1. **Comunicação Não Segura** - Se a comunicação entre os clientes e o servidor não foi cifrada, qualquer *man in the middle* consegue ler o conteúdo a ser transmitido. + +1. **Armazenamento Inseguro de Chaves Privadas** - Se as chaves privadas dos utilizadores forem armazenadas de forma inadequada, como em arquivos desprotegidos, existe o risco de acesso não autorizado, comprometendo a segurança e autenticidade das mensagens. + +1. **Autenticação Fraca** - Um sistema de autenticação vulnerável pode permitir que utilizadores mal-intencionados obtenham acesso não autorizado às contas dos utilizadores legítimos. + +1. **Manipulação de Mensagens** - A ausência de mecanismos eficazes de controlo pode facilitar a manipulação do conteúdo das mensagens durante a transmissão, comprometendo sua integridade. + +1. **Vulnerabilidades de *Software*** - Falhas de segurança no *software* desenvolvido e utilizado para implementar o sistema podem ser exploradas para obter acesso não autorizado ou comprometer a segurança dos dados. + +### Possíveis Ameaças: + +1. **Ataques de Intercetação de Dados** - Atacantes podem tentar intercetar a comunicação entre o cliente e o servidor para obter informações sensíveis, como chaves privadas ou conteúdo de mensagens. + +1. **Ataques de *Denial of Service (DOS)*** - Um ataque de *DOS* pode tornar o servidor inacessível ao sobrecarregá-lo com um grande volume de solicitações, prejudicando a disponibilidade do serviço. + +1. **Ataques de Engenharia Social:** - Atacantes podem tentar manipular os utilizadores legítimos para obter acesso às suas credenciais de acesso por meio de técnicas de engenharia social. + +1. **Exploração de Vulnerabilidades de *Software*:** - Vulnerabilidades conhecidas ou desconhecidas no *software* utilizado podem ser exploradas para comprometer a segurança do sistema. + +### Propriedades Requiridas: + +1. **Autenticidade do Remetente** - O cliente deseja ter a garantia de que a mensagem recebida foi realmente enviada pelo remetente indicado. + +1. **Confidencialidade das Mensagens** - O cliente quer assegurar que apenas ele possui a capacidade de decifrar as mensagens que lhe foram enviadas, garantindo assim a privacidade das comunicações. + +1. **Servidor Malicioso** - Os clientes pretendem proteger-se contra a possibilidade de o servidor agir de forma maliciosa, garantindo que as suas interações sejam seguras e protegidas, necessitando de mecanismos que garantam a segurança das suas interações independentemente da confiabilidade do servidor, como a utilização de criptografia *end-to-end*. + +1. **Comunicação Segura com o Servidor** - Os clientes exigem que a comunicação com o servidor seja segura, protegida contra acesso não autorizado e intercetação por partes não autorizadas, garantindo assim a integridade e confidencialidade dos dados transmitidos. + +### Medidas de Mitigação: + +1. **Protocolo de comunicação** - Utilizar um protocolo de comunicação que garanta a confidencialidade para proteger a comunicação entre o cliente e o servidor. + +1. **Armazenamento Seguro de Chaves Privadas** - Adotar práticas seguras de armazenamento para proteger as chaves privadas dos utilizadores contra acesso não autorizado, como utilizar *passphrases* para proteger o acesso à *key store*. + +1. **Fortalecimento da Autenticação** - Implementar métodos robustos de autenticação, como certificados digitais, para garantir a identidade dos utilizadores e proteger contra acesso não autorizado. + +1. **Validação de Dados** - Implementar controles de validação de dados para garantir a integridade das mensagens e prevenir a manipulação de dados por partes não autorizadas, como, por exemplo, assinar "hashes" das mensagens enviadas. + +1. **Atualizações de *Software*** - Manter o *software* utilizado atualizado para mitigar o risco de exploração de vulnerabilidades conhecidas e garantir a segurança do sistema. + +Esta breve análise de risco destaca a importância de identificar e mitigar potenciais vulnerabilidades e ameaças para garantir a segurança do sistema desenvolvido. A implementação de medidas de segurança adequadas é essencial para proteger os dados e garantir o funcionamento seguro. + + +## Decisões de Arquitetura e Implementação + +Tendo em consideração as vulnerabilidades e ameaças identificadas na análise de risco, foram tomadas várias decisões de design e implementação para garantir a segurança e autenticidade do sistema de mensagens. As decisões tomadas visam proteger a confidencialidade, integridade e autenticidade das mensagens trocadas entre os utilizadores, bem como garantir a segurança da comunicação entre o cliente e o servidor. + +1. **TLS (Transport Layer Security)** + + - Cada conexão entre cliente e servidor é protegida pelo protocolo TLS, garantindo que a comunicação seja segura e privada. + - Cliente e servidor trocam certificados para autenticar as suas identidades. + - Ambos verificam se o certificado foi emitido pela Autoridade de Certificação (CA) central. + - O cliente verifica se comunica com o servidor legítimo. + +1. **End-to-End Encryption (E2EE)** + + - Ao enviar uma mensagem, o cliente assina a *hash* do texto simples com a sua chave privada. + - A assinatura é anexada ao texto limpo e esse conjunto é cifrado com uma chave de sessão gerada aleatoriamente. + - A chave de sessão é cifrada com a chave pública do destinatário, Isso garante que apenas o destinatário possa decifrar a mensagem. + +1. **Visualização da Lista de Mensagens Não Lidas** + + - Quando um cliente solicita a sua lista de mensagens não lidas, apenas o assunto é enviado, não o conteúdo cifrado. + - O cliente deve decifrar o assunto para visualizá-lo. + +1. **Visualização de Mensagens** + + - Quando um cliente solicita uma mensagem, é enviado o conteúdo todo da mensagem. + - O cliente deve decifrar o assunto e o corpo da mensagem para visualizá-los. + +1. **Troca de Chaves Públicas** + + - Quando um cliente precisa da chave pública de outro cliente, solicita o certificado desse cliente ao servidor. + - Verifica-se se o certificado foi emitido pela CA central e se pertence ao cliente desejado. + +1. **Verificação de Inputs** + + - Tanto cliente quanto servidor realizam verificações básicas nos *inputs* para garantir a sua integridade. + - Ambos desconfiam um do outro e verificam cuidadosamente todos os *inputs*. + +1. **Confiança na CA Central** + + - A única confiança absoluta neste sistema é depositada na Autoridade de Certificação central, responsável por emitir os certificados. + + +## Certificates and Keys + +Para gerar os certificados e chaves necessárias para a comunicação segura entre o cliente e o servidor, foram seguidos os seguintes passos utilizando a ferramenta **OpenSSL**. Estes passos incluem a geração de chaves privadas, certificados e *keystores* para o servidor e clientes, bem como a assinatura dos certificados pela CA central. + + +1. **Gerar *CA key* e o *certificate*** + +```bash +openssl genrsa -aes256 -out CA/CA.key 4096 +openssl req -x509 -new -nodes -key CA/CA.key -sha256 -days 18250 -out CA/CA.pem -subj "/2.5.4.3=CA" +``` +A *passhphrase* da CA é 1234 + +2. **Gerar a *server key* e *CSR*** + +```bash +openssl genrsa -out server/server.key 4096 +openssl req -new -key server/server.key -out server/server.csr -subj "/2.5.4.11=MSG SERVICE/2.5.4.65=SERVER" +``` + +3. **Assinar o *CSR* do *server* com a *CA*** + +```bash +openssl x509 -req -in server/server.csr -CA CA/CA.pem -CAkey CA/CA.key -CAcreateserial -out server/server.crt -days 1825 -sha256 +``` + +4. **Gerar o *keystore* do *server*** + +```bash +openssl pkcs12 -export -out server/server.p12 -inkey server/server.key -in server/server.crt -certfile CA/CA.pem -name "ServerKeyStore" +``` +A passphrase usada para o *keystore* é server + +5. **Gerar as chaves e *CSR* de cada *client*** + +```bash +openssl genrsa -out client{NUM}/client{NUM}.key 4096 +openssl req -new -key client{NUM}/client{NUM}.key -out client{NUM}/client{NUM}.csr -subj "/2.5.4.11=MSG SERVICE/2.5.4.65=CL{NUM}/2.5.4.3=Client {NUM}" +``` + +6. **Assinar os *CSR* dos clientes com a *CA*** + +```bash +openssl x509 -req -in client/client.csr -CA CA/CA.pem -CAkey CA/CA.key -CAcreateserial -out client/client.crt -days 1825 -sha256 +``` +7. **Gerar o *keystore* do *client*** + +```bash +openssl pkcs12 -export -out client{NUM}/client{NUM}.p12 -inkey client{NUM}/client{NUM}.key -in client{NUM}/client{NUM}.crt -certfile CA/CA.pem -name "Client{NUM}KeyStore" +``` +A passphrase usada para o *keystore* é client{NUM} + +Neste processo, foram geradas as chaves privadas, certificados e *keystores* necessários para estabelecer uma comunicação segura entre os clientes e o servidor. Os certificados foram assinados pela Autoridade de Certificação (CA) central, garantindo a autenticidade e integridade dos certificados emitidos. Os *keystores* contêm tanto o certificado quanto a chave privada do cliente ou servidor, protegidos por *passhprase* para garantir a confidencialidade e segurança das chaves privadas. Este processo de geração de certificados e *keystores* é essencial para estabelecer uma comunicação segura e autenticada entre os componentes do sistema. + +### Certificados +- **Autenticidade**: Os certificados são assinados digitalmente pela Autoridade de Certificação (CA) central, garantindo sua autenticidade. Isso significa que os clientes podem verificar se o certificado foi emitido por uma entidade confiável. +- **Criptografia**: Os certificados contêm a chave pública do cliente ou do servidor, que é usada para estabelecer uma comunicação segura por meio de criptografia assimétrica. Isso permite que as mensagens sejam cifradas pelo remetente e decifradas apenas pelo destinatário. +- **Verificação**: Antes de confiar num certificado, os clientes verificam sua validade, incluindo a data de expiração e a correspondência com a entidade emissora. Isso ajuda a evitar a utilização de certificados inválidos ou falsificados. + +### *Keystores* +- **Armazenamento Seguro**: Os *keystores* são arquivos protegidos por *passphrase* que contêm tanto o certificado quanto a chave privada do cliente ou servidor. Essas informações sensíveis são protegidas por meio de criptografia, garantindo que apenas o proprietário autorizado possa acessá-las. +- **Proteção da Chave Privada**: A *passphrase* do *keystore* protege a chave privada contra acesso não autorizado. Isso é crucial, pois a chave privada é usada para decifrar as mensagens recebidas e assinar as mensagens enviadas, garantindo a autenticidade e integridade da comunicação. +- **Confidencialidade**: Como os *keystores* são protegidos por *passphrase*, mesmo que alguém obtenha acesso ao arquivo, não poderá extrair a chave privada sem a *passphrase* correta. Isso ajuda a manter a confidencialidade das chaves privadas dos usuários. + + +## Criptografia + +É importante destacar que, para garantir a segurança e integridade das mensagens, implementamos um protocolo de comunicação seguro. Este protocolo utiliza tanto criptografia simétrica quanto assimétrica. As mensagens são cifradas com uma chave de sessão gerada aleatoriamente, que, é cifrada com a chave pública do destinatário para garantir a confidencialidade. As mensagens são também assinadas com a chave privada do emissor para autenticidade. Dessa forma, asseguramos que as mensagens sejam protegidas contra acessos não autorizados e que a sua origem possa ser verificada. + +![Digital Envelope](report_content/digital-envelope-diagram.jpg) + + +### Networking + +O canal de comunicação estabelecido entre o cliente e o servidor nesta implementação garante uma troca de dados segura e criptografada utilizando o protocolo TLS (Transport Layer Security). Ambos, cliente e servidor, empregam configurações TLS para cifrar os dados durante a transmissão, assegurando confidencialidade e integridade. Durante o handshake TLS, o servidor valida o certificado do cliente para verificar sua autenticidade, prevenindo acessos não autorizados. Este mecanismo robusto de segurança protege o canal de comunicação contra escutas, adulterações e ataques do tipo "man in the middle", garantindo uma troca de informações segura e confiável entre o cliente e o servidor. + +### Protocolo de Comunicação + +O package **protocol.go** define um conjunto de estruturas e funções que representam os diferentes tipos de pacotes que podem ser transmitidos entre o cliente e o servidor. Cada tipo de pacote é representado por uma constante PacketType, que indica a natureza da informação contida no pacote através de uma **flag**. + +As estruturas de dados definidas, como `GetUserCert`, `GetUnreadMsgsInfo`, `GetMsg`, `SendMsg`, `AnswerGetUserCert`, `AnswerGetUnreadMsgsInfo` e `AnswerGetMsg`, descrevem os formatos específicos de cada tipo de pacote a ser enviado e recebido. Cada estrutura contém os campos necessários para armazenar e representar os dados associados a cada tipo de pacote. + +Além disso, foram implementadas funções auxiliares para criar instâncias de cada tipo de pacote, como `NewGetUserCert`, `NewGetUnreadMsgsInfo`, `NewGetMsg`, `NewSendMsg`, `NewAnswerGetUserCert`, `NewAnswerGetUnreadMsgsInfo` e `NewAnswerGetMsg`. Estas funções facilitam a criação de pacotes com os dados necessários de forma estruturada. + +Para facilitar a serialização e desserialização dos pacotes em formato JSON, foram implementadas funções `Unmarshal` específicas para cada tipo de pacote. Estas funções convertem os dados do pacote entre o formato JSON e as estruturas de dados correspondentes, permitindo a comunicação eficiente entre o cliente e o servidor. + +Este package serve como uma camada de abstração que facilita a comunicação entre os componentes cliente e servidor, garantindo que os dados sejam transmitidos de forma estruturada e *standardized*, facilitando o desenvolvimento, manutenção e expansão do sistema de comunicação. + +### Sqlite3 Database + +Como mencionado anteriormente neste relatório, uma das funcionalidades adicionais implementadas foi o armazenamento dos dados do servidor numa base de dados persistente. Neste projeto, optamos por utilizar o **SQLite3**. Este é utilizado para armazenar as mensagens enviadas e recebidas pelos utilizadores, além dos certificados digitais dos clientes. A escolha de uma base de dados permite a persistência segura e eficiente dos dados, assegurando que as mensagens e certificados sejam armazenados de maneira duradoura e acessível. + +Em relação à segurança contra ataques como *SQL Injection*, é crucial adotar medidas para mitigar esse tipo de ameaça. A utilização de *prepared statements* é uma prática essencial para prevenir ataques deste tipo. Com *prepared statements*, os valores dos parâmetros são tratados como dados e não como parte do comando SQL, o que reduz significativamente o risco de injeção de código malicioso. Essa abordagem fortalece a segurança do sistema, garantindo a integridade e confiabilidade das operações da base de dados. + + + +### Verificações e Testes de Segurança + +Para realizar testes e verificações de segurança implementamos também um *Fake Client, Server e CA*, que permitem testar a segurança do sistema em diferentes cenários, como tentativas de intercetação de dados, manipulação de mensagens, autenticação fraca e outros tipos de ataques. diff --git a/Projs/PD2/certs/CA/CA.key b/Projs/PD2/certs/CA/CA.key new file mode 100644 index 0000000..1b522db --- /dev/null +++ b/Projs/PD2/certs/CA/CA.key @@ -0,0 +1,54 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIJtTBfBgkqhkiG9w0BBQ0wUjAxBgk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8JduDCI2Df8JBwgBNcVINAOynLAspZwjxIPY0unZXur0 +MNoaStKfZ8zN55yvM64OkcFBEMDeZxNPcaNS2Lfrs7UxSzafcEnz6bs1qodQFv4R +AYPF76qkFK87CA1LzcSQqNrn9HeEpOm+p/CZxx7lowQQUtK/8836f88= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/Projs/PD2/certs/CA/CA.pem b/Projs/PD2/certs/CA/CA.pem new file mode 100644 index 0000000..c656bc1 --- /dev/null +++ b/Projs/PD2/certs/CA/CA.pem @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIE/TCCAuWgAwIBAgIUeu0iePpZFCl6i+Ox7QbXywinn+wwDQYJKoZIhvcNAQEL +BQAwDTELMAkGA1UEAwwCQ0EwIBcNMjQwNDE5MDAyMDE5WhgPMjA3NDA0MDcwMDIw +MTlaMA0xCzAJBgNVBAMMAkNBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKC +AgEAv7oZ8bld3ImFrkmRf28EbkFZ3xv2FxJP8+eqv8qufKeYyEm9VEzAM7kpsaIG +OoEC5yBOVQ4uhC8aCcknm9OU/m5IFfMGAXwj9cWee9KZZM5ma2W/rvO3z6JcBTP6 +mEuQZI8GVST5RqDzEhDZSujerN9/SaHnCwqPshUUbft/yMF0oHyEhmpNg+0Uu8WF +4ck0W9rlBS+z+PfMy2Y7iTM9o21q2fPRbXDxoDSCebMN8NiB9/RK/kAcRZqTYd+u +LsIx61nTphhk4uNs7PQ82ABXhQTKnU1svTVInjQfYDAypr5cPMwut1TSieCBS7/N +Xaod/b2voKZihqQ1yYWwdanj7QarySK6MC/JAoLlq4KE6/YL2788k+eu7cP6v4Yf +k2o2IPA4/9LcZ4nMLmKszamw5OZmyzGtYifE2wvabileitn06oiutMIdm9EUthrs +/6h/OkILQeh6tOuy3NqSj1rf0rs62/OC3k3BWf/WFwqLileCpxwQZXOWiXFznuvP +0T9QxCFj3HacdhiXo4oejpIlGnclBSZ7B96dR7xGAaXoOL8EatYVZGB8LKpx8H3/ +vgehVevNRz2/WvYfJATnvaakM+i/TYhX027Exi+LvdyMH4C1xRiqDvC3kYzZwakN +1ZCpz6fYmhWNqW0rzu3ePRpYHSGC0hq1WTRfHaQvAVMJiUcCAwEAAaNTMFEwHQYD +VR0OBBYEFMVE1jz77WweC8ao7bVYxujCdbDRMB8GA1UdIwQYMBaAFMVE1jz77Wwe +C8ao7bVYxujCdbDRMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIB +AI7KNfTFRFCdLIxDkVzG6/FZx5ue++xGMdxwrVX8sX2mib9yMaAMbj3TPX0f/PDD +avUBK5pgNi9cV/GsXw0vnrJ9R9Ou5pYJ+NeaQZoO+YTHDnqJL7Ro3Q1BcRG8S+Q6 ++YwoiXzghLebq7r81yhQXeS3Ax7SHlz+rXoDQJFSdDBPMJSFgJs2YPTRDPNEveW2 +wvFAdIK5KzB2gaeQRT/vix4jFasXUogRpLXWCDFJFYPd0iaTrzP1K1mDTHDD/pFB +R3AnMxWp3Plxxr/jO6Djb0GgRjp5q4uoZAYpwZfE70M9jafqoA20t2Rxtorj+SA0 ++o2uG72ssTbw5cfQy+uBnQiUghvsw3U4D62d+IxW9gtbOBGES4TIflKsUnJ36RKx +EQaPYJ6VhgBDyGoqBmANjfV4u3Jz7IlxQyeA0JzhuOSfenQaRQzjvaj/4SlYYfhm +tKgEuQf6XaiXa/PWKIwwT49TZ7ZQB+g1xTD43s9PZ883byZPEolLe12cvJ918jQf +/8VFLCHCuV+k+g8FIt/dOgalHmM1hh8uzqiIk1Rtp8YPsuUNO4ZeHQ+ANGO1WqXx +GYNa4Unhuz3+VNxbctAaSNExvzwYIqEdNdZjxOYw09fOYQUkYDN+7gB90GCstCsJ +10KMhfRQQm3Fq8CtnOomgUmgcawPDuFOThLuU4m1dkcT +-----END CERTIFICATE----- diff --git a/Projs/PD2/certs/CA/CA.srl b/Projs/PD2/certs/CA/CA.srl new file mode 100644 index 0000000..ce4190e --- /dev/null +++ b/Projs/PD2/certs/CA/CA.srl @@ -0,0 +1 @@ +7C475B59D1510F54E042BF4BFDBE811BF4EDAF37 diff --git a/Projs/PD2/certs/FakeCA/CA.key b/Projs/PD2/certs/FakeCA/CA.key new file mode 100644 index 0000000..2262576 --- /dev/null +++ b/Projs/PD2/certs/FakeCA/CA.key @@ -0,0 +1,54 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIJtTBfBgkqhkiG9w0BBQ0wUjAxBgkqhkiG9w0BBQwwJAQQwks8rDYklHIqEyby +Sy6FUAICCAAwDAYIKoZIhvcNAgkFADAdBglghkgBZQMEASoEEJYlsC6EK54vs8xV +BIXwFQ0EgglQ5bMrmLjm4iA16EL7cSJKSjhwVqTfnWM+1p3aeRT9zHTTT/xOFbkv +85qPAxZ8ZeoQ9A1Z+5YzAmx+S+sLf1YOLyN1b++xET4ESFEdzhV4U0vZs5H3Pi2s +ESvo0hfjoM5jOixqoms5zlkdnc8mBzyjt1UUvCMliGhvMaxYS7FoFdAyTRr+NnRv +ey3xOqL0Nv+IDRf9TpxXZEEQEVTsL+RvjEzu/7rbfTNh0HCk+/Bnv4NJpBnSidXw +hoNZVedVYmi/MHUamUJyUkNDsjTAqA4yVQeOG/76M9+jmt1ZIO1az5u2rVjudW+N +OCf/w9x5gK2IyTgS+tsJQ3ZqNujaESLFpzqp0LopwJE4HELoiWiYU2GUXbJvHtLp +EhTLYkulNoU/7HkSvMtY+m6KW+uRVTxkwSPCZBezdW2cBB8T7Jf+l7M5mAKpQZSg +W7ARDyTBeQ59cVfnhPxWqyzpHgXzzlQJSBxT0ebNIAqdaowmZNIrXKds7r/HhPaj +PYM1MWQd6esNhrBnG6m4FaGGyJvhUYb1y+YFH7j6Vr3Na77JvPcNqZX0GlN0TUxm +09jKnAAfdtI4AT/bYKMWDh2Np+tquYSxN3UtqQ/zqMVZRX2PPHorEMDlpVjQdNuC +gbJoLL5yNNz5QAzWuwexbJQ4rA/hsOtKOfcdLN6Or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axS0Y9ufwVZwO0nmn1Bdb2CrP1Pgytn +nKzuD1R+CWUkdwF2rAkZlzs77Mmxu12O/TAnM2eFmwkOkNZo70ZTsrE7eo44+5RO +0k1714nbST+LBYcyOli6M7BKCBrc21sxU7crnaD+3FoxrtDzTkYmxYKO/PEDjqQT +ece44Xj6HQ8RskKdTrF/rM7v6bS13DV2JYepYQCHDx4z+RFe/UsidJabTEuNqXeU +tdWikpn9OMz5hzZ77tSHRTfrsZwy2n0+5wBykKUZBBi/jRHJywsgxAw+nxAOON8B +wdeVYfQX/hoprYwBh93Sq1fALK4ooYm2KUIfxD5W43ttQkLCWwxGvBL7keSJksZU +vrv3I5th8YfC+3AzLBZlAzT11/REJJzNQeHD+ygJizGpHWlULI1jfLo= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/Projs/PD2/certs/FakeCA/CA.pem b/Projs/PD2/certs/FakeCA/CA.pem new file mode 100644 index 0000000..027e942 --- /dev/null +++ b/Projs/PD2/certs/FakeCA/CA.pem @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIE/TCCAuWgAwIBAgIUNae6TxoDs5d/kuQMGrNstWsNYCUwDQYJKoZIhvcNAQEL +BQAwDTELMAkGA1UEAwwCQ0EwIBcNMjQwNDE5MDAyNTAzWhgPMjA3NDA0MDcwMDI1 +MDNaMA0xCzAJBgNVBAMMAkNBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKC +AgEAuYf0lxxLL6o2XkvhyAH5v454URbhRS1s4K0U2F31wY5DpmveKI2/amRuvNUD +URMV5VB+REWSMMJmY4bxqJ6CxqBeKNE/RXTb30N3XDyZ5tqKb/R4GnvHXZ0QE6xx +Gar0ao50/K4pcZmUjhVk2pLoBp+ffGym8ZKBkODDMzVjwEq/pWgcBJK6qe1N/Dyj +qurysdc+xklV7hJhTU88/lVUe5cvXzD1JSVCsJlkZWlftQ7ARmyPTpAi+yI+R0V5 +ivCBvMgHvfxmzrBQbMX2JrM52wuQFN+ORCS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Iq8qhpNML/5b0sX7UqDGVXO2lxtCDrlRTiViwqyEsmfMNHOCyO43AwZTnRbO/0 +jJFaB6zUsRKQrBUyIB2ZYdMbHarJHGahtiN2YT6cf8vKqvj56gpbaRq4EDYAnNqj +vO7rjSuTrXhevYHYUI/9qlMl00iz829IR5ixaa4k1sk4 +-----END CERTIFICATE----- diff --git a/Projs/PD2/certs/FakeCA/CA.srl b/Projs/PD2/certs/FakeCA/CA.srl new file mode 100644 index 0000000..cae53a9 --- /dev/null +++ b/Projs/PD2/certs/FakeCA/CA.srl @@ -0,0 +1 @@ +7F4C6BBD8E095E37521D85095EBE463D9916EFB7 diff --git a/Projs/PD2/certs/FakeClient1/client1.crt b/Projs/PD2/certs/FakeClient1/client1.crt new file mode 100644 index 0000000..58148c0 --- /dev/null +++ b/Projs/PD2/certs/FakeClient1/client1.crt @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFFDCCAvygAwIBAgIUf0xrvY4JXjdSHYUJXr5GPZkW77cwDQYJKoZIhvcNAQEL +BQAwDTELMAkGA1UEAwwCQ0EwHhcNMjQwNDE5MDAyNTE3WhcNMjkwNDE4MDAyNTE3 +WjA3MRQwEgYDVQQLDAtNU0cgU0VSVklDRTEMMAoGA1UEQQwDQ0wxMREwDwYDVQQD +DAhDbGllbnQgMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMw0zgbG +HdyiHu8ktYTH1BvdbhC5ml4MC9SEfTtCK4PGo4bUIQvjM3hYBu90tH8/6Jzx4dJ8 +AvWFDUnQJ6bkUFLLA7TivggBMQM6lbsX1Aqd4XO3+U31O3GJRyC5ikqv/JHSSKbP +HE2jbUUR3StJqKMVLmTxVkLsU+USDEj3+dRMST/IHIIL+hrO7mMsI7XzjMQELAUi +GCF6Em+CuitpNr3mMQhOMpA0ggM1D5vtzale4WYcj4sEo+9GSBKRwVBqhxKM/3Kn +1yY8G399RLqQAX+tHmb2jNnKwUm3oblqLqxaqvaRUv0HRcv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G1zZiWxR8jdaU6iszh+u1Vn5rCa3wuIVoNNQkwJXUH7tEfeulwp +7xr1nN9k9IrieB6MQ1Mmg2GDYPQHWx3HV/j46adye0GMap4mMEYm1vN0ZV4hw/yv +z1Oh6ifZdsQ= +-----END CERTIFICATE----- diff --git a/Projs/PD2/certs/FakeClient1/client1.csr b/Projs/PD2/certs/FakeClient1/client1.csr new file mode 100644 index 0000000..1ac8ead --- /dev/null +++ b/Projs/PD2/certs/FakeClient1/client1.csr @@ -0,0 +1,26 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIEfDCCAmQCAQAwNzEUMBIGA1UECwwLTVNHIFNFUlZJQ0UxDDAKBgNVBEEMA0NM +MTERMA8GA1UEAwwIQ2xpZW50IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQDMNM4Gxh3coh7vJLWEx9Qb3W4QuZpeDAvUhH07QiuDxqOG1CEL4zN4WAbv +dLR/P+ic8eHSfAL1hQ1J0Cem5FBSywO04r4IATEDOpW7F9QKneFzt/lN9TtxiUcg +uYpKr/yR0kimzxxNo21FEd0rSaijFS5k8VZC7FPlEgxI9/nUTEk/yByCC/oazu5j +LCO184zEBCwFIhghehJvgroraTa95jEITjKQNIIDNQ+b7c2pXuFmHI+LBKPvRkgS +kcFQaocSjP9yp9cmPBt/fUS6kAF/rR5m9ozZysFJt6G5ai6sWqr2kVL9B0XLzLin +UI1pIvpcCRNRXTop7VzhqBce30ReL95AHSxQxeI11e66AQlnIVjShUwVhz9xbuDJ +yN8ITvIsUclonRUEvJnRKRJ4y3kaIZl9T0POMeS59RIYQv5WiZXzK95KMa0BLWHd +gh2Jtsvi9JrPbElSEK0pIY2LxRXJAetLEOhAMfPgZSdFuQHBzoRlGft7ljdkoFmg +kKJ9NQK1f7CE+GBYN9UQdIpC9dB56R61GWW4WSQ6fEU9pad0HV6J2NzPYGqfyuVB +VvtH1REdVKwV5Axg5G7wDCxQgJlJ2xYBWeAzmKCty9vc/F6Jn4RT/yeDj/Gvy6z6 +z/FxW9VLWHsvSXHk2+6SY2zw9tSnQZmyrQniP2PcQgujoRNmWQIDAQABoAAwDQYJ +KoZIhvcNAQELBQADggIBAKkdNU5DjB7stz9pVaU7fee9l4c7V0Qzcsk3ZHAtWR7h +DtP8c44d0Dk4Gb8YIgHcBH8x8RNYjWDUui74H5klhahWtuyaUXF8wh1KgFZ9qr05 +xlZ0al6wBRlDclWZNciCDAyDzk9NYHeV6vIsNvlZcf9rdAxdfNdx1ufQno6yhcvW +xeJBy6TE+6xfj0YMagTCRQ3hXH/75BbMalgJmuAXoy1XhTISSOqwzm4AGbOhxwLB +aeaj5YsSYvliZP8lSMfak4OMN3yqmS++q2G1si2KIXYRN+v3sFPjdKnfwBWc99nH +4NyoKg/lWR4Bd4wmVESjAnS3YdtZ64L+XRGn+y2kdQPFBCEetnSY7qdOYBWvsHAc +4qYtmbMEmOr029s+c5qeSsA1+3lb98bpnaDPMIpltIK9ZNbGJ0vB+Y4rzGpHyGzu +D6bnuNRpB9e1+3nfY8W4WgQlt3wAtmtJ+3sG0VvHkIhADE2bkcreSvSJDc8J8gnc +EmgdlhBvjbaTdjbfbH6YZ/4+2QOQf7k/h00lnc7VqBXT9ly7TN7gvRWCVQdod2NS +3NjOTAocLRgZNzMFFGScbs6+UtpO0ySaWMUyyAs+TukDSbtEQIQQkKEbCJF1V1zH +FXEw7Ex1VXL8zkO72/BovMQRurSd1Jeaqy5nf7EgHDSA45Tuj5XlTnuYuy8TzwTO +-----END CERTIFICATE REQUEST----- diff --git a/Projs/PD2/certs/FakeClient1/client1.key b/Projs/PD2/certs/FakeClient1/client1.key new file mode 100644 index 0000000..0ba254a --- /dev/null +++ b/Projs/PD2/certs/FakeClient1/client1.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDMNM4Gxh3coh7v +JLWEx9Qb3W4QuZpeDAvUhH07QiuDxqOG1CEL4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client1.p12 new file mode 100644 index 0000000..35c8aa8 Binary files /dev/null and b/Projs/PD2/certs/FakeClient1/client1.p12 differ diff --git a/Projs/PD2/certs/FakeServer/server.crt b/Projs/PD2/certs/FakeServer/server.crt new file mode 100644 index 0000000..74e7f40 --- /dev/null +++ b/Projs/PD2/certs/FakeServer/server.crt @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIFBDCCAuygAwIBAgIUf0xrvY4JXjdSHYUJXr5GPZkW77YwDQYJKoZIhvcNAQEL +BQAwDTELMAkGA1UEAwwCQ0EwHhcNMjQwNDE5MDAyNTAzWhcNMjkwNDE4MDAyNTAz +WjAnMRQwEgYDVQQLDAtNU0cgU0VSVklDRTEPMA0GA1UEQQwGU0VSVkVSMIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAo9N5whjSzDHjlxb0q/AjYRljsT90 +CFSUc84rvYmkgaHAtOQ0YjGuLXbjCeKgmk3qfg282T3qiVtZsjYZ5fzFON/q2pNu +tchfg7I327iKTMKb1EKbgTxXCNen6gZuHp1QxkedaKphZ/RT/Mk/MU2h+jyhdvPS +r1syVAae3M+u8/WAoliR/Utt2zXRbYv64fVnKgbilBtu364Pmr5bedkc70LX5DuJ +UIvYmn76SpFXLfTMF7NgfkuvZTJxIThncd4dXKgdXdGbmtLUsWJrjl2nBnbE0ir7 +U8h9pi20LkZFAZLwGi8dAT7unObwwbtJojEezWu3esbh1TEKIfZRR2vY/xJLsLcn +FB1wZr0rq3my1B4IMnnQIIIfS+isNYLyUxBM6cZJxcLfW7FBP3n5ut4fnHjgq+dL +rO25qX6o6PAs5j3+/Bjs/c4NhYhhKd59fHbRbrE6YV6XX85RgLgPf6lKbazDGaDg +aX6BD8/gxjZXs80eN+nEVfyUS+VDlwI8QxRpIAs6s3FJ8g84qqo3Bi45cjQRUcl3 +0TE/AlayKAK+BP22XMZfCO1LN8KSO/1mUXlbj1eWJkCuiJmY1NaQyid2NLWtWtc8 +QwS34Qs7OmGYaKm7FvDhflOmPuj3jgreNmXUQCPZmkEwXj15sr/hgkgv7DOXkqtH +Pv76HGbZjLD1ywcCAwEAAaNCMEAwHQYDVR0OBBYEFOitNMCTz/jVd9CIPHAlpD9D +VomhMB8GA1UdIwQYMBaAFNVmKiwSu16jTsYiNfN2oyxpsY9tMA0GCSqGSIb3DQEB +CwUAA4ICAQB0YDLjCyueHMq/HemqJhqcWLmccyPzNYuGxDTbDp6Rz3pfuSi2+UBz +oz9swcBer+3dbcxlOD05g/SReiyT2J15YZnsWd49ul1MYDQvi6YpnGP8OG3jT8E2 +YTH55nWaAGpM6POdhmeEdSYC3sb13GArKHJAJqbumrdXUm3kjQwPrFrfsqWo3FGl +cjl2+2XXcfS388KYfw9XuacAeKrtBNpGuLVzvNvOWqo5YWfsgWnS6VI5x7gKcjrJ +sIFv3E3y6VR3TLG5D2GsHE9gS3TeMSaYtySl+NzlmfUaUBYdLyz6gPbO2ph9WdzO +0bVAtpZef6nuIBpWuVxOKTfgZKVPJly61iJZC2vFfKUUXduRbmhdcCWfKIw/VGeD +sX12oSMo2RvOBi6GMYj9z/1ZuzVPGm3muFYVtGfCr6ggbKHTnsQj+qwCnWrPQsub +olrascGR2mYXO5Tn+j1KswJElwZJvz/jvATxCVwITtn9K6yqwLAHJ8ZtlQzzDV4s +WcasX1msLGDZsJ9zwT1e6hudoGe1G58Bd2JKC73ZWqMJZVk9mTElfwZxcn7yMCv+ +jL+RvWjPMrKQ50b/odpo1/y8PSS4Es4v39YKNzkfQ2FAOtZo3+2tKz+tN3Qqli0/ +V3PQ3IzTk+WDwLgzzSxohNYl7GC75c4EC1qx+bGM/ryj6VIXjWBWxQ== +-----END CERTIFICATE----- diff --git a/Projs/PD2/certs/FakeServer/server.csr b/Projs/PD2/certs/FakeServer/server.csr new file mode 100644 index 0000000..4f6a5e8 --- /dev/null +++ b/Projs/PD2/certs/FakeServer/server.csr @@ -0,0 +1,26 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIEbDCCA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ARYXvP83Qk78Qdg472zURoWaDsr +s8Y1rYL79Mc6CHPm9CdTxwIHl7U4qqAzuW6wOJzXDEr9/N4ujBISeE/b0Rlr1KPP +u+FnCk45KZb52lYDvIzZbtUxfLlWRWFix/1n/5x5JpJXThIWPV3GscOoWFraBkNe +4GbfXcl+TY6HHyf5ghL16cHNp7417tB0n6HezB+5tvHobfx9/TKMHckBdnj8ZcPN +df1nDdEleImzbVTBEI4kne0PvdvanbFNMKUPQ4UXWbLyIYNWH1376xOIS0TOVqZz +UDPpIZrFEidJzrVODyj8Miwxq+c/CekReyeaVhCDZBlQ2ek2GtK78GpkC2ACGd+J +I5E5IcLaDMg2nB4FwDHvgjwilXZdTqwSyQFkVLLV+gE/meSSfN52v7NgxFGMaR26 +4UtJ68JWEkj56wzRrInMzOoMUUgm+Pm4Mk2c4BcdmIY= +-----END CERTIFICATE REQUEST----- diff --git a/Projs/PD2/certs/FakeServer/server.key b/Projs/PD2/certs/FakeServer/server.key new file mode 100644 index 0000000..3923655 --- /dev/null +++ b/Projs/PD2/certs/FakeServer/server.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCj03nCGNLMMeOX +FvSr8CNhGWOxP3QIVJRzziu9iaSBocC05DRiMa4tduMJ4qCaTep+DbzZPeqJW1my +Nhnl/MU43+rak261yF+DsjfbuIpMwpvUQpuBPFcI16fqBm4enVDGR51oqmFn9FP8 +yT8xTaH6PKF289KvWzJUBp7cz67z9YCiWJH9S23bNdFti/rh9WcqBuKUG27frg+a +vlt52RzvQtfkO4lQi9iafvpKkVct9MwXs2B+S69lMnEhOGdx3h1cqB1d0Zua0tSx +YmuOXacGdsTSKvtTyH2mLbQuRkUBkvAaLx0BPu6c5vDBu0miMR7Na7d6xuHVMQoh +9lFHa9j/EkuwtycUHXBmvSurebLUHggyedAggh9L6Kw1gvJTEEzpxknFwt9bsUE/ +efm63h+ceOCr50us7bm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S1Bs/8op5gs +LNPCC5II281Ly4bh27NSAMvnjGP0kuLErkgySDfWbH6F7Xo3h9dI+4UtQ7uICAyc +ZwsoPk97dKpDLcqk+hqRoEkorCCBuTItQ4gp6b1MVBNSXm6h6xyM1haPHnTW8FLh +DczheStxx98L3OmTt3PRxKUPhmQZBtOb9EQXbeUAkauXTXoyyJrq7C5L5nuTAT36 +VmECggEAUvV1tCR/qVJT71NC+0RG4Brb2PQzInbR+4wSKT+D5KKT5LBejrpapy2+ +H/TtCoFteknG+p5VhVUQ4J2+45nzCHFfHSi6GVKvXYJ5a+SDJWus5HhfGnVh/oWw +Iff+ofv9el0RTspQ8anyPI5+8KfB9w34atWFyNWuNuA2PIjjRQVIhriVGlFy9vTu +T5ZwNPuXYxPXwbu1Uh0JJ+RZZx1dAY3Jm1ttgortUqEceBhlt7eQo26VHTEvVesj +Ac4qICAGTAAUZ2Bt/oq1e3ysUPnNFOVuplLe64srbd122/pkNXIdTSGon7q12z8w +F+3k0JHCVQEeL4cEA/KpAw6UnU2d6w== +-----END PRIVATE KEY----- diff --git a/Projs/PD2/certs/FakeServer/server.p12 b/Projs/PD2/certs/FakeServer/server.p12 new file mode 100644 index 0000000..ce1d36c Binary files /dev/null and b/Projs/PD2/certs/FakeServer/server.p12 differ diff --git a/Projs/PD2/certs/FakeServer/server/server.crt b/Projs/PD2/certs/FakeServer/server/server.crt new file mode 100644 index 0000000..f37d0c6 --- /dev/null +++ b/Projs/PD2/certs/FakeServer/server/server.crt @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFFTCCAv2gAwIBAgIUXQ4FoRH0FvD5H2xNaaDTwfg5PUEwDQYJKoZIhvcNAQEL +BQAwDTELMAkGA1UEAwwCQ0EwHhcNMjQwNDE4MjMzOTAzWhcNMjkwNDE3MjMzOTAz +WjA4MRQwEgYDVQQLDAtNU0cgU0VSVklDRTEPMA0GA1UEQQwGU0VSVkVSMQ8wDQYD +VQQDDAZTRVJWRVIwggIiMA0GCSq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Ktw +KwIsJTo068ocjUobZU1c2gyCwhC2QJ7aXnvSOdmJPPORhT90NL+bxXI7sfqdzUwz +Mcgi/sNqY2psHUo/TelaBlktjMl1M0UmSpXCGTLZWJANkrmz2CMu0ggJgYmTpEvc +DsuMGoirP6Dt7PXw4T3aL4sB5T5zYF/ZG0hxC63FEwLyhcoCb6LzuzSQkhMvOfdN +PMS4N2VdzB7tJzfVHUQR/sjyFv1cAlGxJOBJ6y2sj5FFtbv6grfcKwdBo+F+eJ9I +aWAjdiT9TAIii9Trgs6HBrpJW7IHVNBBKbhVwet3bUSiiPuHkDwDbf54WdS6WkV3 +xjveSJkfC7OxThTiW+1uc8+1OsfVMI9pMEh8c53pCemAOkhpv8Ftkb/wxIToRIs8 +uPwNtn0/jlYV2Kr0omCOml5crGCd3vIxq/bRiCaTu6l7FuY0dY4aYskwJFFtvwV4 +Ew1HJZjVMjj/ +-----END CERTIFICATE----- diff --git a/Projs/PD2/certs/FakeServer/server/server.csr b/Projs/PD2/certs/FakeServer/server/server.csr new file mode 100644 index 0000000..3c7aaea --- /dev/null +++ b/Projs/PD2/certs/FakeServer/server/server.csr @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIEfTCCAmUCAQAwODEUMBIGA1UECwwLTVNHIFNFUlZJQ0UxDzANBgNVBEEMBlNF +UlZFUjEPMA0GA1UEAwwGU0VSVkVSMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEAmasxNh6YxleQgOUi0oL7Xy+v1L8/dijztT57cwjWOxyCKXWoTpaB0Aws +CBKSqeeb87aRKQSOVUaPbaCSrrqM/wb/2umJ7Z90xqYUw8MSaSEP565PQ4CcUgpI +1MvWQIkaseNbYiTl4ZtFd89jYPOMSnoLj1OJ7ONQPeg3i7KjAHu7PTgON+ra8co6 +W5uCsmnzRMldUswBJgyIYJcUi/9RguQ6yf5bAugT4Z96K4QcAVz4VnpAEI5eQOb8 +m+pbE1qknficOtnC+zPsbY8Y06W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kq9zCJguzxCoiQPZMpw9FqoMkjQeteDUmZI4OqOhwByTQBrgBFFPoo/Q/QTI8gKf +Ng== +-----END CERTIFICATE REQUEST----- diff --git a/Projs/PD2/certs/FakeServer/server/server.key b/Projs/PD2/certs/FakeServer/server/server.key new file mode 100644 index 0000000..c600776 --- /dev/null +++ b/Projs/PD2/certs/FakeServer/server/server.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQCZqzE2HpjGV5CA +5SLSgvtfL6/Uvz92KPO1PntzCNY7HIIpdahOloHQDCwIEpKp55vztpEpBI5VRo9t +oJKuuoz/Bv/a6Yntn3TGphTDwxJpIQ/nrk9DgJxSCkjUy9ZAiRqx41tiJOXhm0V3 +z2Ng84xKeguPU4ns41A96DeLsqMAe7s9OA436trxyjpbm4KyafNEyV1SzAEmDIhg +lxSL/1GC5DrJ/lsC6BPhn3orhBwBXPhWekAQjl5A5vyb6lsTWqSd+Jw62cL7M+xt +jxjTpbwYlKh0aPuhLQ1u8XpDmRdSV2MxRGWhgmPaSsgr9lZBaNunPOP8OF5FLvBh +weQcWR9ryFXPPPJOsQkjc5tXQstvIZmXNYNj+wqgI9SjhmXVhSE7uHgKunFomhFu +pCLIdvc5rdHGf2VmPP3wqj3csJZ+JWkSLvoc7hYX6wUHvc9xlznHwCY2/QnnQjFQ +nY0ieuufkx9cOfVDIdpdq9ChDbz8L0Be192p9yoCfoJg+s6nXiC59WeoegRGiP9f +wY1h+Tjnij7wNu2+4/0pZnBYMfB5HGaZehkfekJJBIeEPMqWOi29pQsGNXafwZsB +D8Tna5SBzzRWHK7N3KlDLMAcAaggqDq29Qe3Qxi4MqrC8sDb3nqvuIfCEiUFxViu +xiHEu3RNwXNOlRUKf861F5BUeOv/yQIDAQABAoICAAIdIjyp2BUmYDT9sehuZ9HL +4KHPDars7klIdj9DWFsQzdOPLEUEef2oJTTpOH5A0trb4IxNZT3UDiYGZu4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3aBAMCM9C +RMk6w4k8AIsnzWz690TxPsw9jyw/vq+hOJuQzpynNq+hvEXJIikvVpNPL2lZHAp2 +KZInHb4NFRV9LBbsOyv5YokklwXYRahheB71hpCX92u8jLWTguixxoLg+7uU90Ax +J9YlKcbrXlfAN1g7396TccF47Tk028fKKnIOEAZ0PqMa3YHiAfszCNVuMtQBrhHD +Tx9Uz+kmck7CaSadegf/5xLCVin3 +-----END PRIVATE KEY----- diff --git a/Projs/PD2/certs/FakeServer/server/server.p12 b/Projs/PD2/certs/FakeServer/server/server.p12 new file mode 100644 index 0000000..e021451 Binary files /dev/null and b/Projs/PD2/certs/FakeServer/server/server.p12 differ diff --git a/Projs/PD2/certs/README.md b/Projs/PD2/certs/README.md new file mode 100644 index 0000000..900385d --- /dev/null +++ b/Projs/PD2/certs/README.md @@ -0,0 +1,48 @@ +# Generating keys + +1. Generate CA key and certificate: + +```bash +openssl genrsa -aes256 -out CA/CA.key 4096 +openssl req -x509 -new -nodes -key CA/CA.key -sha256 -days 18250 -out CA/CA.pem -subj "/2.5.4.3=CA" +``` +The CA passphrase is 1234 + +2. Generate server key and CSR: + +```bash +openssl genrsa -out server/server.key 4096 +openssl req -new -key server/server.key -out server/server.csr -subj "/2.5.4.11=MSG SERVICE/2.5.4.65=SERVER" +``` + +3. Sign the server CSR with CA: + +```bash +openssl x509 -req -in server/server.csr -CA CA/CA.pem -CAkey CA/CA.key -CAcreateserial -out server/server.crt -days 1825 -sha256 +``` + +4. Generate the server's keystore: + +```bash +openssl pkcs12 -export -out server/server.p12 -inkey server/server.key -in server/server.crt -certfile CA/CA.pem -name "ServerKeyStore" +``` +The passphrase used for the keystore is server + +5. Generate each client's key and CSR: + +```bash +openssl genrsa -out client{NUM}/client{NUM}.key 4096 +openssl req -new -key client{NUM}/client{NUM}.key -out client{NUM}/client{NUM}.csr -subj "/2.5.4.11=MSG SERVICE/2.5.4.65=CL{NUM}/2.5.4.3=Client {NUM}" +``` + +6. Sign the client CSR with CA: + +```bash +openssl x509 -req -in client/client.csr -CA CA/CA.pem -CAkey CA/CA.key -CAcreateserial -out client/client.crt -days 1825 -sha256 +``` +7. Generate the client's keystore: + +```bash +openssl pkcs12 -export -out client{NUM}/client{NUM}.p12 -inkey client{NUM}/client{NUM}.key -in client{NUM}/client{NUM}.crt -certfile CA/CA.pem -name "Client{NUM}KeyStore" +``` +The passphrase used for the keystore is client{NUM} diff --git a/Projs/PD2/certs/client1/client1.crt b/Projs/PD2/certs/client1/client1.crt new file mode 100644 index 0000000..783ba54 --- /dev/null +++ b/Projs/PD2/certs/client1/client1.crt @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFFDCCAvygAwIBAgIUfEdbWdFRD1TgQr9L/b6BG/TtrzUwDQYJKoZIhvcNAQEL +BQAwDTELMAkGA1UEAwwCQ0EwHhcNMjQwNDE5MDAyMDI4WhcNMjkwNDE4MDAyMDI4 +WjA3MRQwEgYDVQQLDAtNU0cgU0VSVklDRTEMMAoGA1UEQQwDQ0wxMREwDwYDVQQD +DAhDbGllbnQgMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKPqlFVk +jPsXRitfIlY10cfUH4Dd3E4i+lL+AuiTP49BWpYPa6Z0lXlcNnR4vpxhVbZyraHP +qlg+/THqi7KQzQkeNxh+ep5IXguBPsWksOsB/LePS++bvtkYMIB4LA8K0HmUcoZA +3hgblK3fDiSh4e4shNHKNyef079Va7Fww9hIwAk1vTylNqvmbtHEF7rvbQGYjsmh +TbFO8dOToI2lNcx0M8q3v2D+ht2NKJfAD3EA1Zqd52/HqABiSmG/6cD624qE9+Vf +uoxoXsx3fGYtnwFE29Ia2b/MZPTgq9MUTwr15iZLhKmZ7pl1/7yVGzulPkaNUutm +zYv4lv76KeMax4PlTwWk6PnnjZewCJMZFLrlUvW071elitkVhC9iMewa0WuczkUL +Te0REYWDPAhIIuCGRpt74HRiWxq5sq9q50w5NIKpgE0WEKahoNz7xpLwUNP514jZ +Tx9rAxHk2xzGn2xuoNoW+WROWuyYizozgaxhqNqEt6UXOk5ptcQ4v76KxcNeZ+iA +cKydGzEm377NLoGlPe1eRhQVXZ3sKRZS7+Wlr1gMP+gQGDfMNetk3LP0P5nZ82eN +dep74VwjX4ZPOrUhQ9IT0VpKmxpRo+Z82eupr+aVJr+5gvrIrSFAzG56iguz0vYr +t3NoT3i5BC04W82XcR3MejDXs0iPsp0HlEK1AgMBAAGjQjBAMB0GA1UdDgQWBBRJ +MH7dvIzSSdQerDiVwC7aAtfMOTAfBgNVHSMEGDAWgBTFRNY8++1sHgvGqO21WMbo +wnWw0TANBgkqhkiG9w0BAQsFAAOCAgEALD+u8ieLA9tcZVoX9rhfOxXoqxxvRzKi +rHkHV1Oa0Ju6T/mnvkFafwjOUGHo1prTW6MyL1re1l1xVJmgas9RigsbztBl/5n5 +l/5RCK+kjgABH/jutJhHaU6CHxhyuzeQUzCuYtALOMWzRVm53P5mQXuFhwGxB64o +oDfyMoYn44Jjpb/dWkY+k49vprXwfaMf+JtzeOSAeqfqt6AHKoNRb1fVc3E132k+ +hBTnhYgDjquQNJOhKKkACAwMPTtC21F+MObRx9CxJRR78y5jF82YsTdzKtWwliCC +j6A3Wl3TzVpiNc6ifsnqGA/49UKOh108gt8+yJx9fQFduzaPt7mV19zTSoqq3Q9/ +2awep4ObDwUY3jqFLXYBPcr27fh7ygHFTqbFieK0nH52IMv3ZxRs94wBbmHykxPq +3ka+XryMVc9Ld+P9AIHeMyXdkqGNP0SrkolSfgNigO/l/NSdcn4qibduZG9IlUys +S1JztvWHjrYYeE4he7eVz2BdKpjmAJtaM1zWytyCYVXqUrbw+wN0JC75LD3bcW8J +cjK1IcsQSrFeLiwtfrQp8K2Saxa43t3D6iCceji+8tV3YTrIfi85F3sq+Crrej3a +vtRJAiSKH3UKk9TBv/MvHrMkkTyId8HSdngRcj4KqBahluoo9lPDQGwaXfXAeSI1 +xNijtO4t6eM= +-----END CERTIFICATE----- diff --git a/Projs/PD2/certs/client1/client1.csr b/Projs/PD2/certs/client1/client1.csr new file mode 100644 index 0000000..1c6f632 --- /dev/null +++ b/Projs/PD2/certs/client1/client1.csr @@ -0,0 +1,26 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIEfDCCAmQCAQAwNzEUMBIGA1UECwwLTVNHIFNFUlZJQ0UxDDAKBgNVBEEMA0NM +MTERMA8GA1UEAwwIQ2xpZW50IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQCj6pRVZIz7F0YrXyJWNdHH1B+A3dxOIvpS/gLokz+PQVqWD2umdJV5XDZ0 +eL6cYVW2cq2hz6pYPv0x6ouykM0JHjcYfnqeSF4LgT7FpLDrAfy3j0vvm77ZGDCA +eCwPCtB5lHKGQN4YG5St3w4koeHuLITRyjcnn9O/VWuxcMPYSMAJNb08pTar5m7R +xBe6720BmI7JoU2xTvHTk6CNpTXMdDPKt79g/obdjSiXwA9xANWanedvx6gAYkph +v+nA+tuKhPflX7qMaF7Md3xmLZ8BRNvSGtm/zGT04KvTFE8K9eYmS4Spme6Zdf+8 +lRs7pT5GjVLrZs2L+Jb++injGseD5U8FpOj5542XsAiTGRS65VL1tO9XpYrZFYQv +YjHsGtFrnM5FC03tERGFgzwISCLghkabe+B0YlsaubKvaudMOTSCqYBNFhCmoaDc ++8aS8FDT+deI2U8fawMR5Nscxp9sbqDaFvlkTlrsmIs6M4GsYajahLelFzpOabXE +OL++isXDXmfogHCsnRsxJt++zS6BpT3tXkYUFV2d7CkWUu/lpa9YDD/oEBg3zDXr +ZNyz9D+Z2fNnjXXqe+FcI1+GTzq1IUPSE9FaSpsaUaPmfNnrqa/mlSa/uYL6yK0h +QMxueooLs9L2K7dzaE94uQQtOFvNl3EdzHow17NIj7KdB5RCtQIDAQABoAAwDQYJ +KoZIhvcNAQELBQADggIBAATwXmX8jOpyPeH6PiC0pXo06CGpBtEXkcNeBt2qWway +XKa83AJ8jZxE0GBuFtqLYW4snI1IleEfhWQKEweVXYoBWeWfWj8EeGOx3+ow35Cg +IkSNJ96zl63L1N3DURqHfU0gCHB2/kY4h6XjawOolQtOPShPEW4oB8jj2txmgmzR +Cd74KzACymNdS+LzSFDp9rZkWWOZS6XOaqZ47DndveYc8GvdubsChZbUApnHOWw4 +IYcqRAaMGOXVKino9RTp/3TLUSyIVdxJKSzBqEKFRAgElns5bixCtr1PpnpCyE3h +mCtU4It9nqZU2zi++elgun4yIHLvZW5bZtyKJvQhgSKoX24fx/YzZUY4doMcsttD +I6FiWLyxuX0qMUpwMoz156yFhLFisFm+Xz14KhIJ2ZFxWKkAz8LqV9qS1JHFiwax +wiR9qXHwBtCPneQFLjdR4Thk9f1bFJC0xXPMbWOPch8+FRlN/1dhxqmgfYNEw8sB +Y94QtwmGplrjgatWE7J+Hy1NR9Q9UHhTxB4mEQ6sp5OoRtHl1qVBW+Y7Tbsg0Fp8 +U+dPvR17o7KA4GlHGC4O+lN0u2tZyg+RAz/SdSBMppjkMbN0WFtBRMaDjJc0dT9t +fmPSVBrK2kjlsTp4GPCQL+W5XhIgCv59muMUqexv/Hx7pRyAZxG5VPxij+j3blC1 +-----END CERTIFICATE REQUEST----- diff --git a/Projs/PD2/certs/client1/client1.key b/Projs/PD2/certs/client1/client1.key new file mode 100644 index 0000000..0c7ab1c --- /dev/null +++ b/Projs/PD2/certs/client1/client1.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCj6pRVZIz7F0Yr +XyJWNdHH1B+A3dxOIvpS/gLokz+PQVqWD2umdJV5XDZ0eL6cYVW2cq2hz6pYPv0x +6ouykM0JHjcYfnqeSF4LgT7FpLDrAfy3j0vvm77ZGDCAeCwPCtB5lHKGQN4YG5St +3w4koeHuLITRyjcnn9O/VWuxcMPYSMAJNb08pTar5m7RxBe6720BmI7JoU2xTvHT +k6CNpTXMdDPKt79g/obdjSiXwA9xANWanedvx6gAYkphv+nA+tuKhPflX7qMaF7M +d3xm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uPMtbt9AitRIufAFrNDdihAQyMKQQi9Dp9AoIBAHzr19/NeYJaaAeb3jL0 +N2I7DEh6o8Q8I05iGXq2ND0rIEcbJ7tXOmF6//uZiW57s97/9G6XKLu/vHSMUSg/ +IgeogxAI6jf/J4ybk+RNGT1T5wdOi3UeWLcCEtjJpYqR+E1HYKdyVsVECey8ZMoN +rJL63cSSxJQRLWQOdXEcyjArhO5PU4s5g7UthGoRO/FtjieNA+mZZBimPfRCMoVm +UY5XQToK5AdqV0TUuJF2X0EX6/dHM+siBiKZ1RaH7JwV9XY5JPKKFRDSNwBoeVT8 +IZTxillUDtp6HF7Rmom4D/jOKDh7jcD+8pSqOJ8u2Pn3If9cALF+kThXPaTtPN68 +a0kCggEAFeGPg4ImJd/vRBZlvf4u8euU3ihx1Y3YAoynQt0aosNGfElkHRO3eA7t +6WnbmjDjOs2SMv83O/4IrTzmqDHyLfJIPnxkIKDEZkWnUZsJCXrZwwt8QeC4wJVj +yktOe0PfhZmA2k5RJgiy9yu/mRs/h82O8twvTw4nujkSaV6DkAKqBlf6GNRTEhk9 +tpcyB4RmPclWebF4KsudOeHasidDvvw3KRiD33XI2+QcpLCe8KSw5Iwd1PGN9Fac +raj0QP+njy0H1PmgY0auTCxWlgey/nRVOkUiK1PMT3Ft+R9QQSiQHDM9vzhX5W1L +V9adr9w9IqxWjYWPMhfeyCbQgFcWoA== +-----END PRIVATE KEY----- diff --git a/Projs/PD2/certs/client1/client1.p12 b/Projs/PD2/certs/client1/client1.p12 new file mode 100644 index 0000000..020ee32 Binary files /dev/null and b/Projs/PD2/certs/client1/client1.p12 differ diff --git a/Projs/PD2/certs/client2/client2.crt b/Projs/PD2/certs/client2/client2.crt new file mode 100644 index 0000000..965d96e --- /dev/null +++ b/Projs/PD2/certs/client2/client2.crt @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFFDCCAvygAwIBAgIUfEdbWdFRD1TgQr9L/b6BG/TtrzYwDQYJKoZIhvcNAQEL +BQAw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2o5fh01MnO4Gz7Gz35pQUDVMOB0xvSriF9KpO7fMz +yCq12M1TjDtSHuzxbRDb9i5gmbF/LBCszq1XouV5ltZJPMHIzKSwHjE9p66ZTUp3 +JWbv+PQHaATzY6XVTDf3a0WFwEAl8A/spnx+HtdV0oHAeg0+BmpmMLSycw066tyA +SE1ixiDPMKkpjiK4K1KOdxIuLIHT8BuHV3qebaO7G7X+byv6VmeX9/sxCRQ+UfTX +pA4oRkP3eTF51V+yccb4xjW9dGPbHE9qB2RCdbORQkZ9Q5q8174mSkTpBYUVsEK6 +/3Tme5jSR17D9n9nwRXin4tg9+sDd4nNns378MipZD+HVlpY0kt6kKeGDSfPe3N6 +6ZDYdHGDZSHFAjgVRpHj2dTqm/vENIELJYCRAADhApHhFGpxPuYOePFg42mIst51 +WCXSLEXcGIX+W7FCV1otkXxroYAapZVRVsfbk6ltAmawY4cGtz/pItgvc2e7W/87 +a5yoUtD2eoX+YbQ0mtfFjIwg+sD2imXPBatLBcngaLPF+3afwvXc8IcR9qx/FgwL +nK7IKVBsPt3P7Nr3de1nXrui0yVZn1yXO9SKe89O41dwP05fQaZQAGGUWr/YntqB +JO+V/TUhWIQ= +-----END CERTIFICATE----- diff --git a/Projs/PD2/certs/client2/client2.csr b/Projs/PD2/certs/client2/client2.csr new file mode 100644 index 0000000..ec5d359 --- /dev/null +++ b/Projs/PD2/certs/client2/client2.csr @@ -0,0 +1,26 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIEfDCCAmQCAQAwNzEUMBIGA1UECwwLTVNHIFNFUlZJQ0UxDDAKBgNVBEEMA0NM +MjERMA8GA1UEAwwIQ2xpZW50IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQCx0vEeRtQCYjR0f77HN1dPV3fq7/VIQt0wPiE8Rtq45kWO0dXrRVbURYRN +aNAy5JZBSAaPyzvJ0JkZrtIkv7ZSEvZmagLqs92pvJ22B+Re1l7LRTC1dQsC/gCH +oHKo9LDBQ9wnM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D8ahChpK6Tg+Z +4ZHKKUjgqxwQKI0AtZDZ3+WzGkyELvLNydzNw7/lrAQPPsnXy3UZTM8tfMCK6XT0 +oAHeYwP7isf0gMvl87voqV8ILIepZuWKbHIJzWT0Lrku8yjPE+6vdJQgYbtwE1Uh +P/rV5A8FY1ZzXOMTz041Ky/DmAte775MzSM6JzAPtNee1CdFn1ek/CVvFGmf7hxU +-----END CERTIFICATE REQUEST----- diff --git a/Projs/PD2/certs/client2/client2.key b/Projs/PD2/certs/client2/client2.key new file mode 100644 index 0000000..8d1cc9e --- /dev/null +++ b/Projs/PD2/certs/client2/client2.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCx0vEeRtQCYjR0 +f77HN1dPV3fq7/VIQt0wPiE8Rtq45kWO0dXrRVbURYRNaNAy5JZBSAaPyzvJ0JkZ +rtIkv7ZSEvZmagLqs92pvJ22B+Re1l7LRTC1dQsC/gCHoHKo9LDBQ9wnMKt+IWPb +WtIAEz/mg3IDke+82QmkYxMQhZ5g8c7L1Fe8Wqq6lO4tgvfcqr0q9XRkbaQBWYKc +sWK6PCRN6czn5G0Da0O3H7Ue5XQIVhSQPLCbDO4VJbtfUghm5GgoiyT3GNMi3H8B +QIYs+M1KQPwhodrEgB5Jx1HZCQXnt7n6GZ4Qg25JpROfK3KHbEmiuNcRwCNlKyPj +xbkLXQH6g0vDhSyrtHY9BPJgAPfxkwZS3SMN8ICMvKWUy0QCtf/FHCnym+JTal1g +6fWSh/6VsE6kNhZpHvefmzaMjk4gzcRA8smCru+7nJamjKODNOcF/t8FVucu1383 +ARdaIvUfUkR81pWjI9aLWl44829EiUDQQe1dzE+PhV3u5aHEGL1VPPBrYBjXKm/S +Cktea+ZIuVUq5/J5wAvcj7Pe4EdpuwQi0ZT5i709mqPplCc7YYUHwMjMO50mQie3 +1G6F2Bi9/G3BHdgAPU5rNseRp+Ru8ggQ8XRZIY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GFahD4Gqc9 +VW1JAoIBABPafIX1riRKxN6et+aqnVCYpOlbWCV5bgr7Hl0/4bjKJc7h39hRTwdn +21pki9udJc8jtsayQMDpfoZKiuGRK6wiLgVOrimKvaVOVvWXGr+EGZ60g4tLmXkh +2P0DB7M9QhhEPj82NrzKRrcegMWVeSxbCPBdDoy48IVdJ5XOwldcQ02lX9+W49kn +QI4Tx7/vQUTYKmLpZhF4zpgR6KecegDP8qwitg5GVYO2yXPuCn+RvWhsz5LXkEKM +2FL9McH6BjlEisfkEZoW4fEHDCK585MU1AzhQMu6MmNPmR10mEaCMlEkIDfcXnn/ +QRaur6QnOTsf+omdCjplByBOrr6Zsug= +-----END PRIVATE KEY----- diff --git a/Projs/PD2/certs/client2/client2.p12 b/Projs/PD2/certs/client2/client2.p12 new file mode 100644 index 0000000..aa22810 Binary files /dev/null and b/Projs/PD2/certs/client2/client2.p12 differ diff --git a/Projs/PD2/certs/client3/client3.crt b/Projs/PD2/certs/client3/client3.crt new file mode 100644 index 0000000..8361cab --- /dev/null +++ b/Projs/PD2/certs/client3/client3.crt @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFFDCCAvygAwIBAgIUfEdbWdFRD1TgQr9L/b6BG/TtrzcwDQYJKoZIhvcNAQEL +BQAwDTELMAkGA1UEAwwCQ0EwHhcNMjQwNDE5MDAyMDQ5WhcNMjkwNDE4MDAyMDQ5 +WjA3MRQwEgYDVQQLDAtNU0cgU0VSVklDRTEMMAoGA1UEQQwDQ0wzMREwDwYDVQQD +DAhDbGllbnQgMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALVWtrDZ +80/MZn6NqfVwuWK0Eam052bp0k8kHvf0MX8nw/7CzVuVw6cljRrb9L1KBAatdUfN +se7uihmcRq1swR7bepMTseNPnfAvc5pVhrZP/NWyxV2MoPWKV2Hb0GYQIen85OSw +XVYmRAuqls/d40vaCoWbqSjl5URNUBZGYKP3dpBeH397UxpsUas2sDG5gLZzonoz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YDo9he9RAnsOjHsXVi1rMXaOloZua12qg1E6y2X/xH/ +mOZFj+69x70xdVUaDpRvmw7xpAEG0JRdUW7/WThWj+npn2S/s/75QxX/W9mS6Yta +e3dj2nqSP3JCOt+KIoZExmB8K/ho8laJRT9cKrTK+fiTkt7uw+iItWctucauKAEd +7KRU6Y87aWkbvmS1+ITfIu2bY/FBKRIKHVfG3did/loKcSbadStpOnA3X4f4/RRd +T/ClrFe6zmo= +-----END CERTIFICATE----- diff --git a/Projs/PD2/certs/client3/client3.csr b/Projs/PD2/certs/client3/client3.csr new file mode 100644 index 0000000..61b48cb --- /dev/null +++ b/Projs/PD2/certs/client3/client3.csr @@ -0,0 +1,26 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIEfDCCAmQCAQAwNzEUMBIGA1UECwwLTVNHIFNFUlZJQ0UxDDAKBgNVBEEMA0NM +MzERMA8GA1UEAwwIQ2xpZW50IDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQC1Vraw2fNPzGZ+jan1cLlitBGptOdm6dJPJB739DF/J8P+ws1blcOnJY0a +2/S9SgQGrXVHzbHu7ooZnEatbMEe23qTE7HjT53wL3OaVYa2T/zVssVdjKD1ildh +29BmECHp/OTksF1WJkQLqpbP3eNL2gqFm6ko5eVETVAWRmCj93aQXh9/e1MabFGr +NrAxuYC2c6J6M1GM11InBQfOCiooqSWxGGKcpCjiPOaPFS8O8YSwVxBsWr1a93/1 +4ybhujpJUrmif9cky97msz1GG1pmSh/gFBmOGNgkLjhUGM3r+Nzz5KpLKwBi3V7m +05SVjs03Fv8wogbjpTF2RFnjr4UTlc0u5rCZ4yz3XHhYW60ApncjI34O9FOH8q9U +upqQu5xlaM76EpiTetMhaSR5P+bJ9hYWA4fzholDoWW7MzN8tN2lJsxZzyhhLgn1 +INN2FEbB08lr0DVLBuFpqY2YMhfsW8DwQbYQqHkAIZAXtz0ZZpcdvISldQLhHGwo +zbsctT4bn8+DYPiEFy7gMz5fTdQvY9HEGAbr9/5NSDEB8g6l+2A2ef103fCnCXl1 +4XuuxgWUCIRyMrDoLF5bD+H7hxFijsez7q1TGmrK9dZbEbFhHcsxCyK0VaU/dnW7 +EYpNqJoxnSX0q4kjBe3KZ5olj4KupNKF6IynxXPhmJscIwdfmwIDAQABoAAwDQYJ +KoZIhvcNAQELBQADggIBAEjCzmAnwXNtoScpxX+z3siWA8Hy41BmI/lIL4Gk1stl +UpCSGbdjlJNE3Vr2jnw4Usz/MIRVLeAeaFVVKm+5ILZEsvhyk8ULiSLYxa7nlL5n +yexS0a+vvdnicT9ijoUGxuRjk/5/5dKZJgLGgSl549lvmlLKPA1sUDcpwz/4fw4l +jEqIwoceGVJpP7rBzznYltaFzZsqTwJ25ZGgIccEjGO9H8bBkrPFh+q3dPYKqwRj +OeeA+ewgWCDLL/ReTiZS77O9aUTK7xymZdHHmCX+Xy4KUkRr7eM0sIfnLYd9BSMq +aBGHn7v/3ZaFZ1qp2RRBugkJupu2mkmmdGM4SVa7uXAT7PdnWBxLMFWo86iGpeZu +85RMFcq3MeVbi5wYt7IuweRrTO5MbSglXSizFkexJxmaLMXwdrso0MVf6yaTSp1b +gqGUJ6zaRfBYFx7DIBUvdCl9bK3UIVIMv7NYzZ3v9plZQNM5UadbisGsj/BzOzmv +jgwNtoF4gKO1lKLzzlRepBWGe+e50dvCNhBuaxg93ZOX9D+m24k6r2JIBqRPG4OD +xod9DoRnq6ANtjkIJYN5kywlI9XrtGX5RGyDMrWWBqjAvSl5Rx9rg2jiOuiv5lOn +PWNFasLC+jhvTeL6S9PpFYDTR76QM+9Dfvn45+ph0zw/5Y1Z8oEH6X31sg6E11iG +-----END CERTIFICATE REQUEST----- diff --git a/Projs/PD2/certs/client3/client3.key b/Projs/PD2/certs/client3/client3.key new file mode 100644 index 0000000..bbdc134 --- /dev/null +++ b/Projs/PD2/certs/client3/client3.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFA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b/Projs/PD2/certs/client3/client3.p12 new file mode 100644 index 0000000..a4b47b8 Binary files /dev/null and b/Projs/PD2/certs/client3/client3.p12 differ diff --git a/Projs/PD2/certs/server/server.crt b/Projs/PD2/certs/server/server.crt new file mode 100644 index 0000000..dd3a398 --- /dev/null +++ b/Projs/PD2/certs/server/server.crt @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIFBDCCAuygAwIBAgIUfEdbWdFRD1TgQr9L/b6BG/TtrzQwDQYJKoZIhvcNAQEL +BQAwDTELMAkGA1UEAwwCQ0EwHhcNMjQwNDE5MDAyMDIwWhcNMjkwNDE4MDAyMDIw +WjAnMRQwEgYDVQQLDAtNU0cgU0VSVklDRTEPMA0GA1UEQQwGU0VSVkVSMIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA2fFMnYrXlQ8rPwOrMHFCRHbJe6fF +b+ZuVcXBakexI3a4d8unQJKeEqVX5POndEKNERUPXOcGrifV7ehxfmF/6oK2Xx4u +IrLHibV0XjAXY7YcTQj+ao18BgdVdrUi7cS8YYyyKoT+SP+GkEVYF5vJEgoTRy1h +dQQLZYp5AqsqoBbXr4rVaUdXDD8c1zWMwW6NGDIXWe0eAMMXyjqJRkdZ3FO4+53Y +4Zg2qUeF1GcDRamyC0dGykHeYmaly9M2tO6Mhwuh+wlMEbj55wxpPu3rlboMGIgi ++G2H3cHJLBn/1TkO5BZK3+2DhhUn0KuB3nfLsSP8v5H2A7FnnDuQaB64G4cRHprI +new7k02UnPXNefrX8JqlmSIIEzaMXSP4BNhKVMSSUmS5NHvkvxTZBlC7CBoB6W7y +10Ja807h0mHbMkV+FAVbfY8q2wAsUq3JPWizq6pZ+dgapDmZ0xCOZRnXqv2kBXas +UHwxWUL18T4VwlW97+aUr8afIkATZU11O6GXJbRbRjy8ofP7gcSIkeWOZUDrJlRM +K5PEkhVBOFuVVuty6uZLZleSBNkUOzsCeFxsdaJE9TKlVzxp6ewvtu4PTelKj31h +mTMCenTPcS9sa6gZTGIkdscOMy7lZjsMdlcyAxjUD59w1ruzDQyTn2tP9I6lLnKT +cCMmFKQfbyAZNcMCAwEAAaNCMEAwHQYDVR0OBBYEFEWIGqx7p7sYgYjtB/oUbChu +MdH3MB8GA1UdIwQYMBaAFMVE1jz77WweC8ao7bVYxujCdbDRMA0GCSqGSIb3DQEB +CwUAA4ICAQCIYQ5e0FbeZKwjdktLHw0cnGA3aVZhjbxJKU8rcDzeKDDH5SkwS25U +qIv4uvz+YY4DieSD0o3caTQhl4tx67Y9VcHmIQMjcMqFvzHBRAFZLidOgrqdJeIx +wD2c5kgrRf+8XTBQ9AG+D+XbI13dawlpAbJpu8fNdNO2XGzKu/qF+2f8u6E2Hx/U +LwJ1zqCXisr10CBIAwPrcsWBgM6oY9/YTaKRnLv4McZ9nil5yI5Y4odGTFs9zB8O +HrWlmCIQI47EevZdMJ+48xrGp2tkvAExGixcIS9reWkHVNomysg7pK+nE0jpTqAk +ZvcCXBKS1Bv+GWxrhKOA66SWTO9uTSr98D8hLKwpr3O76MGhtoqnxAwdX3KhdJe4 +HUyFSb7uwizuNKNigknJwQtXB6lbqUEzoL5jSLEmHQ2v80felr6QDfrKD9sw590o +Gmwaa1riSqmnzZhE8ROumn+zknFjnovzde0RUIZ7o6zqM1hfSllNPPAMx2fzvXkI +KYjvBNgVsmZmklkEpVkAB0XijNDYGC/iwdG2os72jCxPAOMoBAnz1LFI4Rl044Ly +6MIdk7iPvGLLfkCFt/qb8/iSRKW1B6caqZ292vN34c+sLJOkrjDVRtKVdTAUyDNU +O01F9HUPOjVWmfZbCNfIz1gyMEeJtQ7eyZMC6Eg4DV2Gft4lHX4pNQ== +-----END CERTIFICATE----- diff --git a/Projs/PD2/certs/server/server.csr b/Projs/PD2/certs/server/server.csr new file mode 100644 index 0000000..9c5c4de --- /dev/null +++ b/Projs/PD2/certs/server/server.csr @@ -0,0 +1,26 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIEbDCCAlQCAQAwJzEUM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CZippNVWI0Skiu +UfP+uoYVuv1U9lEjX8cz54mL7iOs5snXJVpt8oO17zKozfLAyCFygU+gUNNnh/K/ +T3EtvI7TlAAFMpYi5q95D4Mj3j6l2P0WcoLFrytCtRnLic6NCE5HYj2vScGN9WCh +GWcs4h+2MIY/VTxzn6AP82zXsJRusdfHoVAP/MDnP8YeIU9gtbWTJCl9DmdHQYp3 +Xw6/TBCQwnQhbGquHVl4WFj8aO7Mm3jtVm5eLTRXNMCYPvqbOlaeeKZRsJkoyInf +gYj+LTZ2ke4moZ00tG4PwSvTj1CKuswa6HfB5l1UHmCuEhm4saS6MbgORj6UHh0W +L7gLtdUINzu/7KE3ZTI+d4kgpM2QFozjTa5SRYCBkZh/WhRMbI1lleWFw2dKFuyJ +IxJPaCw5XRVz8TM2jAEMqPSA9hhwhKl42ieQKMbBTqU= +-----END CERTIFICATE REQUEST----- diff --git a/Projs/PD2/certs/server/server.key b/Projs/PD2/certs/server/server.key new file mode 100644 index 0000000..5e2de24 --- /dev/null +++ b/Projs/PD2/certs/server/server.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDZ8UyditeVDys/ +A6swcUJEdsl7p8Vv5m5VxcFqR7Ejdrh3y6dAkp4SpVfk86d0Qo0RFQ9c5wauJ9Xt +6HF+YX/qgrZfHi4isseJtXReMBdjthxNCP5qjXwGB1V2tSLtxLxhjLIqhP5I/4aQ +RVgXm8kSChNHLWF1BAtlinkCqyqgFtevitVpR1cMPxzXNYzBbo0YMhdZ7R4AwxfK +OolGR1ncU7j7ndjhmDapR4XUZwNFqbILR0bKQd5iZqXL0za07oyHC6H7CUwRuPnn +DGk+7euVugwYiCL4bYfdwcksGf/VOQ7kFkrf7YOGFSfQq4Hed8uxI/y/kfYDsWec +O5BoHrgbhxEemsid7DuTTZSc9c15+tfwmqWZIggTNoxdI/gE2EpUxJJSZLk0e+S/ +FNkGULsIGgHpb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Xb8MWtREmutXhuuTBhTejcUHaoYKGiUfkZGiB2BRLQ1sauTq +yf8sx8s7ZPlgQfpGfDNKOsZnL83KpYMnX4/dqX/4tBTzqrjds2TCgYH7WDZ+gjN3 +KTTyxMo3qUSzqxrSv36+jT+70akeBYJtDlu/L7J67TAc5M5M4e1jB+VH3DiMC67J +GIX4jkKoxdPs6uomeAFXoFytEBFo3Bw/3RK0HCbdwTNndjDyp0vdieBpkFePFmIo +NQKCAQEA5DL7HTH0030C4calqVa5lJqEbpvzVyrzkYCN6uewTx4df5UKOxuVwowD +IxFIBi2Z9T9wbBYkaMH2vtuJ59YApRkg6CmLeWtBYoPcDIedcB0BSDItisOOciT9 +tuKvMdRH5VkzTJui5VQ8CfXz50Cgs5VEmkZZ5WU6iVlOy3O0NSve01UrD1f/1Wq+ +SCLz6RR6J1NtFUwVKAn8nr4X3Q1uEoxACoiErUE7+V4zSb2OAXUvOYywiIy0sEKb +I1QOLhPch+F3wd1NPbRHbEMiziXRWj68qd6R/my5iUy00S//i4SJc2kKNkg0OyWK +f1Qiiw4+bNeBK2XZZKVXVltYUHrmUQ== +-----END PRIVATE KEY----- diff --git a/Projs/PD2/certs/server/server.p12 b/Projs/PD2/certs/server/server.p12 new file mode 100644 index 0000000..96f3046 Binary files /dev/null and b/Projs/PD2/certs/server/server.p12 differ diff --git a/Projs/PD2/cmd/client/client.go b/Projs/PD2/cmd/client/client.go new file mode 100644 index 0000000..9ab182b --- /dev/null +++ b/Projs/PD2/cmd/client/client.go @@ -0,0 +1,9 @@ +package main + +import ( + "PD1/internal/client" +) + +func main(){ + client.Run() +} diff --git a/Projs/PD2/cmd/gateway/gateway.go b/Projs/PD2/cmd/gateway/gateway.go new file mode 100644 index 0000000..f23513c --- /dev/null +++ b/Projs/PD2/cmd/gateway/gateway.go @@ -0,0 +1,9 @@ +package main + +import ( + "PD1/internal/gateway" +) + +func main(){ + gateway.Run() +} diff --git a/Projs/PD2/cmd/server/server.go b/Projs/PD2/cmd/server/server.go new file mode 100644 index 0000000..c93ba9b --- /dev/null +++ b/Projs/PD2/cmd/server/server.go @@ -0,0 +1,9 @@ +package main + +import ( + "PD1/internal/server" +) + +func main(){ + server.Run() +} diff --git a/Projs/PD2/go.mod b/Projs/PD2/go.mod new file mode 100644 index 0000000..5dd0d53 --- /dev/null +++ b/Projs/PD2/go.mod @@ -0,0 +1,38 @@ +module PD1 + +go 1.22.2 + +require ( + github.com/gin-gonic/gin v1.10.0 + github.com/mattn/go-sqlite3 v1.14.22 + golang.org/x/crypto v0.23.0 + software.sslmate.com/src/go-pkcs12 v0.4.0 +) + +require ( + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/Projs/PD2/go.sum b/Projs/PD2/go.sum new file mode 100644 index 0000000..d1fbebb --- /dev/null +++ b/Projs/PD2/go.sum @@ -0,0 +1,93 @@ +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= +github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +software.sslmate.com/src/go-pkcs12 v0.4.0 h1:H2g08FrTvSFKUj+D309j1DPfk5APnIdAQAB8aEykJ5k= +software.sslmate.com/src/go-pkcs12 v0.4.0/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI= diff --git a/Projs/PD2/internal/client/client.go b/Projs/PD2/internal/client/client.go new file mode 100644 index 0000000..f41e223 --- /dev/null +++ b/Projs/PD2/internal/client/client.go @@ -0,0 +1,323 @@ +package client + +import ( + "PD1/internal/protocol" + "PD1/internal/utils/cryptoUtils" + "PD1/internal/utils/networking" + "crypto/x509" + "errors" + "flag" + "log" + "os" + "sort" + "strconv" +) + +func Run() { + var userFile string + flag.StringVar(&userFile, "user", "userdata.p12", "Specify user data file") + flag.Parse() + + if flag.NArg() == 0 { + log.Fatalln("No command provided. Use 'help' for instructions.") + } + //Get user KeyStore + password := readStdin("Insert keystore passphrase") + clientKeyStore, err := cryptoUtils.LoadKeyStore(userFile, password) + if err != nil { + log.Fatalln(err) + } + + command := flag.Arg(0) + switch command { + case "send": + if flag.NArg() != 3 { + printError("MSG SERVICE: command error!") + showHelp() + os.Exit(1) + } + uid := flag.Arg(1) + plainSubject := flag.Arg(2) + plainBody := readStdin("Enter message content (limited to 1000 bytes):") + err := sendCommand(clientKeyStore, plainSubject, plainBody, uid) + if err != nil { + log.Fatalln(err) + } + + case "askqueue": + if flag.NArg() > 3 { + printError("MSG SERVICE: command error!") + showHelp() + os.Exit(1) + } + pageInput := flag.Arg(1) + page := 1 + if pageInput != "" { + if val, err := strconv.Atoi(pageInput); err == nil { + page = max(1, val) + } + } + pageSizeInput := flag.Arg(2) + pageSize := 5 + if pageSizeInput != "" { + if val, err := strconv.Atoi(pageSizeInput); err == nil { + pageSize = max(1, val) + } + } + + err := askQueueCommand(clientKeyStore, page, pageSize) + if err != nil { + log.Fatalln(err) + } + + case "getmsg": + if flag.NArg() < 2 { + printError("MSG SERVICE: command error!") + showHelp() + os.Exit(1) + } + numString := flag.Arg(1) + num, err := strconv.Atoi(numString) + if err != nil { + log.Fatalln(err) + } + err = getMsgCommand(clientKeyStore, num) + if err != nil { + printError(err.Error()) + } + + case "help": + showHelp() + + default: + printError("MSG SERVICE: command error!") + showHelp() + } + +} + +func sendCommand(clientKeyStore cryptoUtils.KeyStore, plainSubject, plainBody, uid string) error { + //Turn content to bytes + plainSubjectBytes, err := Marshal(plainSubject) + if err != nil { + return err + } + plainBodyBytes, err := Marshal(plainBody) + if err != nil { + return err + } + + cl, err := networking.NewClient[protocol.Packet](&clientKeyStore) + if err != nil { + return err + } + defer cl.Connection.Conn.Close() + + receiverCert, err := getUserCert(cl, clientKeyStore, uid) + if err != nil { + return err + } + subject, err := clientKeyStore.EncryptMessageContent(receiverCert, plainSubjectBytes) + if err != nil { + return err + } + body, err := clientKeyStore.EncryptMessageContent(receiverCert, plainBodyBytes) + if err != nil { + return err + } + sendMsgPacket := protocol.NewSendMsgPacket(uid, subject, body) + if err := cl.Connection.Send(sendMsgPacket); err != nil { + return err + } + answerSendMsg, err := cl.Connection.Receive() + if err != nil { + return err + } + if answerSendMsg.Flag == protocol.FlagReportError { + reportError, err := protocol.UnmarshalReportError(answerSendMsg.Body) + if err != nil { + return err + } + return errors.New(reportError.ErrorMessage) + } + return nil + +} + +func getMsgCommand(clientKeyStore cryptoUtils.KeyStore, num int) error { + cl, err := networking.NewClient[protocol.Packet](&clientKeyStore) + if err != nil { + return err + } + defer cl.Connection.Conn.Close() + packet := protocol.NewGetMsgPacket(num) + if err := cl.Connection.Send(packet); err != nil { + return err + } + + receivedMsgPacket, err := cl.Connection.Receive() + if err != nil { + return err + } + if receivedMsgPacket.Flag == protocol.FlagReportError { + reportError, err := protocol.UnmarshalReportError(receivedMsgPacket.Body) + if err != nil { + return err + } + return errors.New(reportError.ErrorMessage) + } + answerGetMsg, err := protocol.UnmarshalAnswerGetMsg(receivedMsgPacket.Body) + if err != nil { + return err + } + senderCert, err := getUserCert(cl, clientKeyStore, answerGetMsg.FromUID) + if err != nil { + return err + } + decSubjectBytes, err := clientKeyStore.DecryptMessageContent(senderCert, answerGetMsg.Subject) + if err != nil { + return err + } + decBodyBytes, err := clientKeyStore.DecryptMessageContent(senderCert, answerGetMsg.Body) + if err != nil { + return err + } + subject, err := Unmarshal(decSubjectBytes) + if err != nil { + return err + } + body, err := Unmarshal(decBodyBytes) + if err != nil { + return err + } + message := newClientMessage(answerGetMsg.FromUID, answerGetMsg.ToUID, subject, body, answerGetMsg.Timestamp) + showMessage(message) + return nil +} + +func getUserCert(cl networking.Client[protocol.Packet], keyStore cryptoUtils.KeyStore, uid string) (*x509.Certificate, error) { + getUserCertPacket := protocol.NewGetUserCertPacket(uid) + if err := cl.Connection.Send(getUserCertPacket); err != nil { + return nil, err + } + var answerGetUserCertPacket *protocol.Packet + answerGetUserCertPacket, err := cl.Connection.Receive() + if err != nil { + return nil, err + } + if answerGetUserCertPacket.Flag == protocol.FlagReportError { + reportError, err := protocol.UnmarshalReportError(answerGetUserCertPacket.Body) + if err != nil { + return nil, err + } + return nil, errors.New(reportError.ErrorMessage) + } + answerGetUserCert, err := protocol.UnmarshalAnswerGetUserCert(answerGetUserCertPacket.Body) + if err != nil { + return nil, err + } + userCert, err := x509.ParseCertificate(answerGetUserCert.Certificate) + if err != nil { + return nil, err + } + if err := keyStore.CheckCert(userCert, uid); err != nil { + return nil, err + } + return userCert, nil +} + +func getManyMessagesInfo(cl networking.Client[protocol.Packet], keyStore cryptoUtils.KeyStore) (protocol.AnswerGetUnreadMsgsInfo, map[string]*x509.Certificate, error) { + answerGetUnreadMsgsInfoPacket, err := cl.Connection.Receive() + if err != nil { + return protocol.NewAnswerGetUnreadMsgsInfo(0, 0, nil), nil, err + } + if answerGetUnreadMsgsInfoPacket.Flag == protocol.FlagReportError { + reportError, err := protocol.UnmarshalReportError(answerGetUnreadMsgsInfoPacket.Body) + if err != nil { + return protocol.AnswerGetUnreadMsgsInfo{}, nil, err + } + return protocol.NewAnswerGetUnreadMsgsInfo(0, 0, nil), nil, errors.New(reportError.ErrorMessage) + } + answerGetUnreadMsgsInfo, err := protocol.UnmarshalAnswerGetUnreadMsgsInfo(answerGetUnreadMsgsInfoPacket.Body) + if err != nil { + return protocol.AnswerGetUnreadMsgsInfo{}, nil, err + } + + //Create Set of needed certificates + senderSet := map[string]bool{} + for _, messageInfo := range answerGetUnreadMsgsInfo.MessagesInfo { + senderSet[messageInfo.FromUID] = true + } + certificatesMap := map[string]*x509.Certificate{} + //Get senders' certificates + for senderUID := range senderSet { + senderCert, err := getUserCert(cl, keyStore, senderUID) + if err == nil { + certificatesMap[senderUID] = senderCert + } + } + return answerGetUnreadMsgsInfo, certificatesMap, nil +} + +func askQueueCommand(clientKeyStore cryptoUtils.KeyStore, page int, pageSize int) error { + cl, err := networking.NewClient[protocol.Packet](&clientKeyStore) + if err != nil { + return err + } + defer cl.Connection.Conn.Close() + return askQueueRec(cl, clientKeyStore, page, pageSize) +} + +func askQueueRec(cl networking.Client[protocol.Packet], clientKeyStore cryptoUtils.KeyStore, page int, pageSize int) error { + + requestUnreadMsgsQueuePacket := protocol.NewGetUnreadMsgsInfoPacket(page, pageSize) + if err := cl.Connection.Send(requestUnreadMsgsQueuePacket); err != nil { + return err + } + unreadMsgsInfo, certificates, err := getManyMessagesInfo(cl, clientKeyStore) + if err != nil { + return err + } + var clientMessages []ClientMessageInfo + for _, message := range unreadMsgsInfo.MessagesInfo { + var clientMessageInfo ClientMessageInfo + senderCert, ok := certificates[message.FromUID] + if !ok { + clientMessageInfo = newClientMessageInfo(message.Num, + message.FromUID, + "", + message.Timestamp, + errors.New("certificate needed to decrypt not received")) + clientMessages = append(clientMessages, clientMessageInfo) + continue + } + decryptedSubjectBytes, err := clientKeyStore.DecryptMessageContent(senderCert, message.Subject) + if err != nil { + clientMessageInfo = newClientMessageInfo(message.Num, message.FromUID, "", message.Timestamp, err) + clientMessages = append(clientMessages, clientMessageInfo) + continue + } + subject, err := Unmarshal(decryptedSubjectBytes) + if err != nil { + clientMessageInfo = newClientMessageInfo(message.Num, message.FromUID, "", message.Timestamp, err) + clientMessages = append(clientMessages, clientMessageInfo) + continue + } + clientMessageInfo = newClientMessageInfo(message.Num, message.FromUID, subject, message.Timestamp, nil) + clientMessages = append(clientMessages, clientMessageInfo) + } + //Sort the messages + sort.Slice(clientMessages, func(i, j int) bool { + return clientMessages[i].Num > clientMessages[j].Num + }) + + action := showMessagesInfo(unreadMsgsInfo.Page, unreadMsgsInfo.NumPages, clientMessages) + switch action { + case -1: + return askQueueRec(cl, clientKeyStore, max(1, unreadMsgsInfo.Page-1), pageSize) + case 1: + return askQueueRec(cl, clientKeyStore, max(1, unreadMsgsInfo.Page+1), pageSize) + default: + return nil + } +} diff --git a/Projs/PD2/internal/client/datastore.go b/Projs/PD2/internal/client/datastore.go new file mode 100644 index 0000000..7036d9e --- /dev/null +++ b/Projs/PD2/internal/client/datastore.go @@ -0,0 +1,47 @@ +package client + +import ( + "encoding/json" + "time" +) + +type ClientMessage struct { + FromUID string + ToUID string + Subject string + Body string + Timestamp time.Time +} + +type ClientMessageInfo struct { + Num int + FromUID string + Timestamp time.Time + Subject string + decryptError error +} + +func newClientMessage(fromUID string, toUID string, subject string, body string, timestamp time.Time) ClientMessage { + return ClientMessage{FromUID: fromUID, ToUID: toUID, Subject: subject, Body: body, Timestamp: timestamp} +} + +func newClientMessageInfo(num int, fromUID string, subject string, timestamp time.Time, err error) ClientMessageInfo { + return ClientMessageInfo{Num: num, FromUID: fromUID, Subject: subject, Timestamp: timestamp, decryptError: err} +} + +func Marshal(data any) ([]byte, error) { + subject, err := json.Marshal(data) + if err != nil { + return nil, err + } + return subject, nil +} + +func Unmarshal(data []byte) (string, error) { + var c string + err := json.Unmarshal(data, &c) + if err != nil { + return "", err + } + return c, nil +} diff --git a/Projs/PD2/internal/client/interface.go b/Projs/PD2/internal/client/interface.go new file mode 100644 index 0000000..e891746 --- /dev/null +++ b/Projs/PD2/internal/client/interface.go @@ -0,0 +1,92 @@ +package client + +import ( + "bufio" + "fmt" + "os" + "strings" +) + +func readStdin(message string) string { + fmt.Println(message) + scanner := bufio.NewScanner(os.Stdin) + scanner.Scan() + return scanner.Text() +} + +func printError(err string) { + fmt.Fprintln(os.Stderr, err) +} + +func showHelp() { + fmt.Println("Comandos da aplicação cliente:") + fmt.Println("-user : Especifica o ficheiro com dados do utilizador. Por omissão, será assumido que esse ficheiro é userdata.p12.") + fmt.Println("send : Envia uma mensagem com assunto destinada ao utilizador com identificador . O conteúdo da mensagem será lido do stdin, e o tamanho deve ser limitado a 1000 bytes.") + fmt.Println("askqueue: Solicita ao servidor que lhe envie a lista de mensagens não lidas da queue do utilizador.") + fmt.Println("getmsg : Solicita ao servidor o envio da mensagem da sua queue com número .") + fmt.Println("help: Imprime instruções de uso do programa.") +} + +func showMessagesInfo(page int, numPages int, messages []ClientMessageInfo) int { + if messages == nil { + fmt.Println("No unread messages in the queue") + return 0 + } + for _, message := range messages { + if message.decryptError != nil { + fmt.Printf("ERROR: %v:%v:%v:", message.Num, message.FromUID, message.Timestamp) + fmt.Println(message.decryptError) + } else { + fmt.Printf("%v:%v:%v:%v\n", message.Num, message.FromUID, message.Timestamp, message.Subject) + } + } + fmt.Printf("Page %v/%v\n", page, numPages) + return messagesInfoPageNavigation(page, numPages) +} + +func messagesInfoPageNavigation(page int, numPages int) int { + var action string + + switch page { + case 1: + if page == numPages { + return 0 + } else { + action = readStdin("Actions: quit/next") + } + case numPages: + action = readStdin("Actions: prev/quit") + default: + action = readStdin("prev/quit/next") + } + + switch strings.ToLower(action) { + case "prev": + if page == 1 { + fmt.Println("Unavailable action: Already in first page") + messagesInfoPageNavigation(page, numPages) + } else { + return -1 + } + case "quit": + return 0 + case "next": + if page == numPages { + fmt.Println("Unavailable action: Already in last page") + messagesInfoPageNavigation(page, numPages) + } else { + return 1 + } + default: + fmt.Println("Unknown action") + messagesInfoPageNavigation(page, numPages) + } + return 0 +} + +func showMessage(message ClientMessage) { + fmt.Printf("From: %s\n", message.FromUID) + fmt.Printf("To: %s\n", message.ToUID) + fmt.Printf("Subject: %s\n", message.Subject) + fmt.Printf("Body: %s\n", message.Body) +} diff --git a/Projs/PD2/internal/gateway/gateway.go b/Projs/PD2/internal/gateway/gateway.go new file mode 100644 index 0000000..65093c8 --- /dev/null +++ b/Projs/PD2/internal/gateway/gateway.go @@ -0,0 +1,5 @@ +package gateway + +func Run(){ + +} diff --git a/Projs/PD2/internal/protocol/protocol.go b/Projs/PD2/internal/protocol/protocol.go new file mode 100644 index 0000000..5987c11 --- /dev/null +++ b/Projs/PD2/internal/protocol/protocol.go @@ -0,0 +1,119 @@ +package protocol + +import ( + "time" +) + +type Body interface{} + +type ( + GetUserCert struct { + UID string `json:"uid"` + } + + GetUnreadMsgsInfo struct { + Page int `json:"page"` + PageSize int `json:"pageSize"` + } + + GetMsg struct { + Num int `json:"num"` + } + + SendMsg struct { + ToUID string `json:"to_uid"` + Subject []byte `json:"subject"` + Body []byte `json:"body"` + } + + AnswerGetUserCert struct { + UID string `json:"uid"` + Certificate []byte `json:"certificate"` + } + + AnswerGetUnreadMsgsInfo struct { + Page int `json:"page"` + NumPages int `json:"num_pages"` + MessagesInfo []MsgInfo `json:"messages_info"` + } + + MsgInfo struct { + Num int `json:"num"` + FromUID string `json:"from_uid"` + Subject []byte `json:"subject"` + Timestamp time.Time `json:"timestamp"` + } + + AnswerGetMsg struct { + FromUID string `json:"from_uid"` + ToUID string `json:"to_uid"` + Subject []byte `json:"subject"` + Body []byte `json:"body"` + Timestamp time.Time `json:"timestamp"` + } + + ReportError struct { + ErrorMessage string `json:"error"` + } +) + +func NewGetUserCert(UID string) GetUserCert { + return GetUserCert{ + UID: UID, + } +} + +func NewGetUnreadMsgsInfo(page int, pageSize int) GetUnreadMsgsInfo { + return GetUnreadMsgsInfo{ + Page: page, + PageSize: pageSize} +} + +func NewGetMsg(num int) GetMsg { + return GetMsg{ + Num: num, + } +} + +func NewSendMsg(toUID string, subject []byte, body []byte) SendMsg { + return SendMsg{ + ToUID: toUID, + Subject: subject, + Body: body, + } +} + +func NewAnswerGetUserCert(uid string, certificate []byte) AnswerGetUserCert { + return AnswerGetUserCert{ + UID: uid, + Certificate: certificate, + } +} + +func NewAnswerGetUnreadMsgsInfo(page int, numPages int, messagesInfo []MsgInfo) AnswerGetUnreadMsgsInfo { + return AnswerGetUnreadMsgsInfo{Page: page, NumPages: numPages, MessagesInfo: messagesInfo} +} +func NewMsgInfo(num int, fromUID string, subject []byte, timestamp time.Time) MsgInfo { + return MsgInfo{ + Num: num, + FromUID: fromUID, + Subject: subject, + Timestamp: timestamp, + } +} + +func NewAnswerGetMsg(fromUID, toUID string, subject []byte, body []byte, timestamp time.Time, last bool) AnswerGetMsg { + return AnswerGetMsg{ + FromUID: fromUID, + ToUID: toUID, + Subject: subject, + Body: body, + Timestamp: timestamp, + } +} + +func NewReportError(errorMessage string) ReportError { + return ReportError{ + ErrorMessage: errorMessage, + } +} diff --git a/Projs/PD2/internal/server/datastore.go b/Projs/PD2/internal/server/datastore.go new file mode 100644 index 0000000..dc8a722 --- /dev/null +++ b/Projs/PD2/internal/server/datastore.go @@ -0,0 +1,245 @@ +package server + +import ( + "PD1/internal/protocol" + "crypto/x509" + "database/sql" + "errors" + "fmt" + "log" + "time" + + _ "github.com/mattn/go-sqlite3" +) + +type DataStore struct { + db *sql.DB +} + +func OpenDB() (DataStore, error) { + db, err := sql.Open("sqlite3", "server.db") + if err != nil { + return DataStore{}, err + } + ds := DataStore{db: db} + err = ds.CreateTables() + if err != nil { + return DataStore{}, err + } + return ds, nil +} + +func (ds DataStore) CreateTables() error { + // Create users table + _, err := ds.db.Exec(`CREATE TABLE IF NOT EXISTS users ( + UID TEXT PRIMARY KEY, + userCert BLOB + )`) + if err != nil { + return err + } + + // Create messages table + _, err = ds.db.Exec(`CREATE TABLE IF NOT EXISTS messages ( + fromUID TEXT, + toUID TEXT, + timestamp TIMESTAMP, + queue_position INT DEFAULT 0, + subject BLOB, + body BLOB, + status INT CHECK (status IN (0,1)), + PRIMARY KEY (toUID, fromUID, timestamp), + FOREIGN KEY(fromUID) REFERENCES users(UID), + FOREIGN KEY(toUID) REFERENCES users(UID) + )`) + if err != nil { + return err + } + + // Define a trigger to automatically assign numbers for each message of each user starting from 1 + _, err = ds.db.Exec(` + CREATE TRIGGER IF NOT EXISTS assign_queue_position + AFTER INSERT ON messages + FOR EACH ROW + BEGIN + UPDATE messages + SET queue_position = ( + SELECT COUNT(*) + FROM messages + WHERE toUID = NEW.toUID + ) + WHERE toUID = NEW.toUID AND rowid = NEW.rowid; + END; + `) + if err != nil { + return err + } + + return nil +} + +func (ds DataStore) GetMessage(toUID string, position int) (*protocol.AnswerGetMsg, error) { + + var serverMessage protocol.AnswerGetMsg + query := ` + SELECT fromUID, toUID, subject, body, timestamp + FROM messages + WHERE toUID = ? AND queue_position = ? + ` + // Execute the query + row := ds.db.QueryRow(query, toUID, position) + err := row.Scan(&serverMessage.FromUID, &serverMessage.ToUID, &serverMessage.Subject, &serverMessage.Body, &serverMessage.Timestamp) + if err == sql.ErrNoRows { + log.Printf("No message with NUM %v for UID %v\n", position, toUID) + errorMessage := fmt.Sprintln("MSG SERVICE: unknown message!") + error := errors.New(errorMessage) + return nil, error + } + + answer := protocol.NewAnswerGetMsg(serverMessage.FromUID, serverMessage.ToUID, serverMessage.Subject, serverMessage.Body, serverMessage.Timestamp, true) + return &answer, nil + +} + +func (ds DataStore) MarkMessageInQueueAsRead(toUID string, position int) { + query := ` + UPDATE messages + SET status = 1 + WHERE (fromUID,toUID,timestamp) = ( + SELECT fromUID,toUID,timestamp + FROM messages + WHERE toUID = ? AND queue_position = ? + ) + ` + + // Execute the SQL statement + _, err := ds.db.Exec(query, toUID, position) + if err != nil { + log.Printf("Error marking the message in position %v from UID %v as read: %v", position, toUID, err) + } +} + +func (ds DataStore) GetUnreadMsgsInfo(toUID string, page int, pageSize int) (protocol.AnswerGetUnreadMsgsInfo, error) { + + // Retrieve the total count of unread messages + var totalCount int + err := ds.db.QueryRow("SELECT COUNT(*) FROM messages WHERE toUID = ? AND status = 0", toUID).Scan(&totalCount) + if err == sql.ErrNoRows { + return protocol.NewAnswerGetUnreadMsgsInfo(0, 0, []protocol.MsgInfo{}), nil + } + + // Query to retrieve all messages from the user's queue + query := ` + SELECT + fromUID, + toUID, + timestamp, + queue_position, + subject, + status + FROM messages + WHERE + toUID = ? AND status = 0 + ORDER BY + queue_position DESC + LIMIT ? OFFSET ?; + ` + + // Execute the query + rows, err := ds.db.Query(query, toUID, pageSize, (page-1)*pageSize) + if err != nil { + log.Printf("Error getting unread messages for UID %v: %v", toUID, err) + } + defer rows.Close() + + messageInfoPackets := []protocol.MsgInfo{} + for rows.Next() { + var fromUID string + var subject []byte + var timestamp time.Time + var queuePosition, status int + if err := rows.Scan(&fromUID, &toUID, ×tamp, &queuePosition, &subject, &status); err != nil { + return protocol.AnswerGetUnreadMsgsInfo{}, err + } + answerGetUnreadMsgsInfo := protocol.NewMsgInfo(queuePosition, fromUID, subject, timestamp) + messageInfoPackets = append(messageInfoPackets, answerGetUnreadMsgsInfo) + } + if err := rows.Err(); err != nil { + log.Printf("Error when getting messages for UID %v: %v", toUID, err) + return protocol.AnswerGetUnreadMsgsInfo{}, err + } + numberOfPages := (totalCount + pageSize - 1) / pageSize + currentPage := min(numberOfPages, page) + return protocol.NewAnswerGetUnreadMsgsInfo(currentPage, numberOfPages, messageInfoPackets), nil +} + +func (ds DataStore) AddMessageToQueue(fromUID string, message protocol.SendMsg) error { + query := ` + INSERT INTO messages (fromUID, toUID, subject, body, timestamp, status) + VALUES (?, ?, ?, ?, ?, 0) + ` + + // Execute the SQL statement + currentTime := time.Now() + _, err := ds.db.Exec(query, fromUID, message.ToUID, message.Subject, message.Body, currentTime) + if err != nil { + log.Printf("Error adding message to UID %v: %v", fromUID, err) + return err + } + return nil +} + +func (ds DataStore) GetUserCertificate(uid string) (protocol.AnswerGetUserCert,error) { + query := ` + SELECT userCert + FROM users + WHERE UID = ? + ` + + // Execute the SQL query + var userCertBytes []byte + err := ds.db.QueryRow(query, uid).Scan(&userCertBytes) + if err == sql.ErrNoRows { + errorMessage := fmt.Sprintf("No certificate for UID %v found in the database", uid) + log.Println(errorMessage) + return protocol.AnswerGetUserCert{},errors.New(errorMessage) + } + return protocol.NewAnswerGetUserCert(uid, userCertBytes),nil +} + +func (ds DataStore) userExists(uid string) bool { + // Prepare the SQL statement for checking if a user exists + query := ` + SELECT COUNT(*) + FROM users + WHERE UID = ? + ` + + var count int + // Execute the SQL query + err := ds.db.QueryRow(query, uid).Scan(&count) + if err != nil || count == 0 { + log.Printf("user with UID %v does not exist\n", uid) + return false + } + return true +} + +func (ds DataStore) storeUserCertIfNotExists(uid string, cert x509.Certificate) error { + // Check if the user already exists + if ds.userExists(uid) { + return nil + } + + // Insert the user certificate + insertQuery := ` + INSERT INTO users (UID, userCert) + VALUES (?, ?) + ` + _, err := ds.db.Exec(insertQuery, uid, cert.Raw) + if err != nil { + return fmt.Errorf("error storing user certificate for UID %s: %v", uid, err) + } + log.Printf("User certificate for UID %s stored successfully.\n", uid) + return nil +} diff --git a/Projs/PD2/internal/server/interface.go b/Projs/PD2/internal/server/interface.go new file mode 100644 index 0000000..40e156f --- /dev/null +++ b/Projs/PD2/internal/server/interface.go @@ -0,0 +1,14 @@ +package server + +import ( + "bufio" + "fmt" + "os" +) + +func readStdin(message string) string { + fmt.Println(message) + scanner := bufio.NewScanner(os.Stdin) + scanner.Scan() + return scanner.Text() +} diff --git a/Projs/PD2/internal/server/server.go b/Projs/PD2/internal/server/server.go new file mode 100644 index 0000000..e4118cb --- /dev/null +++ b/Projs/PD2/internal/server/server.go @@ -0,0 +1,151 @@ +package server + +import ( + "PD1/internal/protocol" + "PD1/internal/utils/cryptoUtils" + "log" + "net/http" + "strconv" + + "github.com/gin-gonic/gin" +) + +//func clientHandler(connection networking.Connection[protocol.Packet], dataStore DataStore) { +// defer connection.Conn.Close() +// +// //Get certificate sent by user +// clientCert := connection.GetPeerCertificate() +// //Get the OID values +// oidMap := cryptoUtils.ExtractAllOIDValues(clientCert) +// //Check if certificate usage is MSG SERVICE +// usage := oidMap["2.5.4.11"] +// if usage == "" { +// log.Fatalln("User certificate does not have the correct usage") +// } +// //Get the UID of this user +// UID := oidMap["2.5.4.65"] +// if UID == "" { +// log.Fatalln("User certificate does not specify it's PSEUDONYM") +// } +// err := dataStore.storeUserCertIfNotExists(UID, *clientCert) +// if err != nil { +// log.Fatalln(err) +// } +//} + +func HandleGetUserCert(c *gin.Context, dataStore DataStore) { + user := c.Param("user") + userCertPacket, err := dataStore.GetUserCertificate(user) + if err != nil { + c.JSON(http.StatusNotFound, gin.H{"error": err.Error()}) + } else { + c.JSON(http.StatusOK, userCertPacket) + } +} + +func HandleGetUnreadMsgsInfo(c *gin.Context, dataStore DataStore) { + user := c.Param("user") + + var getUnreadMsgsInfo protocol.GetUnreadMsgsInfo + if err := c.BindJSON(getUnreadMsgsInfo); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + if getUnreadMsgsInfo.Page <= 0 || getUnreadMsgsInfo.PageSize <= 0 { + c.JSON(http.StatusBadRequest, gin.H{"error": "Page and PageSize need to be >= 1"}) + return + } + unreadMsgsInfo, err := dataStore.GetUnreadMsgsInfo(user, getUnreadMsgsInfo.Page, getUnreadMsgsInfo.PageSize) + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + c.JSON(http.StatusOK, unreadMsgsInfo) +} + +func HandleSendMessage(c *gin.Context, dataStore DataStore) { + sender := c.Param("user") + + var message protocol.SendMsg + if err := c.BindJSON(message); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + if message.ToUID == sender { + c.JSON(http.StatusBadRequest, gin.H{"error": "Message sender and receiver cannot be the same user"}) + return + } + if !dataStore.userExists(message.ToUID) { + c.JSON(http.StatusBadRequest, gin.H{"error": "Message receiver does not exist"}) + return + } + err := dataStore.AddMessageToQueue(sender, message) + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + c.JSON(http.StatusOK, nil) +} + +func HandleGetMessage(c *gin.Context, dataStore DataStore) { + user := c.Param("user") + numStr := c.Param("num") + num, err := strconv.Atoi(numStr) + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + } + + message, reportError := dataStore.GetMessage(user, num) + if reportError != nil { + c.JSON(http.StatusNotFound, gin.H{"error": err.Error()}) + } + dataStore.MarkMessageInQueueAsRead(user, num) + c.JSON(http.StatusOK, message) +} + +func Run() { + //Open connection to DB + dataStore, err := OpenDB() + if err != nil { + log.Fatalln(err) + } + defer dataStore.db.Close() + + //Read server keystore + keystorePassphrase := readStdin("Insert keystore passphrase") + serverKeyStore, err := cryptoUtils.LoadKeyStore("certs/server/server.p12", keystorePassphrase) + if err != nil { + log.Fatalln(err) + } + + r := gin.Default() + + r.GET("/message/:user/:num", func(c *gin.Context) { + HandleGetMessage(c, dataStore) + }) + + r.GET("/queue/:user", func(c *gin.Context) { + HandleGetUnreadMsgsInfo(c, dataStore) + }) + + r.GET("/cert/:user", func(c *gin.Context) { + HandleGetUserCert(c, dataStore) + }) + + r.POST("/message/:user", func(c *gin.Context) { + HandleSendMessage(c, dataStore) + }) + + server := http.Server{ + Addr: "0.0.0.0:8080", + Handler: r, + TLSConfig: serverKeyStore.GetTLSConfig(), + } + + err = server.ListenAndServeTLS("", "") + if err!=nil { + log.Fatal(err.Error()) + } +} diff --git a/Projs/PD2/internal/utils/cryptoUtils/cryptoUtils.go b/Projs/PD2/internal/utils/cryptoUtils/cryptoUtils.go new file mode 100644 index 0000000..6e4d4bb --- /dev/null +++ b/Projs/PD2/internal/utils/cryptoUtils/cryptoUtils.go @@ -0,0 +1,283 @@ +package cryptoUtils + +import ( + "crypto" + "crypto/rand" + "crypto/rsa" + "crypto/sha256" + "crypto/tls" + "crypto/x509" + "encoding/binary" + "errors" + "time" + + "log" + "os" + + "golang.org/x/crypto/chacha20poly1305" + "software.sslmate.com/src/go-pkcs12" +) + +type KeyStore struct { + cert *x509.Certificate + caCertChain []*x509.Certificate + privKey *rsa.PrivateKey +} + +func (k KeyStore) GetCert() *x509.Certificate { + return k.cert +} + +func (k KeyStore) GetCACertChain() []*x509.Certificate { + return k.caCertChain +} + +func (k KeyStore) GetPrivKey() *rsa.PrivateKey { + return k.privKey +} + +func ExtractAllOIDValues(cert *x509.Certificate) map[string]string { + oidValueMap := make(map[string]string) + for _, name := range cert.Subject.Names { + oid := name.Type.String() + value := name.Value.(string) + oidValueMap[oid] = value + } + return oidValueMap +} + +func LoadKeyStore(keyStorePath string, password string) (KeyStore, error) { + + var privKey *rsa.PrivateKey + + keystoreBytes, err := os.ReadFile(keyStorePath) + if err != nil { + return KeyStore{}, err + } + + privKeyInterface, cert, caCerts, err := pkcs12.DecodeChain(keystoreBytes, password) + if err != nil { + return KeyStore{}, err + } + privKey, ok := privKeyInterface.(*rsa.PrivateKey) + if !ok { + return KeyStore{}, err + } + + if err := privKey.Validate(); err != nil { + return KeyStore{}, err + } + return KeyStore{cert: cert, caCertChain: caCerts, privKey: privKey}, err +} + +// Check if the cert is signed by the CA and is for the correct user +func (k KeyStore) CheckCert(cert *x509.Certificate, uid string) error { + caCertPool := x509.NewCertPool() + for _, caCert := range k.caCertChain { + caCertPool.AddCert(caCert) + } + opts := x509.VerifyOptions{ + Roots: caCertPool, + } + // Check if the certificate is signed by the specified CA + _, err := cert.Verify(opts) + if err != nil { + log.Println("Certificate not signed by a trusted CA") + return err + } + + if cert.NotAfter.Before(time.Now()) { + return errors.New("certificate has expired") + } + if cert.NotBefore.After(time.Now()) { + return errors.New("certificate is not valid yet") + } + + //Check if the pseudonym field is set to UID + oidMap := ExtractAllOIDValues(cert) + if oidMap["2.5.4.65"] != uid { + log.Println("Certificate does not belong to the message's receiver") + return err + } + return nil +} + +func (k *KeyStore) GetTLSConfig() *tls.Config { + + certificate := tls.Certificate{Certificate: [][]byte{k.cert.Raw}, PrivateKey: k.privKey, Leaf: k.cert} + + //Add the CA certificate chain to a CertPool + caCertPool := x509.NewCertPool() + for _, caCert := range k.caCertChain { + caCertPool.AddCert(caCert) + } + config := &tls.Config{ + Certificates: []tls.Certificate{certificate}, + } + return config +} + +func (k *KeyStore) GetServerTLSConfig() *tls.Config { + tlsConfig := k.GetTLSConfig() + + //Add the CA certificate chain to a CertPool + caCertPool := x509.NewCertPool() + for _, caCert := range k.caCertChain { + caCertPool.AddCert(caCert) + } + tlsConfig.ClientCAs = caCertPool + tlsConfig.ClientAuth = tls.RequireAnyClientCert + tlsConfig.VerifyPeerCertificate = func(rawCerts [][]byte, _ [][]*x509.Certificate) error { + // Verify the peer's certificate + opts := x509.VerifyOptions{ + Roots: caCertPool, + } + for _, certBytes := range rawCerts { + cert, err := x509.ParseCertificate(certBytes) + if err != nil { + return err + } + + if cert.NotAfter.Before(time.Now()) { + return errors.New("certificate has expired") + } + if cert.NotBefore.After(time.Now()) { + return errors.New("certificate is not valid yet") + } + + // Check if the certificate is signed by the specified CA + _, err = cert.Verify(opts) + if err != nil { + return errors.New("certificate not signed by trusted CA") + } + } + return nil + } + return tlsConfig +} + +func (k *KeyStore) GetClientTLSConfig() *tls.Config { + tlsConfig := k.GetTLSConfig() + + //Add the CA certificate chain to a CertPool + caCertPool := x509.NewCertPool() + for _, caCert := range k.caCertChain { + caCertPool.AddCert(caCert) + } + tlsConfig.RootCAs = caCertPool + tlsConfig.InsecureSkipVerify = true + tlsConfig.VerifyPeerCertificate = func(rawCerts [][]byte, _ [][]*x509.Certificate) error { + // Verify the peer's certificate + opts := x509.VerifyOptions{ + Roots: caCertPool, + } + for _, certBytes := range rawCerts { + cert, err := x509.ParseCertificate(certBytes) + if err != nil { + return err + } + + if cert.NotAfter.Before(time.Now()) { + return errors.New("certificate has expired") + } + if cert.NotBefore.After(time.Now()) { + return errors.New("certificate is not valid yet") + } + oidMap := ExtractAllOIDValues(cert) + + // Check if the certificate is signed by the specified CA + _, err = cert.Verify(opts) + if err != nil { + return errors.New("certificate not signed by trusted CA") + } + + //Check if the pseudonym field is set to "SERVER" + if oidMap["2.5.4.65"] != "SERVER" { + return errors.New("peer isn't the server") + } + } + return nil + } + return tlsConfig +} + +func (k KeyStore) EncryptMessageContent(receiverCert *x509.Certificate, content []byte) ([]byte, error) { + // Digital envolope + + // Create a random symmetric key + dataKey := make([]byte, 32) + if _, err := rand.Read(dataKey); err != nil { + return nil, err + } + + cipher, err := chacha20poly1305.New(dataKey) + if err != nil { + return nil, err + } + + nonce := make([]byte, cipher.NonceSize(), cipher.NonceSize()+len(content)+cipher.Overhead()) + if _, err = rand.Read(nonce); err != nil { + return nil, err + } + + // sign the message and append the signature + hashedContent := sha256.Sum256(content) + signature, err := rsa.SignPKCS1v15(nil, k.privKey, crypto.SHA256, hashedContent[:]) + if err != nil { + return nil, err + } + content = pair(signature, content) + ciphertext := cipher.Seal(nonce, nonce, content, nil) + + receiverPubKey := receiverCert.PublicKey.(*rsa.PublicKey) + encryptedDataKey, err := rsa.EncryptOAEP(sha256.New(), rand.Reader, receiverPubKey, dataKey, nil) + if err != nil { + return nil, err + } + return pair(encryptedDataKey, ciphertext), nil +} + +func (k KeyStore) DecryptMessageContent(senderCert *x509.Certificate, cipherContent []byte) ([]byte, error) { + encryptedDataKey, encryptedMsg := unPair(cipherContent) + dataKey, err := rsa.DecryptOAEP(sha256.New(), rand.Reader, k.GetPrivKey(), encryptedDataKey, nil) + if err != nil { + return nil, err + } + // decrypt ciphertext + cipher, err := chacha20poly1305.New(dataKey) + if err != nil { + return nil, err + } + + nonce, ciphertext := encryptedMsg[:cipher.NonceSize()], encryptedMsg[cipher.NonceSize():] + contentAndSig, err := cipher.Open(nil, nonce, ciphertext, nil) + if err != nil { + return nil, err + } + // check signature with sender public key + signature, content := unPair(contentAndSig) + hashedContent := sha256.Sum256(content) + senderKey := senderCert.PublicKey.(*rsa.PublicKey) + if err := rsa.VerifyPKCS1v15(senderKey, crypto.SHA256, hashedContent[:], signature); err != nil { + return nil, err + } + return content, nil +} + +func pair(l []byte, r []byte) []byte { + length := len(l) + lenBytes := make([]byte, 2) + binary.BigEndian.PutUint16(lenBytes, uint16(length)) + + lWithLen := append(lenBytes, l...) + return append(lWithLen, r...) +} + +func unPair(pair []byte) ([]byte, []byte) { + lenBytes := pair[:2] + pair = pair[2:] + length := binary.BigEndian.Uint16(lenBytes) + l := pair[:length] + r := pair[length:] + return l, r +} diff --git a/Projs/PD2/internal/utils/networking/client.go b/Projs/PD2/internal/utils/networking/client.go new file mode 100644 index 0000000..cb49c4c --- /dev/null +++ b/Projs/PD2/internal/utils/networking/client.go @@ -0,0 +1,23 @@ +package networking + +import ( + "crypto/tls" +) + + +type ClientTLSConfigProvider interface { + GetClientTLSConfig() *tls.Config +} + +type Client[T any] struct { + Connection Connection[T] +} + +func NewClient[T any](clientTLSConfigProvider ClientTLSConfigProvider) (Client[T],error) { + dialConn, err := tls.Dial("tcp", "localhost:8080", clientTLSConfigProvider.GetClientTLSConfig()) + if err != nil { + return Client[T]{},err + } + conn := NewConnection[T](dialConn) + return Client[T]{Connection: conn},nil +} diff --git a/Projs/PD2/internal/utils/networking/connection.go b/Projs/PD2/internal/utils/networking/connection.go new file mode 100644 index 0000000..82efba6 --- /dev/null +++ b/Projs/PD2/internal/utils/networking/connection.go @@ -0,0 +1,51 @@ +package networking + +import ( + "crypto/tls" + "crypto/x509" + "encoding/json" + "io" + "log" +) + +type Connection[T any] struct { + Conn *tls.Conn + encoder *json.Encoder + decoder *json.Decoder +} + +func NewConnection[T any](netConn *tls.Conn) Connection[T] { + return Connection[T]{ + Conn: netConn, + encoder: json.NewEncoder(netConn), + decoder: json.NewDecoder(netConn), + } +} + +func (c Connection[T]) Send(obj T) error { + if err := c.encoder.Encode(&obj); err!=nil { + if err == io.EOF { + log.Println("Connection closed by peer") + } + return err + } + //Return true as connection active + return nil +} + +func (c Connection[T]) Receive() (*T, error) { + var obj T + if err := c.decoder.Decode(&obj); err != nil { + if err == io.EOF { + log.Println("Connection closed by peer") + } + return nil,err + } + //Return true as connection active + return &obj, nil +} + +func (c Connection[T]) GetPeerCertificate() *x509.Certificate { + state := c.Conn.ConnectionState() + return state.PeerCertificates[0] +} diff --git a/Projs/PD2/internal/utils/networking/server.go b/Projs/PD2/internal/utils/networking/server.go new file mode 100644 index 0000000..01a6da2 --- /dev/null +++ b/Projs/PD2/internal/utils/networking/server.go @@ -0,0 +1,56 @@ +package networking + +import ( + "crypto/tls" + "log" + "net" +) + +type ServerTLSConfigProvider interface { + GetServerTLSConfig() *tls.Config +} + +type Server[T any] struct { + listener net.Listener + C chan Connection[T] +} + +func NewServer[T any](serverTLSConfigProvider ServerTLSConfigProvider) (Server[T], error) { + + listener, err := tls.Listen("tcp", "127.0.0.1:8080", serverTLSConfigProvider.GetServerTLSConfig()) + if err != nil { + return Server[T]{}, err + } + return Server[T]{ + listener: listener, + C: make(chan Connection[T]), + }, nil +} + +func (s *Server[T]) ListenLoop() { + + for { + listenerConn, err := s.listener.Accept() + if err != nil { + log.Println("Server could not accept connection") + continue + } + tlsConn, ok := listenerConn.(*tls.Conn) + if !ok { + log.Println("Connection is not a TLS connection") + continue + } + if err := tlsConn.Handshake(); err != nil { + log.Println(err) + continue + } + + state := tlsConn.ConnectionState() + if len(state.PeerCertificates) == 0 { + log.Println("Client did not provide a certificate") + continue + } + conn := NewConnection[T](tlsConn) + s.C <- conn + } +} diff --git a/Projs/PD2/report_content/digital-envelope-diagram.drawio.png b/Projs/PD2/report_content/digital-envelope-diagram.drawio.png new file mode 100644 index 0000000..f54fe9f Binary files /dev/null and b/Projs/PD2/report_content/digital-envelope-diagram.drawio.png differ diff --git a/Projs/PD2/report_content/digital-envelope-diagram.jpg b/Projs/PD2/report_content/digital-envelope-diagram.jpg new file mode 100644 index 0000000..6847d50 Binary files /dev/null and b/Projs/PD2/report_content/digital-envelope-diagram.jpg differ diff --git a/Projs/PD2/server.db b/Projs/PD2/server.db new file mode 100644 index 0000000..c995c32 Binary files /dev/null and b/Projs/PD2/server.db differ diff --git a/Projs/PD2/tokefile.toml b/Projs/PD2/tokefile.toml new file mode 100644 index 0000000..9e98440 --- /dev/null +++ b/Projs/PD2/tokefile.toml @@ -0,0 +1,23 @@ +[targets.setup] +wildcards=[["golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest"]] +cmd="go install @@" + +[targets.check] +wildcards=[["go vet ./...","shadow ./..."]] +cmd="@@" + +[targets.build] +cmd="go build" + +[targets.server] +cmd="go run ./cmd/server/server.go" + +[targets.send] +cmd="go run ./cmd/client/client.go -user certs/client1/client1.p12 send CL2 testsubject" + +[targets.askQueue] +cmd="go run ./cmd/client/client.go -user certs/client2/client2.p12 askqueue" + +[targets.fakeAskQueue] +cmd="go run ./cmd/client/client.go -user certs/FakeClient1/client1.p12 askqueue" + diff --git a/TPs/TP02/py/cfich_aes_cbc.py b/TPs/TP02/py/cfich_aes_cbc.py old mode 100755 new mode 100644 diff --git a/TPs/TP02/py/cfich_chacha20.py b/TPs/TP02/py/cfich_chacha20.py old mode 100755 new mode 100644 diff --git a/TPs/TP02/py/chacha20_int_attck.py b/TPs/TP02/py/chacha20_int_attck.py old mode 100755 new mode 100644 diff --git a/TPs/TP02/py/input.txt.enc b/TPs/TP02/py/input.txt.enc deleted file mode 100644 index ce7432a..0000000 --- a/TPs/TP02/py/input.txt.enc +++ /dev/null @@ -1 +0,0 @@ -US9hM(#cboe@].J?K.k|Davz>Z:"] \ No newline at end of file diff --git a/TPs/TP03/pbenc_aes_ctr_hmac b/TPs/TP03/pbenc_aes_ctr_hmac old mode 100755 new mode 100644 diff --git a/TPs/TP03/py/plaintext.txt.enc b/TPs/TP03/py/plaintext.txt.enc deleted file mode 100644 index dfd60eb..0000000 Binary files a/TPs/TP03/py/plaintext.txt.enc and /dev/null differ