Skip to content

Commit

Permalink
remove 224 support
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Dec 10, 2024
1 parent 09305cc commit 1ffc25f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
2 changes: 1 addition & 1 deletion cng/dsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func hashAlgFromGroup(groupSize int) bcrypt.HASHALGORITHM_ENUM {
switch groupSize {
case 20:
return bcrypt.DSA_HASH_ALGORITHM_SHA1
case 28, 32:
case 32:
return bcrypt.DSA_HASH_ALGORITHM_SHA256
case 64:
return bcrypt.DSA_HASH_ALGORITHM_SHA512
Expand Down
21 changes: 0 additions & 21 deletions cng/dsa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,6 @@ func TestDSASignAndVerify(t *testing.T) {
testDSASignAndVerify(t, 0, priv)
}

func TestDSASignAndVerify224(t *testing.T) {
var gparams dsa.Parameters
err := dsa.GenerateParameters(&gparams, cng.RandReader, dsa.L2048N224)
if err != nil {
t.Fatalf("error generating parameters: %s", err)
}
params := cng.DSAParameters{
P: bbig.Enc(gparams.P),
Q: bbig.Enc(gparams.Q),
G: bbig.Enc(gparams.G),
}
X := bbig.Enc(fromHex("5078D4D29795CBE76D3AACFE48C9AF0BCDBEE91A"))
Y := bbig.Enc(fromHex("32969E5780CFE1C849A1C276D7AEB4F38A23B591739AA2FE197349AEEBD31366AEE5EB7E6C6DDB7C57D02432B30DB5AA66D9884299FAA72568944E4EEDC92EA3FBC6F39F53412FBCC563208F7C15B737AC8910DBC2D9C9B8C001E72FDC40EB694AB1F06A5A2DBD18D9E36C66F31F566742F11EC0A52E9F7B89355C02FB5D32D2"))
priv, err := cng.NewPrivateKeyDSA(params, X, Y)
if err != nil {
t.Fatalf("error generating key: %s", err)
}

testDSASignAndVerify(t, 0, priv)
}

func TestDSANewPublicKeyWithBadPublicKey(t *testing.T) {
params := cng.DSAParameters{
P: bbig.Enc(fromHex("A9B5B793FB4785793D246BAE77E8FF63CA52F442DA763C440259919FE1BC1D6065A9350637A04F75A2F039401D49F08E066C4D275A5A65DA5684BC563C14289D7AB8A67163BFBF79D85972619AD2CFF55AB0EE77A9002B0EF96293BDD0F42685EBB2C66C327079F6C98000FBCB79AACDE1BC6F9D5C7B1A97E3D9D54ED7951FEF")),
Expand Down

0 comments on commit 1ffc25f

Please sign in to comment.