当前位置: 首页>>代码示例>>Golang>>正文


Golang Challenge.KeyAuthorization方法代码示例

本文整理汇总了Golang中github.com/letsencrypt/boulder/core.Challenge.KeyAuthorization方法的典型用法代码示例。如果您正苦于以下问题:Golang Challenge.KeyAuthorization方法的具体用法?Golang Challenge.KeyAuthorization怎么用?Golang Challenge.KeyAuthorization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/letsencrypt/boulder/core.Challenge的用法示例。


在下文中一共展示了Challenge.KeyAuthorization方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: setChallengeToken

// setChallengeToken sets the token value both in the Token field and
// in the serialized KeyAuthorization object.
func setChallengeToken(ch *core.Challenge, token string) (err error) {
	ch.Token = token

	keyAuthorization, err := core.NewKeyAuthorization(token, ch.AccountKey)
	if err != nil {
		return
	}

	ch.KeyAuthorization = &keyAuthorization
	return
}
开发者ID:ekr,项目名称:boulder,代码行数:13,代码来源:validation-authority_test.go

示例2: createChallenge

// challengeType == "tls-sni-00" or "dns-00", since they're the same
func createChallenge(challengeType string) core.Challenge {
	chall := core.Challenge{
		Type:             challengeType,
		Status:           core.StatusPending,
		Token:            core.NewToken(),
		ValidationRecord: []core.ValidationRecord{},
		AccountKey:       accountKey,
	}

	keyAuthorization, _ := core.NewKeyAuthorization(chall.Token, accountKey)
	chall.KeyAuthorization = &keyAuthorization

	return chall
}
开发者ID:dash1291,项目名称:boulder,代码行数:15,代码来源:validation-authority_test.go

示例3: modelToChallenge

func modelToChallenge(cm *challModel) (core.Challenge, error) {
	c := core.Challenge{
		ID:        cm.ID,
		Type:      cm.Type,
		Status:    cm.Status,
		Validated: cm.Validated,
		Token:     cm.Token,
		TLS:       cm.TLS,
	}
	if len(cm.KeyAuthorization) > 0 {
		ka, err := core.NewKeyAuthorizationFromString(cm.KeyAuthorization)
		if err != nil {
			return core.Challenge{}, err
		}
		c.KeyAuthorization = &ka
	}
	if len(cm.Error) > 0 {
		var problem core.ProblemDetails
		err := json.Unmarshal(cm.Error, &problem)
		if err != nil {
			return core.Challenge{}, err
		}
		c.Error = &problem
	}
	if len(cm.ValidationRecord) > 0 {
		var vr []core.ValidationRecord
		err := json.Unmarshal(cm.ValidationRecord, &vr)
		if err != nil {
			return core.Challenge{}, err
		}
		c.ValidationRecord = vr
	}
	if len(cm.AccountKey) > 0 {
		var ak jose.JsonWebKey
		err := json.Unmarshal(cm.AccountKey, &ak)
		if err != nil {
			return core.Challenge{}, err
		}
		c.AccountKey = &ak
	}
	return c, nil
}
开发者ID:hotelzululima,项目名称:boulder,代码行数:42,代码来源:model.go

示例4: createChallenge

// challengeType == "tls-sni-00" or "dns-00", since they're the same
func createChallenge(challengeType string) core.Challenge {
	chall := core.Challenge{
		Type:             challengeType,
		Status:           core.StatusPending,
		Token:            core.NewToken(),
		ValidationRecord: []core.ValidationRecord{},
		AccountKey:       accountKey,
	}

	keyAuthorization, _ := core.NewKeyAuthorization(chall.Token, accountKey)
	chall.KeyAuthorization = &keyAuthorization

	// TODO(https://github.com/letsencrypt/boulder/issues/894): Remove this block
	validationPayload, _ := json.Marshal(map[string]interface{}{
		"type":  chall.Type,
		"token": chall.Token,
	})
	signer, _ := jose.NewSigner(jose.RS256, &TheKey)
	chall.Validation, _ = signer.Sign(validationPayload, "")

	return chall
}
开发者ID:ekr,项目名称:boulder,代码行数:23,代码来源:validation-authority_test.go


注:本文中的github.com/letsencrypt/boulder/core.Challenge.KeyAuthorization方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。