[PD2] Made cert checks in cryptoutils
This commit is contained in:
parent
69559f41ca
commit
62962a13c7
9 changed files with 160 additions and 133 deletions
|
@ -1,7 +1,7 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"PD1/internal/protocol"
|
||||
"PD2/internal/protocol"
|
||||
"crypto/x509"
|
||||
"database/sql"
|
||||
"errors"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"PD1/internal/protocol"
|
||||
"PD1/internal/utils/cryptoUtils"
|
||||
"PD2/internal/protocol"
|
||||
"PD2/internal/utils/cryptoUtils"
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
@ -10,29 +10,6 @@ import (
|
|||
"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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue