|
|
@ -18,9 +18,9 @@ func TestParseDigest(t *testing.T) { |
|
|
|
valid bool |
|
|
|
}{ |
|
|
|
{ |
|
|
|
output: "800204338EB1DD3CCDEE1F6FB586F66E640F56FFDD14537A3F0ED9EEEDF10B528FE4195FD17AC9EDAE9718A50196A1459E2434C1E53F1238F4CFDF177FAFBA8B39249B00CAFE00FFDEA42A699205B217004E7E2FFB884E174A548D644116F4B20469CBC32F60A9CB0EEB5BB6A7F266BD0F6A0A99A45B4F18F0F477AED7C854C404EF43530DAB00", |
|
|
|
key: "04338EB1DD3CCDEE1F6FB586F66E640F56FFDD14537A3F0ED9EEEDF10B528FE4195FD17AC9EDAE9718A50196A1459E2434C1E53F1238F4CFDF177FAFBA8B39249B", |
|
|
|
sig: "FFDEA42A699205B217004E7E2FFB884E174A548D644116F4B20469CBC32F60A9CB0EEB5BB6A7F266BD0F6A0A99A45B4F18F0F477AED7C854C404EF43530DAB00", |
|
|
|
output: "80028E8754F012C2FDB492183D41437FD837CB81D8BBE731924E2E0DAF43FD3F2C9300CAFE00787DC03E9E4EE05983E30BAE0DEFB8DB0671DBC2F5874AC93F8D8CA4018F7A42D6F9A9BCEADB422AC8E27CEE9CA205A0B88D22CD686F0A43EB806E8190A3C400", |
|
|
|
key: "8E8754F012C2FDB492183D41437FD837CB81D8BBE731924E2E0DAF43FD3F2C93", |
|
|
|
sig: "787DC03E9E4EE05983E30BAE0DEFB8DB0671DBC2F5874AC93F8D8CA4018F7A42D6F9A9BCEADB422AC8E27CEE9CA205A0B88D22CD686F0A43EB806E8190A3C400", |
|
|
|
valid: true, |
|
|
|
}, |
|
|
|
{ |
|
|
@ -75,9 +75,9 @@ func TestCryptoConvert(t *testing.T) { |
|
|
|
|
|
|
|
cases := []cryptoCase{ |
|
|
|
{ |
|
|
|
msg: "00", |
|
|
|
key: "04338EB1DD3CCDEE1F6FB586F66E640F56FFDD14537A3F0ED9EEEDF10B528FE4195FD17AC9EDAE9718A50196A1459E2434C1E53F1238F4CFDF177FAFBA8B39249B", |
|
|
|
sig: "FFDEA42A699205B217004E7E2FFB884E174A548D644116F4B20469CBC32F60A9CB0EEB5BB6A7F266BD0F6A0A99A45B4F18F0F477AED7C854C404EF43530DAB00", |
|
|
|
msg: "F00D", |
|
|
|
key: "8E8754F012C2FDB492183D41437FD837CB81D8BBE731924E2E0DAF43FD3F2C93", |
|
|
|
sig: "787DC03E9E4EE05983E30BAE0DEFB8DB0671DBC2F5874AC93F8D8CA4018F7A42D6F9A9BCEADB422AC8E27CEE9CA205A0B88D22CD686F0A43EB806E8190A3C400", |
|
|
|
valid: true, |
|
|
|
}, |
|
|
|
} |
|
|
@ -91,8 +91,13 @@ func TestCryptoConvert(t *testing.T) { |
|
|
|
psig, err := parseSig(sig) |
|
|
|
require.Nil(err, "%d: %+v", i, err) |
|
|
|
|
|
|
|
// how do i make this valid?
|
|
|
|
// it is not the signature of the message itself
|
|
|
|
valid := pk.VerifyBytes(msg, psig) |
|
|
|
assert.NotEqual(tc.valid, valid, "%d", i) |
|
|
|
|
|
|
|
// but rather of the hash of the msg
|
|
|
|
hmsg := hashMsg(msg) |
|
|
|
valid = pk.VerifyBytes(hmsg, psig) |
|
|
|
assert.Equal(tc.valid, valid, "%d", i) |
|
|
|
} |
|
|
|
} |