Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dcap 12 #1664

Merged
merged 2 commits into from
Jun 17, 2024
Merged

Dcap 12 #1664

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cmd/secretd/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (

const (
mainnetRegistrationService = "https://mainnet-register.scrtlabs.com/api/registernode"
pulsarRegistrationService = "https://testnet-register.scrtlabs.com/api/registernode"
pulsarRegistrationService = "https://registration-service-testnet.azurewebsites.net/api/registernode"
)

func InitAttestation() *cobra.Command {
Expand Down Expand Up @@ -452,7 +452,7 @@ Please report any issues with this command
}

sgxEnclaveKeyPath := filepath.Join(sgxSecretsFolder, reg.EnclaveRegistrationKey)
sgxAttestationCert := filepath.Join(sgxSecretsFolder, reg.AttestationCertPath)
sgxAttestationCombined := filepath.Join(sgxSecretsFolder, reg.AttestationCombinedPath)

resetFlag, err := cmd.Flags().GetBool(flagReset)
if err != nil {
Expand All @@ -472,7 +472,7 @@ Please report any issues with this command
}
} else {
fmt.Println("Reset enclave flag set, generating new enclave registration key. You must now re-register the node")
_ = os.Remove(sgxAttestationCert)
_ = os.Remove(sgxAttestationCombined)
_, err := api.KeyGen()
if err != nil {
return fmt.Errorf("failed to initialize enclave: %w", err)
Expand All @@ -493,14 +493,14 @@ Please report any issues with this command
}

// read the attestation certificate that we just created
cert, err := os.ReadFile(sgxAttestationCert)
certCombined, err := os.ReadFile(sgxAttestationCombined)
if err != nil {
_ = os.Remove(sgxAttestationCert)
_ = os.Remove(sgxAttestationCombined)
return err
}

// verify certificate
_, err = ra.UNSAFE_VerifyRaCert(cert)
_, err = ra.VerifyCombinedCert(certCombined)
if err != nil {
return err
}
Expand Down Expand Up @@ -531,7 +531,7 @@ Please report any issues with this command
// call registration service to register us
data := []byte(fmt.Sprintf(`{
"certificate": "%s"
}`, base64.StdEncoding.EncodeToString(cert)))
}`, base64.StdEncoding.EncodeToString(certCombined)))

resp, err := http.Post(regUrl, "application/json", bytes.NewBuffer(data))
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions x/registration/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (
EncryptedKeyLength = types.EncryptedKeyLength
LegacyEncryptedKeyLength = types.LegacyEncryptedKeyLength
AttestationCertPath = types.AttestationCertPath
AttestationCombinedPath = types.AttestationCombinedPath
IoExchMasterKeyPath = types.IoExchMasterKeyPath
LegacyIoMasterCertificate = types.LegacyIoMasterCertificate
NodeExchMasterKeyPath = types.NodeExchMasterKeyPath
Expand Down
5 changes: 4 additions & 1 deletion x/registration/internal/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ const (
SeedConfigVersion = 2
)

const AttestationCertPath = "attestation_cert.der"
const (
AttestationCertPath = "attestation_cert.der"
AttestationCombinedPath = "attestation_combined.bin"
)

type NodeID []byte

Expand Down
Loading