Documentation ¶
Index ¶
- Variables
- func CreateTmpFile(content []byte, name string, dir string) (string, error)
- func ErrorMessageJSON(err error, code string) string
- func ErrorResponse(resp *restful.Response, err error, status int, code string)
- func FromBase64DerToExtension(base64Cert, format string) ([]byte, error)
- func GetCertifiedName(exts *PHExtensions, public tpm2.Public) (name *tpm2.Name, qname *tpm2.Name, err error)
- func GetEnv(key, defaultValue string) string
- func GetMongoClient() (*mongo.Client, error)
- func GetMongoClientTest() (*mongo.Client, error)
- func GetMongoSession() (*mgo.Session, error)
- func GetTrustedRoots() (*x509.CertPool, error)
- func GetTrustedRootsFromBundle() (*x509.CertPool, error)
- func IDGetPrn(id bson.ObjectId, serviceName string) string
- func ParseHeaderPhClientCertificate(header string) (*x509.Certificate, error)
- func ParsePEMBase64EncodeCert(encodeCert string) (*x509.Certificate, error)
- func ParsePEMCertString(pemCert []byte) (*x509.Certificate, error)
- func ParsePEMHexEncodeCert(encodeCert string) (*x509.Certificate, error)
- func ParsePrivateKey(der []byte) (crypto.PrivateKey, error)
- func ParsePublicKey(der []byte) (crypto.PublicKey, error)
- func PrnGetID(prn string) string
- func RemoveIndex(a []interface{}, i int) []interface{}
- func SetupEnvDefaults()
- func Tpm2NameToString(name tpm2.Name) string
- func Tpm2PublicName(pub tpm2.Public) (string, error)
- func ValidateAcaSigned(cert *x509.Certificate) error
- func ValidateAttestationSignature(attestation, signature []byte, akPub *rsa.PublicKey) error
- func ValidateCASigned(cert *x509.Certificate) error
- func ValidateCertificateSelfSigned(cert *x509.Certificate) error
- func ValidateTPMPublicKey(pubKey *rsa.PublicKey, pubPart tpm2.Public) error
- type Crypter
- type PHExtensions
- type Prn
- type PrnInfo
- type PrnParseError
Constants ¶
This section is empty.
Variables ¶
var Env models.EnvDefaults
Env : Env variable to hold Env default Variable values
var MongoDb string
MongoDb : Holds Mongo Db Name
var PhCertExtensionIDs = &models.PhCertExtensions{ AIKName: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 0}, OwnerPrnOID: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 1}, OwnernameSig: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 2}, TokenID: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 3}, CertifyAttest: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 4}, CertifySig: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 5}, QuoteAttest: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 6}, QuoteSig: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 7}, QuotePcrList: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 8}, DevicePRN: asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 54621, 100, 9}, }
PhCertExtensionIDs all the indentifiers for pantahub extensions on a certificate values
Functions ¶
func CreateTmpFile ¶
CreateTmpFile create a temporal file with a content, return and string with the path
func ErrorMessageJSON ¶
ErrorMessageJSON return a rest error with the message
func ErrorResponse ¶
ErrorResponse get the server response and generate a proper json response
func FromBase64DerToExtension ¶
FromBase64DerToExtension get a certificate with base64 encode and formated
func GetCertifiedName ¶
func GetCertifiedName(exts *PHExtensions, public tpm2.Public) (name *tpm2.Name, qname *tpm2.Name, err error)
GetCertifiedName get and validate certificate name agains TPMB_PUBLIC part
func GetMongoClient ¶
GetMongoClient : To Get Mongo Client Object
func GetMongoClientTest ¶
GetMongoClientTest : To Get Mongo Client Object
func GetMongoSession ¶
GetMongoSession return mongo session
func GetTrustedRoots ¶
GetTrustedRoots return and pool of trusted root credentials for TPM
func GetTrustedRootsFromBundle ¶
GetTrustedRootsFromBundle return and pool of trusted root credentials for TPM
func ParseHeaderPhClientCertificate ¶
func ParseHeaderPhClientCertificate(header string) (*x509.Certificate, error)
ParseHeaderPhClientCertificate get a URL encode pem certificate
func ParsePEMBase64EncodeCert ¶
func ParsePEMBase64EncodeCert(encodeCert string) (*x509.Certificate, error)
ParsePEMBase64EncodeCert parse a hex encoded certificate
func ParsePEMCertString ¶
func ParsePEMCertString(pemCert []byte) (*x509.Certificate, error)
ParsePEMCertString parse a pem certificate
func ParsePEMHexEncodeCert ¶
func ParsePEMHexEncodeCert(encodeCert string) (*x509.Certificate, error)
ParsePEMHexEncodeCert parse a hex encoded certificate
func ParsePrivateKey ¶
func ParsePrivateKey(der []byte) (crypto.PrivateKey, error)
ParsePrivateKey parse private key from DER content
func ParsePublicKey ¶
ParsePublicKey parse public key from DER content
func RemoveIndex ¶
func RemoveIndex(a []interface{}, i int) []interface{}
RemoveIndex remove and index from and array
func Tpm2NameToString ¶
Tpm2NameToString convert tpm2.Name to string
func Tpm2PublicName ¶
Tpm2PublicName get tpm name as string
func ValidateAcaSigned ¶
func ValidateAcaSigned(cert *x509.Certificate) error
ValidateAcaSigned validate a certificate that has been signed by pantahub ACA
func ValidateAttestationSignature ¶
ValidateAttestationSignature validate certification signature
func ValidateCASigned ¶
func ValidateCASigned(cert *x509.Certificate) error
ValidateCASigned validate a certificate that has been signed by pantahub CA
func ValidateCertificateSelfSigned ¶
func ValidateCertificateSelfSigned(cert *x509.Certificate) error
ValidateCertificateSelfSigned validate that a certificate is self signed
Types ¶
type Crypter ¶
type Crypter struct {
// contains filtered or unexported fields
}
Crypter create Crypter
func NewCrypter ¶
NewCrypter define new crypter
type PHExtensions ¶
type PHExtensions struct { CertifyAttest *tpm2.AttestationData CertifySignature *tpm2.Signature QuoteAttest *tpm2.AttestationData QuoteSignature *tpm2.Signature QuotePcrList []byte OwnerTokenID []byte Owner string NameSigByOwner []byte Raw *rawExtensions }
PHExtensions pantacor certificate extensions
func ProcessPHExtensionsCsr ¶
func ProcessPHExtensionsCsr(cert *x509.CertificateRequest) (*PHExtensions, error)
ProcessPHExtensionsCsr process all pantacor extensions if they exists
func ProcessPHExtentions ¶
func ProcessPHExtentions(cert *x509.Certificate) (*PHExtensions, error)
ProcessPHExtentions process all pantacor extensions if they exists