Merge pull request #2140 from hashicorp/irindos-remove-nonce-encryption

Remove nonce encryption for workerAuth
This commit is contained in:
Irena Rindos authored and GitHub committed 2022-06-06 11:43:10 -04:00
commit 07008e80ff
1 file changed
+2 -8
+2 -8
View File
@@ -125,6 +125,7 @@ func StoreNodeInformationTx(ctx context.Context, writer db.Writer, databaseWrapp
nodeAuth.WorkerKeyIdentifier = node.Id
nodeAuth.WorkerEncryptionPubKey = node.EncryptionPublicKeyBytes
nodeAuth.WorkerSigningPubKey = node.CertificatePublicKeyPkix
nodeAuth.Nonce = node.RegistrationNonce
var err error
nodeAuth.KeyId, err = databaseWrapper.KeyId(ctx)
@@ -135,10 +136,6 @@ func StoreNodeInformationTx(ctx context.Context, writer db.Writer, databaseWrapp
if err != nil {
return errors.Wrap(ctx, err, op)
}
nodeAuth.Nonce, err = encrypt(ctx, node.RegistrationNonce, databaseWrapper)
if err != nil {
return errors.Wrap(ctx, err, op)
}
// Get workerId from state passed in
var result workerAuthWorkerId
@@ -383,6 +380,7 @@ func (r *WorkerAuthRepositoryStorage) loadNodeInformation(ctx context.Context, n
node.EncryptionPublicKeyBytes = authorizedWorker.WorkerEncryptionPubKey
node.CertificatePublicKeyPkix = authorizedWorker.WorkerSigningPubKey
node.RegistrationNonce = authorizedWorker.Nonce
// Default values are used for key types
node.EncryptionPublicKeyType = types.KEYTYPE_X25519
@@ -398,10 +396,6 @@ func (r *WorkerAuthRepositoryStorage) loadNodeInformation(ctx context.Context, n
if err != nil {
return errors.Wrap(ctx, err, op)
}
node.RegistrationNonce, err = decrypt(ctx, authorizedWorker.Nonce, databaseWrapper)
if err != nil {
return errors.Wrap(ctx, err, op)
}
// Get cert bundles from the other table
certBundles, err := r.findCertBundles(ctx, node.Id)