feature: Adds signing validation support to the client.

This commit is contained in:
imterah 2024-10-25 11:59:16 -04:00
parent 86ad3e174f
commit 00a57443d4
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
6 changed files with 242 additions and 80 deletions

View file

@ -1,6 +1,7 @@
package server
import (
"fmt"
"net"
core "git.greysoh.dev/imterah/bismuthd/commons"
@ -191,6 +192,7 @@ func (bismuth BismuthServer) HandleProxy(conn net.Conn) error {
totalPacketContents[0] = core.GetTrustedDomains
for index, trustedDomain := range bismuth.TrustedDomains {
fmt.Println("building trusted domains")
totalPacketContents = append(totalPacketContents, []byte(trustedDomain)...)
if index+1 != len(bismuth.TrustedDomains) {

View file

@ -40,7 +40,7 @@ func (bismuth BismuthServer) decryptMessage(aead cipher.AEAD, encMsg []byte) ([]
// Initializes a Bismuth server.
//
// Both `pubKey` and `privKey` are armored PGP public and private keys respectively.
func NewBismuthServer(pubKey string, privKey string, signServers []string, encryptionAlgo int) (*BismuthServer, error) {
func New(pubKey string, privKey string, signServers []string, trustedDomains []string, encryptionAlgo int) (*BismuthServer, error) {
publicKey, err := crypto.NewKeyFromArmored(pubKey)
if err != nil {
@ -59,6 +59,7 @@ func NewBismuthServer(pubKey string, privKey string, signServers []string, encry
PublicKey: publicKey,
PrivateKey: privateKey,
SigningServers: signServers,
TrustedDomains: trustedDomains,
SymmetricEncryptionAlgorithm: encryptionAlgo,
pgp: pgp,
}