Documentation ¶
Overview ¶
* @Author: jffan * @Date: 2024-07-31 15:01:17
- @LastEditTime: 2024-08-21 15:21:00
- @LastEditors: jffan
- @FilePath: \gitee-tcas\manager\attestmanager.go
* @Description: Request encapsulation
@Author: jffan
@Date: 2024-08-15 09:16:45
@LastEditTime: 2024-08-19 17:03:39
@LastEditors: jffan
@FilePath: \gitee-tcas\manager\request.go
@Description: The type of request params
@Author: jffan
@Date: 2024-07-31 15:01:17
@LastEditTime: 2024-08-21 10:46:18
@LastEditors: jffan
@FilePath: \gitee-tcas\manager\response.go
@Description: The type of response params
@Author: jffan
@Date: 2024-07-31 15:01:17
@LastEditTime: 2024-08-21 10:33:18
@LastEditors: jffan
@FilePath: \gitee-tcas\manager\urls.go
@Description: Define the constant for the request
Index ¶
- Constants
- func ParseCert(certData interface{}) (*x509.Certificate, error)
- func ParseTokenByPk(publicKey any, tokenString string) (*jwt.Token, error)
- func PrintFormatToken(token *jwt.Token) error
- func X5cToCertPem(x5c []string) (*bytes.Buffer, error)
- type AttestCertData
- type AttestCertInfoReq
- type AttestCertResponse
- type AttestSecretData
- type CaResponse
- type CaSingleResponse
- type CertCsrInfoReq
- type HttpBaseResponse
- type LoginRes
- type Manager
- func (m *Manager) AttestForCert(tee, eccpemBase64key, devices, policies string, csr *CertCsrInfoReq) (*AttestCertResponse, error)
- func (m *Manager) AttestForSecret(tee, runtimedata, devices, policies, secretID string) (*AttestSecretData, error)
- func (m *Manager) AttestForToken(tee, runtimedata, devices, policies string) (*TokenResponse, error)
- func (m *Manager) DeletePolicy(policyID string) (*PolicyDeleteResponse, error)
- func (m *Manager) DeleteSecret(secretID string) (*SecretDeleteResponse, error)
- func (m *Manager) GetNonce() (*NonceResponse, error)
- func (m *Manager) GetRootCert() (*CaResponse, error)
- func (m *Manager) ListPolicy(attestationType string) (*PolicyListResponse, error)
- func (m *Manager) ListSecret() (*SecretListResponse, error)
- func (m *Manager) Login(username, password string) (*TCASInfo, error)
- func (m *Manager) SetPolicy(name, policy, attestationType string) (*PolicySetResponse, error)
- func (m *Manager) SetSecret(name, encodeJsonData string) (*SecretSetResponse, error)
- func (m *Manager) UpdateSecret(id, encodeJsonData string) (*SecretSetResponse, error)
- type NodeAttestInfoReq
- type NodeEvidence
- type Nonce
- type NonceResponse
- type PolicyDeleteResponse
- type PolicyListJsonFormat
- type PolicyListResData
- type PolicyListResponse
- type PolicySetResponse
- type SecretDeleteResponse
- type SecretListJsonFormat
- type SecretListResData
- type SecretListResponse
- type SecretSetResponse
- type SetPolicyReq
- type SetSecretReq
- type TCASInfo
- type TokenResponse
- type TrustDeviceReport
- type UpdateSecretReq
- type User
- type UserRes
Constants ¶
View Source
const ( AuthToken = "token" AuthAPIKey = "apikey" AuthNone = "none" )
View Source
const ( NonceGetInterface = "/v1/nonce" PolicyUrl = "/v1/policy" SecretUrl = "/v1/secret" SecretListUrl = "/v1/secret/list" NonceUrl = "/v1/nonce" AttestUrl = "/v1/attest" CaUrl = "/v1/pki/ca" AttestCertUrl = "/v1/attest/getcert" AttestSecretUrl = "/v1/attest/getsecret" LoginUrl = "/v1/user/login" UserInfo = "/v1/user/info" )
The backend interface address
Variables ¶
This section is empty.
Functions ¶
func ParseCert ¶
func ParseCert(certData interface{}) (*x509.Certificate, error)
func ParseTokenByPk ¶
func PrintFormatToken ¶
func PrintFormatToken(token *jwt.Token) error
Types ¶
type AttestCertData ¶
type AttestCertInfoReq ¶
type AttestCertInfoReq struct { Csr *CertCsrInfoReq `json:"csr"` AttestInfo *NodeAttestInfoReq `json:"attestInfo"` }
type AttestCertResponse ¶
type AttestCertResponse struct { HttpBaseResponse Data *AttestCertData `json:"data"` }
type AttestSecretData ¶
type AttestSecretData struct { HttpBaseResponse Secret interface{} `json:"secret"` }
type CaResponse ¶
type CaResponse struct {
Keys []CaSingleResponse `json:"keys"`
}
type CaSingleResponse ¶
type CertCsrInfoReq ¶
type HttpBaseResponse ¶
type LoginRes ¶ added in v0.0.2
type LoginRes struct { HttpBaseResponse Token string UserId string }
type Manager ¶
type Manager struct { Collectors map[string]collectors.EvidenceCollector TCASInfo *TCASInfo TlsConfig *tls.Config }
func New ¶
func New(tcasInfo *TCASInfo, c map[string]collectors.EvidenceCollector) (*Manager, error)
func (*Manager) AttestForCert ¶
func (m *Manager) AttestForCert(tee, eccpemBase64key, devices, policies string, csr *CertCsrInfoReq) (*AttestCertResponse, error)
func (*Manager) AttestForSecret ¶
func (m *Manager) AttestForSecret(tee, runtimedata, devices, policies, secretID string) (*AttestSecretData, error)
func (*Manager) AttestForToken ¶
func (m *Manager) AttestForToken(tee, runtimedata, devices, policies string) (*TokenResponse, error)
func (*Manager) DeletePolicy ¶
func (m *Manager) DeletePolicy(policyID string) (*PolicyDeleteResponse, error)
func (*Manager) DeleteSecret ¶
func (m *Manager) DeleteSecret(secretID string) (*SecretDeleteResponse, error)
func (*Manager) GetNonce ¶
func (m *Manager) GetNonce() (*NonceResponse, error)
func (*Manager) GetRootCert ¶
func (m *Manager) GetRootCert() (*CaResponse, error)
func (*Manager) ListPolicy ¶
func (m *Manager) ListPolicy(attestationType string) (*PolicyListResponse, error)
func (*Manager) ListSecret ¶
func (m *Manager) ListSecret() (*SecretListResponse, error)
func (*Manager) SetPolicy ¶
func (m *Manager) SetPolicy(name, policy, attestationType string) (*PolicySetResponse, error)
func (*Manager) SetSecret ¶
func (m *Manager) SetSecret(name, encodeJsonData string) (*SecretSetResponse, error)
func (*Manager) UpdateSecret ¶
func (m *Manager) UpdateSecret(id, encodeJsonData string) (*SecretSetResponse, error)
type NodeAttestInfoReq ¶
type NodeAttestInfoReq struct { Report *NodeEvidence `json:"report"` Nonce string `json:"nonce"` PolicyIds []string `json:"policy_ids"` }
type NodeEvidence ¶
type NonceResponse ¶
type NonceResponse struct { HttpBaseResponse Data *Nonce `json:"data"` }
type PolicyDeleteResponse ¶
type PolicyDeleteResponse struct { HttpBaseResponse PolicyID string `json:"policy_id"` }
type PolicyListJsonFormat ¶
type PolicyListJsonFormat struct {
Policies []PolicyListResData `json:"policies"`
}
type PolicyListResData ¶
type PolicyListResData struct { No int `json:"no"` PolicyId string `json:"policy_id"` PolicyRego string `json:"policy_rego"` PolicyName string `json:"policy_name"` AttestationType string `json:"attestation_type"` PolicyHash string `json:"policy_hash"` Version int `json:"version"` CreateTime string `json:"createTime"` UpdateTime string `json:"updateTime"` }
type PolicyListResponse ¶
type PolicyListResponse struct { HttpBaseResponse Data []PolicyListResData `json:"data"` }
type PolicySetResponse ¶
type PolicySetResponse struct { HttpBaseResponse PolicyID string `json:"policy_id"` }
type SecretDeleteResponse ¶
type SecretDeleteResponse struct { HttpBaseResponse SecretID string `json:"secret_id"` }
type SecretListJsonFormat ¶
type SecretListJsonFormat struct {
Secrets []SecretListResData `json:"secrets"`
}
type SecretListResData ¶
type SecretListResponse ¶
type SecretListResponse struct { HttpBaseResponse Data []SecretListResData `json:"data"` }
type SecretSetResponse ¶
type SecretSetResponse struct { HttpBaseResponse Id string `json:"id"` }
type SetPolicyReq ¶
type SetSecretReq ¶
type TokenResponse ¶
type TokenResponse struct { HttpBaseResponse Token string `json:"token"` }
type TrustDeviceReport ¶
type UpdateSecretReq ¶
type User ¶ added in v0.0.2
type User struct { No int `orm:"auto"` Id string `orm:"unique;size(255)" json:"userId,omitempty"` Display string `orm:"size(255)" json:"Display,omitempty"` Name string `orm:"unique;size(200)" json:"userName,omitempty"` Department string `orm:"size(255)" json:"department,omitempty"` Email string `orm:"size(200)" json:"email,omitempty"` Status string `orm:"size(200)" json:"status,omitempty"` Comment string `orm:"type(text)" json:"comment,omitempty"` Roles string `orm:"size(32)" json:"roles,omitempty"` ApiKey string `orm:"size(255);unique" json:"apiKey"` LastLogin *time.Time `orm:"auto_now_add;type(datetime)" json:"lastLogin,omitempty"` LastIp string `orm:"size(200)" json:"lastIp,omitempty"` CreateTime *time.Time `orm:"auto_now_add;type(datetime)" json:"createTime,omitempty"` UpdateTime *time.Time `orm:"auto_now;type(datetime)" json:"updateTime,omitempty"` }
type UserRes ¶ added in v0.0.2
type UserRes struct { HttpBaseResponse User *User `json:"User"` }
Click to show internal directories.
Click to hide internal directories.