[PD2] Relatorio inicio
Co-authored-by: tsousa111 <tiagao2001@hotmail.com>
This commit is contained in:
parent
6f8219d991
commit
b86992a10a
10 changed files with 192 additions and 289 deletions
|
@ -101,15 +101,25 @@ func (k KeyStore) CheckCertTime(cert *x509.Certificate) error {
|
|||
func (k KeyStore) CheckCertPseudonym(cert *x509.Certificate, pseudonym string) error {
|
||||
oidMap := ExtractAllOIDValues(cert)
|
||||
if oidMap["2.5.4.65"] != pseudonym {
|
||||
return errors.New("Certificate does not belong to the correct pseudonym")
|
||||
return errors.New("certificate does not belong to the correct pseudonym")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check if the pseudonym field is set to the correct pseudonym
|
||||
func (k KeyStore) GetCertPseudonym(cert *x509.Certificate) (string,error){
|
||||
oidMap := ExtractAllOIDValues(cert)
|
||||
uid := oidMap["2.5.4.65"]
|
||||
if uid == "" {
|
||||
return "",errors.New("certificate does not have a pseudonym field")
|
||||
}
|
||||
return uid, nil
|
||||
}
|
||||
|
||||
func (k KeyStore) CheckCertUsage(cert *x509.Certificate, usage string) error {
|
||||
oidMap := ExtractAllOIDValues(cert)
|
||||
if oidMap["2.5.4.11"] != usage {
|
||||
return errors.New("Certificate does not have the correct usage")
|
||||
return errors.New("certificate does not have the correct usage")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue