-
-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
age: reject leading zeroes and sign in scrypt work factor
- Loading branch information
1 parent
2088adf
commit 2e09054
Showing
42 changed files
with
456 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"encoding/base64" | ||
|
||
"filippo.io/age/internal/testkit" | ||
) | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body, _ := base64.RawStdEncoding.DecodeString(f.UnreadLine()) | ||
body[len(body)-1] ^= 0xff | ||
f.TextLine(base64.RawStdEncoding.EncodeToString(body)) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectNoMatch() | ||
f.Comment("the ChaCha20Poly1305 authentication tag on the body of the scrypt stanza is wrong") | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body, args := f.UnreadLine(), f.UnreadLine() | ||
f.TextLine(args + " 10") | ||
f.TextLine(body) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Comment("the base64 encoding of the share is not canonical") | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body := f.UnreadLine() | ||
f.TextLine(testkit.NotCanonicalBase64(body)) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Comment("the base64 encoding of the share is not canonical") | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body, args := f.UnreadLine(), f.UnreadArgsLine() | ||
f.ArgsLine(args[0], testkit.NotCanonicalBase64(args[1]), args[2]) | ||
f.TextLine(body) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.ScryptRecordPassphrase("password") | ||
f.ScryptNoRecordPassphraseWithSalt("password", 10, f.Rand(20)) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.ScryptRecordPassphrase("password") | ||
f.ScryptNoRecordPassphraseWithSalt("password", 10, nil) | ||
body, args := f.UnreadLine(), f.UnreadArgsLine() | ||
f.ArgsLine(args[0], args[2]) | ||
f.TextLine(body) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.ScryptRecordPassphrase("password") | ||
f.ScryptNoRecordPassphraseWithSalt("password", 10, f.Rand(12)) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body, args := f.UnreadLine(), f.UnreadArgsLine() | ||
f.ArgsLine("Scrypt", args[1], args[2]) | ||
f.TextLine(body) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectNoMatch() | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body, args := f.UnreadLine(), f.UnreadArgsLine() | ||
f.ArgsLine(args[0], args[1], "0xa") | ||
f.TextLine(body) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body, args := f.UnreadLine(), f.UnreadArgsLine() | ||
f.ArgsLine(args[0], args[1], "aaaa10") | ||
f.TextLine(body) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body, args := f.UnreadLine(), f.UnreadArgsLine() | ||
f.ArgsLine(args[0], args[1], "+10") | ||
f.TextLine(body) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body, args := f.UnreadLine(), f.UnreadArgsLine() | ||
f.ArgsLine(args[0], args[1], "010") | ||
f.TextLine(body) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Generate() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2022 The age Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build ignore | ||
|
||
package main | ||
|
||
import "filippo.io/age/internal/testkit" | ||
|
||
func main() { | ||
f := testkit.NewTestFile() | ||
f.VersionLine("v1") | ||
f.Scrypt("password", 10) | ||
body, args := f.UnreadLine(), f.UnreadArgsLine() | ||
f.ArgsLine(args[0], args[1], "012") | ||
f.TextLine(body) | ||
f.HMAC() | ||
f.Payload("age") | ||
f.ExpectHeaderFailure() | ||
f.Generate() | ||
} |
Oops, something went wrong.