diff --git a/models/migrations/v1_16/v210.go b/models/migrations/v1_16/v210.go index 4e55afccc1302..533bb4bf8055f 100644 --- a/models/migrations/v1_16/v210.go +++ b/models/migrations/v1_16/v210.go @@ -4,7 +4,6 @@ package v1_16 //nolint import ( - "crypto/elliptic" "encoding/base32" "fmt" "strings" @@ -123,13 +122,17 @@ func RemigrateU2FCredentials(x *xorm.Engine) error { if err != nil { continue } + pubKey, err := parsed.PubKey.ECDH() + if err != nil { + continue + } remigrated := &webauthnCredential{ ID: reg.ID, Name: reg.Name, LowerName: strings.ToLower(reg.Name), UserID: reg.UserID, CredentialID: base32.HexEncoding.EncodeToString(parsed.KeyHandle), - PublicKey: elliptic.Marshal(elliptic.P256(), parsed.PubKey.X, parsed.PubKey.Y), + PublicKey: pubKey.Bytes(), AttestationType: "fido-u2f", AAGUID: []byte{}, SignCount: reg.Counter,