Skip to content

Commit bfaf7cf

Browse files
authored
Merge pull request #1664 from scrtlabs/dcap-12
Dcap 12
2 parents ba3fc98 + d48834b commit bfaf7cf

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

cmd/secretd/attestation.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const (
4141

4242
const (
4343
mainnetRegistrationService = "https://mainnet-register.scrtlabs.com/api/registernode"
44-
pulsarRegistrationService = "https://testnet-register.scrtlabs.com/api/registernode"
44+
pulsarRegistrationService = "https://registration-service-testnet.azurewebsites.net/api/registernode"
4545
)
4646

4747
func InitAttestation() *cobra.Command {
@@ -452,7 +452,7 @@ Please report any issues with this command
452452
}
453453

454454
sgxEnclaveKeyPath := filepath.Join(sgxSecretsFolder, reg.EnclaveRegistrationKey)
455-
sgxAttestationCert := filepath.Join(sgxSecretsFolder, reg.AttestationCertPath)
455+
sgxAttestationCombined := filepath.Join(sgxSecretsFolder, reg.AttestationCombinedPath)
456456

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

495495
// read the attestation certificate that we just created
496-
cert, err := os.ReadFile(sgxAttestationCert)
496+
certCombined, err := os.ReadFile(sgxAttestationCombined)
497497
if err != nil {
498-
_ = os.Remove(sgxAttestationCert)
498+
_ = os.Remove(sgxAttestationCombined)
499499
return err
500500
}
501501

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

536536
resp, err := http.Post(regUrl, "application/json", bytes.NewBuffer(data))
537537
if err != nil {

x/registration/alias.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const (
2525
EncryptedKeyLength = types.EncryptedKeyLength
2626
LegacyEncryptedKeyLength = types.LegacyEncryptedKeyLength
2727
AttestationCertPath = types.AttestationCertPath
28+
AttestationCombinedPath = types.AttestationCombinedPath
2829
IoExchMasterKeyPath = types.IoExchMasterKeyPath
2930
LegacyIoMasterCertificate = types.LegacyIoMasterCertificate
3031
NodeExchMasterKeyPath = types.NodeExchMasterKeyPath

x/registration/internal/types/types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ const (
2525
SeedConfigVersion = 2
2626
)
2727

28-
const AttestationCertPath = "attestation_cert.der"
28+
const (
29+
AttestationCertPath = "attestation_cert.der"
30+
AttestationCombinedPath = "attestation_combined.bin"
31+
)
2932

3033
type NodeID []byte
3134

0 commit comments

Comments
 (0)