Skip to content

Commit

Permalink
Merge pull request #404 from bitsf/fix_encrypt_key_16_0.6.0
Browse files Browse the repository at this point in the history
fix encrypt key length to 16
  • Loading branch information
steven-zou authored Jan 19, 2021
2 parents a1e62ec + 91f6a48 commit d9e9b55
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controllers/goharbor/harbor/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,16 @@ func (r *Reconciler) GetCoreTokenCertificate(ctx context.Context, harbor *goharb
}

const (
EncryptionKeyLength = 128
EncryptionKeyNumDigits = 16
EncryptionKeyNumSpecials = 48
EncryptionKeyLength = 16
EncryptionKeyNumDigits = 8
EncryptionKeyNumSpecials = 2
)

func (r *Reconciler) GetCoreEncryptionKey(ctx context.Context, harbor *goharborv1alpha2.Harbor) (*corev1.Secret, error) {
name := r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String(), "encryptionkey")
namespace := harbor.GetNamespace()

key, err := password.Generate(CoreSecretPasswordLength, CoreSecretPasswordNumDigits, CoreSecretPasswordNumSpecials, false, true)
key, err := password.Generate(EncryptionKeyLength, EncryptionKeyNumDigits, EncryptionKeyNumSpecials, false, true)
if err != nil {
return nil, errors.Wrap(err, "cannot generate key")
}
Expand Down

0 comments on commit d9e9b55

Please sign in to comment.