Pulling out va module

This commit is contained in:
Richard Barnes 2015-03-10 14:26:20 -07:00
parent b545ad6956
commit 37919058e5
4 changed files with 33 additions and 3 deletions

View File

@ -17,6 +17,7 @@ import (
"github.com/letsencrypt/boulder"
"github.com/letsencrypt/boulder/ca"
"github.com/letsencrypt/boulder/ra"
"github.com/letsencrypt/boulder/va"
)
// Exit and print error message if we encountered a problem
@ -110,7 +111,7 @@ func main() {
sa, err := boulder.NewSQLStorageAuthority("sqlite3", ":memory:")
failOnError(err, "Unable to create SA")
ra := ra.NewRegistrationAuthorityImpl()
va := boulder.NewValidationAuthorityImpl()
va := va.NewValidationAuthorityImpl()
ca, err := ca.NewCertificateAuthorityImpl(cfsslServer, authKey, profile)
failOnError(err, "Unable to create CA")

28
core/challenges.go Normal file
View File

@ -0,0 +1,28 @@
// Copyright 2014 ISRG. All rights reserved
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package core
import (
"crypto/rand"
"encoding/hex"
)
func SimpleHTTPSChallenge() Challenge {
return Challenge{
Status: StatusPending,
Token: NewToken(),
}
}
func DvsniChallenge() Challenge {
nonce := make([]byte, 16)
rand.Read(nonce)
return Challenge{
Status: StatusPending,
R: RandomString(32),
Nonce: hex.EncodeToString(nonce),
}
}

View File

@ -16,6 +16,7 @@ import (
"github.com/letsencrypt/boulder/core"
"github.com/letsencrypt/boulder/ra"
"github.com/letsencrypt/boulder/va"
)
// This file defines RPC wrappers around the ${ROLE}Impl classes,
@ -245,7 +246,7 @@ func (rac RegistrationAuthorityClient) OnValidationUpdate(authz core.Authorizati
func NewValidationAuthorityServer(serverQueue string, channel *amqp.Channel, ra core.RegistrationAuthority) (rpc *AmqpRpcServer, err error) {
rpc = NewAmqpRpcServer(serverQueue, channel)
impl := NewValidationAuthorityImpl()
impl := va.NewValidationAuthorityImpl()
impl.RA = ra
rpc.Handle(MethodUpdateValidations, func(req []byte) []byte {
// Nobody's listening, so it doesn't matter what we return

View File

@ -3,7 +3,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package boulder
package va
import (
"crypto/sha256"