Skip to content

Commit

Permalink
fix encrypt key length to 16
Browse files Browse the repository at this point in the history
Signed-off-by: Ziming Zhang <zziming@vmware.com>
  • Loading branch information
bitsf committed Dec 14, 2020
1 parent 036d257 commit 3a69146
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 3a69146

Please sign in to comment.