| 1 | package certificatetransparencyscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/" |
| 5 | "crypto/sha1scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha1`/" //nolint:gosec |
| 6 | "crypto/sha256scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha256`/" |
| 7 | "encoding/base64scip-go gomod github.com/golang/go/src go1.25.0 `encoding/base64`/" |
| 8 | "encoding/hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/" |
| 9 | "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/" |
| 10 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 11 | "hashscip-go gomod github.com/golang/go/src go1.25.0 hash/" |
| 12 | "logscip-go gomod github.com/golang/go/src go1.25.0 log/" |
| 13 | "math/bigscip-go gomod github.com/golang/go/src go1.25.0 `math/big`/" |
| 14 | "slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/" |
| 15 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 16 | "timescip-go gomod github.com/golang/go/src go1.25.0 time/" |
| 17 | |
| 18 | "github.com/d-Rickyy-b/certstream-server-go/internal/modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/" |
| 19 | |
| 20 | ctscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/ "github.com/google/certificate-transparency-goscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/" |
| 21 | "github.com/google/certificate-transparency-go/x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/" |
| 22 | "github.com/google/certificate-transparency-go/x509/pkixscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/" |
| 23 | ) |
| 24 | |
| 25 | // parseData converts a *ct.RawLogEntry struct into a certstream.Data struct by copying some values and calculating others. |
| 26 | func parseDatascip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseData().(entry *ctscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/.RawLogEntryscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/RawLogEntry#, operatorName, logName, ctURL, logType string) (modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Datascip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#, error) { |
| 27 | var certLink string |
| 28 | // There is no direct link for tiled ct logs |
| 29 | if logType == modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.SourceIsRFC6962scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/SourceIsRFC6962. { |
| 30 | certLink = fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s/ct/v1/get-entries?start=%d&end=%d", ctURL, entry.Indexscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/RawLogEntry#Index., entry.Indexscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/RawLogEntry#Index.) |
| 31 | } |
| 32 | |
| 33 | // Create main data structure |
| 34 | data := modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Datascip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#{ |
| 35 | CertIndexscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#CertIndex.: uint64(entry.Indexscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/RawLogEntry#Index.), |
| 36 | CertLinkscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#CertLink.: certLink, |
| 37 | Seenscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#Seen.: float64(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().().UnixMilliscip-go gomod github.com/golang/go/src go1.25.0 time/Time#UnixMilli().()) / 1_000, |
| 38 | Sourcescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#Source.: modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Sourcescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Source#{ |
| 39 | Namescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Source#Name.: logName, |
| 40 | URLscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Source#URL.: ctURL, |
| 41 | Timestampscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Source#Timestamp.: float64(entry.Leafscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/RawLogEntry#Leaf..TimestampedEntryscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/MerkleTreeLeaf#TimestampedEntry..Timestampscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/TimestampedEntry#Timestamp.) / 1_000, |
| 42 | Operatorscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Source#Operator.: operatorName, |
| 43 | NormalizedURLscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Source#NormalizedURL.: normalizeCtlogURLscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/normalizeCtlogURL().(ctURL), |
| 44 | Typescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Source#Type.: logType, |
| 45 | }, |
| 46 | UpdateTypescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#UpdateType.: "X509LogEntry", |
| 47 | } |
| 48 | |
| 49 | // Convert RawLogEntry to ct.LogEntry |
| 50 | logEntry, conversionErr := entry.ToLogEntryscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/RawLogEntry#ToLogEntry().() |
| 51 | if conversionErr != nil { |
| 52 | logscip-go gomod github.com/golang/go/src go1.25.0 log/.Printlnscip-go gomod github.com/golang/go/src go1.25.0 log/Println().("Could not convert entry to LogEntry: ", conversionErr) |
| 53 | return modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Datascip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#{}, conversionErr |
| 54 | } |
| 55 | |
| 56 | var cert *x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.Certificatescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate# |
| 57 | var rawData []byte |
| 58 | var isPrecert bool |
| 59 | |
| 60 | switch { |
| 61 | case logEntry.X509Certscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/LogEntry#X509Cert. != nil: |
| 62 | cert = logEntry.X509Certscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/LogEntry#X509Cert. |
| 63 | rawData = logEntry.X509Certscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/LogEntry#X509Cert..Rawscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#Raw. |
| 64 | isPrecert = false |
| 65 | case logEntry.Precertscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/LogEntry#Precert. != nil: |
| 66 | cert = logEntry.Precertscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/LogEntry#Precert..TBSCertificatescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/Precertificate#TBSCertificate. |
| 67 | rawData = logEntry.Precertscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/LogEntry#Precert..Submittedscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/Precertificate#Submitted..Datascip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/ASN1Cert#Data. |
| 68 | isPrecert = true |
| 69 | default: |
| 70 | return modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Datascip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#{}, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("could not parse entry: no certificate found") |
| 71 | } |
| 72 | |
| 73 | // Calculate certificate hash from the raw DER bytes of the certificate |
| 74 | data.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#LeafCert. = leafCertFromX509certscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/leafCertFromX509cert().(*cert) |
| 75 | |
| 76 | // recalculate hashes if the certificate is a precertificate |
| 77 | if isPrecert { |
| 78 | calculatedHash := calculateSHA1scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/calculateSHA1().(rawData) |
| 79 | data.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#LeafCert..Fingerprintscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Fingerprint. = calculatedHash |
| 80 | data.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#LeafCert..SHA1scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#SHA1. = calculatedHash |
| 81 | data.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#LeafCert..SHA256scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#SHA256. = calculateSHA256scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/calculateSHA256().(rawData) |
| 82 | |
| 83 | // Since we use the TBSCertificate to parse the LeafCert, the PoisonByte indicator cannot be set by our parser. |
| 84 | // According to RFC 6962 Section 3.2 the `"tbs_certificate" is the DER-encoded TBSCertificate (see [RFC5280]) |
| 85 | // component of the Precertificate -- that is, without the signature and the poison extension.` |
| 86 | // Since the PoisonByte Extension `is to ensure that the Precertificate cannot be validated by a standard |
| 87 | // X.509v3 client`, we can safely set it for each precertificate. |
| 88 | data.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#LeafCert..Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions..CTLPoisonBytescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#CTLPoisonByte. = true |
| 89 | } |
| 90 | |
| 91 | certAsDER := base64scip-go gomod github.com/golang/go/src go1.25.0 `encoding/base64`/.StdEncodingscip-go gomod github.com/golang/go/src go1.25.0 `encoding/base64`/StdEncoding..EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/base64`/Encoding#EncodeToString().(entry.Certscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/RawLogEntry#Cert..Datascip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/ASN1Cert#Data.) |
| 92 | data.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#LeafCert..AsDERscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#AsDER. = certAsDER |
| 93 | |
| 94 | var parseErr error |
| 95 | data.Chainscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#Chain., parseErr = parseCertificateChainscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseCertificateChain().(logEntry) |
| 96 | if parseErr != nil { |
| 97 | logscip-go gomod github.com/golang/go/src go1.25.0 log/.Printlnscip-go gomod github.com/golang/go/src go1.25.0 log/Println().("Could not parse certificate chain: ", parseErr) |
| 98 | return modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Datascip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Data#{}, parseErr |
| 99 | } |
| 100 | |
| 101 | return data, nil |
| 102 | } |
| 103 | |
| 104 | // parseCertificateChain returns the certificate chain in form of a []LeafCert from the given *ct.LogEntry. |
| 105 | func parseCertificateChainscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseCertificateChain().(logEntry *ctscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/.LogEntryscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/LogEntry#) ([]modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#, error) { |
| 106 | chain := make([]modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#, len(logEntry.Chainscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/LogEntry#Chain.)) |
| 107 | |
| 108 | for i, chainEntry := range logEntry.Chainscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/LogEntry#Chain. { |
| 109 | myCert, parseErr := x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.ParseCertificatescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/ParseCertificate().(chainEntry.Datascip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/ASN1Cert#Data.) |
| 110 | if parseErr != nil || myCert == nil { |
| 111 | logscip-go gomod github.com/golang/go/src go1.25.0 log/.Printlnscip-go gomod github.com/golang/go/src go1.25.0 log/Println().("Error parsing certificate: ", parseErr) |
| 112 | return nil, parseErr |
| 113 | } |
| 114 | |
| 115 | leafCert := leafCertFromX509certscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/leafCertFromX509cert().(*myCert) |
| 116 | chain[i] = leafCert |
| 117 | } |
| 118 | |
| 119 | return chain, nil |
| 120 | } |
| 121 | |
| 122 | // leafCertFromX509cert converts a x509.Certificate to the custom LeafCert data structure. |
| 123 | func leafCertFromX509certscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/leafCertFromX509cert().(cert x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.Certificatescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#) modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert# { |
| 124 | leafCert := modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.LeafCertscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#{ |
| 125 | AllDomainsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#AllDomains.: cert.DNSNamesscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#DNSNames., |
| 126 | Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions.: modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#{}, |
| 127 | NotAfterscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#NotAfter.: cert.NotAfterscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#NotAfter..Unixscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Unix().(), |
| 128 | NotBeforescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#NotBefore.: cert.NotBeforescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#NotBefore..Unixscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Unix().(), |
| 129 | SerialNumberscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#SerialNumber.: formatSerialNumberscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/formatSerialNumber().(cert.SerialNumberscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#SerialNumber.), |
| 130 | SignatureAlgorithmscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#SignatureAlgorithm.: parseSignatureAlgorithmscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseSignatureAlgorithm().(cert.SignatureAlgorithmscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#SignatureAlgorithm.), |
| 131 | IsCAscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#IsCA.: cert.IsCAscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#IsCA., |
| 132 | } |
| 133 | |
| 134 | // The zero value of DomainsEntry.Data is nil, but we want an empty array - especially for JSON marshaling later. |
| 135 | if leafCert.AllDomainsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#AllDomains. == nil { |
| 136 | leafCert.AllDomainsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#AllDomains. = []string{} |
| 137 | } |
| 138 | |
| 139 | leafCert.Subjectscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Subject. = buildSubjectscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/buildSubject().(cert.Subjectscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#Subject.) |
| 140 | if *leafCert.Subjectscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Subject..CNscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#CN. != "" && !leafCert.IsCAscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#IsCA. { |
| 141 | domainAlreadyAdded := slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/.Containsscip-go gomod github.com/golang/go/src go1.25.0 slices/Contains().(leafCert.AllDomainsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#AllDomains., *leafCert.Subjectscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Subject..CNscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#CN.) |
| 142 | |
| 143 | if !domainAlreadyAdded { |
| 144 | leafCert.AllDomainsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#AllDomains. = append(leafCert.AllDomainsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#AllDomains., *leafCert.Subjectscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Subject..CNscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#CN.) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | leafCert.Issuerscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Issuer. = buildSubjectscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/buildSubject().(cert.Issuerscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#Issuer.) |
| 149 | |
| 150 | leafCert.AsDERscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#AsDER. = base64scip-go gomod github.com/golang/go/src go1.25.0 `encoding/base64`/.StdEncodingscip-go gomod github.com/golang/go/src go1.25.0 `encoding/base64`/StdEncoding..EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/base64`/Encoding#EncodeToString().(cert.Rawscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#Raw.) |
| 151 | leafCert.Fingerprintscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Fingerprint. = calculateSHA1scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/calculateSHA1().(cert.Rawscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#Raw.) |
| 152 | leafCert.SHA1scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#SHA1. = leafCert.Fingerprintscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Fingerprint. |
| 153 | leafCert.SHA256scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#SHA256. = calculateSHA256scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/calculateSHA256().(cert.Rawscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#Raw.) |
| 154 | |
| 155 | // TODO fix Extensions - check x509util.go |
| 156 | for _, extension := range cert.Extensionsscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#Extensions. { |
| 157 | switch { |
| 158 | case extension.Idscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Extension#Id..Equalscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/asn1`/ObjectIdentifier#Equal().(x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.OIDExtensionAuthorityKeyIdscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/OIDExtensionAuthorityKeyId.): |
| 159 | leafCert.Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions..AuthorityKeyIdentifierscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#AuthorityKeyIdentifier. = formatKeyIDscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/formatKeyID().(cert.AuthorityKeyIdscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#AuthorityKeyId.) |
| 160 | case extension.Idscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Extension#Id..Equalscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/asn1`/ObjectIdentifier#Equal().(x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.OIDExtensionKeyUsagescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/OIDExtensionKeyUsage.): |
| 161 | keyUsage := keyUsageToStringscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/keyUsageToString().(cert.KeyUsagescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#KeyUsage.) |
| 162 | leafCert.Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions..KeyUsagescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#KeyUsage. = &keyUsage |
| 163 | case extension.Idscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Extension#Id..Equalscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/asn1`/ObjectIdentifier#Equal().(x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.OIDExtensionSubjectKeyIdscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/OIDExtensionSubjectKeyId.): |
| 164 | leafCert.Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions..SubjectKeyIdentifierscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#SubjectKeyIdentifier. = formatKeyIDscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/formatKeyID().(cert.SubjectKeyIdscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#SubjectKeyId.) |
| 165 | case extension.Idscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Extension#Id..Equalscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/asn1`/ObjectIdentifier#Equal().(x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.OIDExtensionBasicConstraintsscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/OIDExtensionBasicConstraints.): |
| 166 | isCA := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.ToUpperscip-go gomod github.com/golang/go/src go1.25.0 strings/ToUpper().(fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("CA:%t", cert.IsCAscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#IsCA.)) |
| 167 | leafCert.Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions..BasicConstraintsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#BasicConstraints. = &isCA |
| 168 | case extension.Idscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Extension#Id..Equalscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/asn1`/ObjectIdentifier#Equal().(x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.OIDExtensionSubjectAltNamescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/OIDExtensionSubjectAltName.): |
| 169 | var buf bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 170 | for _, name := range cert.DNSNamesscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#DNSNames. { |
| 171 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "DNS:"+name) |
| 172 | } |
| 173 | |
| 174 | for _, email := range cert.EmailAddressesscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#EmailAddresses. { |
| 175 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "email:"+email) |
| 176 | } |
| 177 | |
| 178 | for _, ip := range cert.IPAddressesscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#IPAddresses. { |
| 179 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "IP Address:"+ip.Stringscip-go gomod github.com/golang/go/src go1.25.0 net/IP#String().()) |
| 180 | } |
| 181 | |
| 182 | subjectAltName := buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().() |
| 183 | leafCert.Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions..SubjectAltNamescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#SubjectAltName. = &subjectAltName |
| 184 | case extension.Idscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Extension#Id..Equalscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/asn1`/ObjectIdentifier#Equal().(x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.OIDExtensionAuthorityInfoAccessscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/OIDExtensionAuthorityInfoAccess.): |
| 185 | var buf bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 186 | for _, issuer := range cert.IssuingCertificateURLscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#IssuingCertificateURL. { |
| 187 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "URI:"+issuer) |
| 188 | } |
| 189 | |
| 190 | for _, ocsp := range cert.OCSPServerscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#OCSPServer. { |
| 191 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "URI:"+ocsp) |
| 192 | } |
| 193 | |
| 194 | result := buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().() |
| 195 | leafCert.Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions..AuthorityInfoAccessscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#AuthorityInfoAccess. = &result |
| 196 | case extension.Idscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Extension#Id..Equalscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/asn1`/ObjectIdentifier#Equal().(x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.OIDExtensionCTPoisonscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/OIDExtensionCTPoison.): |
| 197 | leafCert.Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions..CTLPoisonBytescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#CTLPoisonByte. = true |
| 198 | case extension.Idscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Extension#Id..Equalscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/asn1`/ObjectIdentifier#Equal().(x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.OIDExtensionCertificatePoliciesscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/OIDExtensionCertificatePolicies.): |
| 199 | var result string |
| 200 | for _, policy := range cert.PolicyIdentifiersscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/Certificate#PolicyIdentifiers. { |
| 201 | // The current way of joining the string leaves us with a trailing newline, |
| 202 | // but that's how the original certstream server does it too. |
| 203 | result += fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("Policy: %s\n", policy) |
| 204 | } |
| 205 | leafCert.Extensionsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/LeafCert#Extensions..CertificatePoliciesscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Extensions#CertificatePolicies. = &result |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | return leafCert |
| 210 | } |
| 211 | |
| 212 | // buildSubject generates a Subject struct from the given pkix.Name. |
| 213 | func buildSubjectscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/buildSubject().(certSubject pkixscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/.Namescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Name#) modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Subjectscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject# { |
| 214 | subject := modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Subjectscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#{ |
| 215 | Cscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#C.: parseNamescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseName().(certSubject.Countryscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Name#Country.), |
| 216 | CNscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#CN.: &certSubject.CommonNamescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Name#CommonName., |
| 217 | Lscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#L.: parseNamescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseName().(certSubject.Localityscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Name#Locality.), |
| 218 | Oscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#O.: parseNamescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseName().(certSubject.Organizationscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Name#Organization.), |
| 219 | OUscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#OU.: parseNamescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseName().(certSubject.OrganizationalUnitscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Name#OrganizationalUnit.), |
| 220 | STscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#ST.: parseNamescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseName().(certSubject.StreetAddressscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509/pkix`/Name#StreetAddress.), |
| 221 | } |
| 222 | |
| 223 | var aggregated string |
| 224 | |
| 225 | if subject.Cscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#C. != nil { |
| 226 | aggregated += fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("/C=%s", *subject.Cscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#C.) |
| 227 | } |
| 228 | |
| 229 | if subject.CNscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#CN. != nil { |
| 230 | aggregated += fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("/CN=%s", *subject.CNscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#CN.) |
| 231 | } |
| 232 | |
| 233 | if subject.Lscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#L. != nil { |
| 234 | aggregated += fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("/L=%s", *subject.Lscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#L.) |
| 235 | } |
| 236 | |
| 237 | if subject.Oscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#O. != nil { |
| 238 | aggregated += fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("/O=%s", *subject.Oscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#O.) |
| 239 | } |
| 240 | |
| 241 | if subject.OUscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#OU. != nil { |
| 242 | aggregated += fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("/OU=%s", *subject.OUscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#OU.) |
| 243 | } |
| 244 | |
| 245 | if subject.STscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#ST. != nil { |
| 246 | aggregated += fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("/ST=%s", *subject.STscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#ST.) |
| 247 | } |
| 248 | |
| 249 | subject.Aggregatedscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Subject#Aggregated. = &aggregated |
| 250 | |
| 251 | return subject |
| 252 | } |
| 253 | |
| 254 | // formatKeyID transforms the AuthorityKeyIdentifier to be more readable. |
| 255 | func formatKeyIDscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/formatKeyID().(keyID []byte) *string { |
| 256 | tmp := hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(keyID) |
| 257 | var digest string |
| 258 | |
| 259 | for i := 0; i < len(tmp); i += 2 { |
| 260 | digest = digest + ":" + tmp[i:i+2] |
| 261 | } |
| 262 | |
| 263 | digest = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimLeftscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimLeft().(digest, ":") |
| 264 | digest = fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("keyid:%s", digest) |
| 265 | |
| 266 | return &digest |
| 267 | } |
| 268 | |
| 269 | func formatSerialNumberscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/formatSerialNumber().(serialNumber *bigscip-go gomod github.com/golang/go/src go1.25.0 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.25.0 `math/big`/Int#) string { |
| 270 | sn := fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%X", serialNumber) |
| 271 | if len(sn)%2 == 1 { |
| 272 | sn = "0" + sn |
| 273 | } |
| 274 | |
| 275 | return sn |
| 276 | } |
| 277 | |
| 278 | func parseNamescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseName().(input []string) *string { |
| 279 | if input == nil { |
| 280 | return nil |
| 281 | } |
| 282 | |
| 283 | var result string |
| 284 | for _, s := range input { |
| 285 | if len(result) > 0 { |
| 286 | result += "," |
| 287 | } |
| 288 | |
| 289 | result += s |
| 290 | } |
| 291 | |
| 292 | return &result |
| 293 | } |
| 294 | |
| 295 | // calculateHash takes a hash.Hash implementation and calculates the hash of the given data. |
| 296 | // It returns the hash in the format "XX:XX:XX:...". |
| 297 | func calculateHashscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/calculateHash().(data []byte, certHasher hashscip-go gomod github.com/golang/go/src go1.25.0 hash/.Hashscip-go gomod github.com/golang/go/src go1.25.0 hash/Hash#) string { |
| 298 | _, e := certHasher.Writescip-go gomod github.com/golang/go/src go1.25.0 io/Writer#Write().(data) |
| 299 | if e != nil { |
| 300 | logscip-go gomod github.com/golang/go/src go1.25.0 log/.Printfscip-go gomod github.com/golang/go/src go1.25.0 log/Printf().("Error while hashing cert: %s\n", e) |
| 301 | return "" |
| 302 | } |
| 303 | |
| 304 | certHash := fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%02x", certHasher.Sumscip-go gomod github.com/golang/go/src go1.25.0 hash/Hash#Sum().(nil)) |
| 305 | certHash = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.ToUpperscip-go gomod github.com/golang/go/src go1.25.0 strings/ToUpper().(certHash) |
| 306 | |
| 307 | var result bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 308 | for i := 0; i < len(certHash); i++ { |
| 309 | if i%2 == 0 && i > 0 { |
| 310 | result.WriteBytescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#WriteByte().(':') |
| 311 | } |
| 312 | c := certHash[i] |
| 313 | result.WriteBytescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#WriteByte().(c) |
| 314 | } |
| 315 | |
| 316 | return result.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().() |
| 317 | } |
| 318 | |
| 319 | // calculateSHA1 calculates the SHA1 fingerprint of the given data. |
| 320 | func calculateSHA1scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/calculateSHA1().(data []byte) string { |
| 321 | return calculateHashscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/calculateHash().(data, sha1scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha1`/.Newscip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha1`/New().()) //nolint:gosec |
| 322 | } |
| 323 | |
| 324 | // calculateSHA256 calculates the SHA256 fingerprint of the given data. |
| 325 | func calculateSHA256scip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/calculateSHA256().(data []byte) string { |
| 326 | return calculateHashscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/calculateHash().(data, sha256scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha256`/.Newscip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha256`/New().()) |
| 327 | } |
| 328 | |
| 329 | func parseSignatureAlgorithmscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseSignatureAlgorithm().(signatureAlgoritm x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.SignatureAlgorithmscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/SignatureAlgorithm#) string { |
| 330 | switch signatureAlgoritm { |
| 331 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.MD2WithRSAscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/MD2WithRSA.: |
| 332 | return "md2, rsa" |
| 333 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.MD5WithRSAscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/MD5WithRSA.: |
| 334 | return "md5, rsa" |
| 335 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.SHA1WithRSAscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/SHA1WithRSA.: |
| 336 | return "sha1, rsa" |
| 337 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.SHA256WithRSAscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/SHA256WithRSA.: |
| 338 | return "sha256, rsa" |
| 339 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.SHA384WithRSAscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/SHA384WithRSA.: |
| 340 | return "sha384, rsa" |
| 341 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.SHA512WithRSAscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/SHA512WithRSA.: |
| 342 | return "sha512, rsa" |
| 343 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.SHA256WithRSAPSSscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/SHA256WithRSAPSS.: |
| 344 | return "sha256, rsa-pss" |
| 345 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.SHA384WithRSAPSSscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/SHA384WithRSAPSS.: |
| 346 | return "sha384, rsa-pss" |
| 347 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.SHA512WithRSAPSSscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/SHA512WithRSAPSS.: |
| 348 | return "sha512, rsa-pss" |
| 349 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.DSAWithSHA1scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/DSAWithSHA1.: |
| 350 | return "dsa, sha1" |
| 351 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.DSAWithSHA256scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/DSAWithSHA256.: |
| 352 | return "dsa, sha256" |
| 353 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.ECDSAWithSHA1scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/ECDSAWithSHA1.: |
| 354 | return "ecdsa, sha1" |
| 355 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.ECDSAWithSHA256scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/ECDSAWithSHA256.: |
| 356 | return "ecdsa, sha256" |
| 357 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.ECDSAWithSHA384scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/ECDSAWithSHA384.: |
| 358 | return "ecdsa, sha384" |
| 359 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.ECDSAWithSHA512scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/ECDSAWithSHA512.: |
| 360 | return "ecdsa, sha512" |
| 361 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.PureEd25519scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/PureEd25519.: |
| 362 | return "ed25519" |
| 363 | case x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.UnknownSignatureAlgorithmscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/UnknownSignatureAlgorithm.: |
| 364 | fallthrough |
| 365 | default: |
| 366 | return "unknown" |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | // commaAppend lets you append a string with a comma prepended to a buffer. |
| 371 | func commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(buf *bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#, s string) { |
| 372 | if buf.Lenscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Len().() > 0 { |
| 373 | buf.WriteStringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#WriteString().(", ") |
| 374 | } |
| 375 | |
| 376 | buf.WriteStringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#WriteString().(s) |
| 377 | } |
| 378 | |
| 379 | func keyUsageToStringscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/keyUsageToString().(k x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsagescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsage#) string { |
| 380 | var buf bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 381 | if k&x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsageDigitalSignaturescip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsageDigitalSignature. != 0 { |
| 382 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "Digital Signature") |
| 383 | } |
| 384 | |
| 385 | if k&x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsageContentCommitmentscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsageContentCommitment. != 0 { |
| 386 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "Content Commitment") |
| 387 | } |
| 388 | |
| 389 | if k&x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsageKeyEnciphermentscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsageKeyEncipherment. != 0 { |
| 390 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "Key Encipherment") |
| 391 | } |
| 392 | |
| 393 | if k&x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsageDataEnciphermentscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsageDataEncipherment. != 0 { |
| 394 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "Data Encipherment") |
| 395 | } |
| 396 | |
| 397 | if k&x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsageKeyAgreementscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsageKeyAgreement. != 0 { |
| 398 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "Key Agreement") |
| 399 | } |
| 400 | |
| 401 | if k&x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsageCertSignscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsageCertSign. != 0 { |
| 402 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "Certificate Signing") |
| 403 | } |
| 404 | |
| 405 | if k&x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsageCRLSignscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsageCRLSign. != 0 { |
| 406 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "CRL Signing") |
| 407 | } |
| 408 | |
| 409 | if k&x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsageEncipherOnlyscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsageEncipherOnly. != 0 { |
| 410 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "Encipher Only") |
| 411 | } |
| 412 | |
| 413 | if k&x509scip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/.KeyUsageDecipherOnlyscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go/x509`/KeyUsageDecipherOnly. != 0 { |
| 414 | commaAppendscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/commaAppend().(&buf, "Decipher Only") |
| 415 | } |
| 416 | |
| 417 | return buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().() |
| 418 | } |
| 419 | |
| 420 | // ParseCertstreamEntry creates an Entry from a ct.RawLogEntry. |
| 421 | func ParseCertstreamEntryscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/ParseCertstreamEntry().(rawEntry *ctscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/.RawLogEntryscip-go gomod github.com/google/certificate-transparency-go v1.3.3 `github.com/google/certificate-transparency-go`/RawLogEntry#, operatorName, logname, ctURL, logType string) (modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Entryscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Entry#, error) { |
| 422 | if rawEntry == nil { |
| 423 | return modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Entryscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Entry#{}, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("certstream entry is nil") |
| 424 | } |
| 425 | |
| 426 | data, err := parseDatascip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/certificatetransparency`/parseData().(rawEntry, operatorName, logname, ctURL, logType) |
| 427 | if err != nil { |
| 428 | return modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Entryscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Entry#{}, err |
| 429 | } |
| 430 | |
| 431 | entry := modelsscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/.Entryscip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Entry#{ |
| 432 | Datascip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Entry#Data.: data, |
| 433 | MessageTypescip-go gomod github.com/d-Rickyy-b/certstream-server-go . `github.com/d-Rickyy-b/certstream-server-go/internal/models`/Entry#MessageType.: "certificate_update", |
| 434 | } |
| 435 | |
| 436 | return entry, nil |
| 437 | } |