Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary Binding implementation #21

Merged
merged 1 commit into from
Jul 21, 2016
Merged

Temporary Binding implementation #21

merged 1 commit into from
Jul 21, 2016

Conversation

vqhuy
Copy link
Member

@vqhuy vqhuy commented Jul 15, 2016

Implement the TB struct for registration protocol.

@masomel
Copy link
Member

masomel commented Jul 19, 2016

LGTM! @arlolra @liamsi Thoughts?

func NewTemporaryBinding(pad *PAD, key string, value []byte) *TemporaryBinding {
str := pad.currentSTR
index := computePrivateIndex(key)
tb := str.SerializeWithSignature()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a similar comment to what I had in #8 (comment)

In §3.3, STR is defined as,

STR = SignSKd (t||tprev||roott ||H(STRprev)||P)

which to me look like it's just the signature. I know I'm picking at nits, but now when I go look at the definition of TB in §4.1.1,

TB = SignKd (STRt, i, k)

(which, in an aside to @masomel, probably wants to be, TB = SignSKd (STRt || i || k), consistent with SKd and concatenation)

it's again not clear what is meant by STR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your confusion now. I went back to look at Certificate Transparency's Signed Tree Head spec, after which STRs are modeled, and I think technically, the STR should be only the signature.

What this means for prevStrHash and also TB (which yes, the notation should really use concatenation for consistency, though I believe commas are more proper crypto notation), is that these should only use STR.signature in their respective computations.

However, when TBs and STRs are sent to the client (and eventually to auditors in STRs' case), we will still have to include all the values to allow for signature verification.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification. I opened #22 for prevStrHash.

@arlolra
Copy link
Member

arlolra commented Jul 20, 2016

I feel like pad.Set should be issuing the temporary bindings and storing them so that pad.Get can return them when necessary. You can also write tests for that, which I don't see in the current implementation.

@masomel
Copy link
Member

masomel commented Jul 20, 2016

I feel like pad.Set should be issuing the temporary bindings and storing them so that pad.Get can return them when necessary.

I had the same thought, but decided it would be best to leave it up to the developer to use TBs in the server implementation. The reason is that we've found that temporary bindings may not actually be the best approach to solving the immediate issuance problem, as we've been discussing in #13 and as we've learned from other contacts in industry (all of which are looking for alternatives to TBs). So we should definitely continue refining our solution for TBs, and I think it's fine to provide the TB interface for those developers who are willing to use TBs, but I don't think the PAD should issue temporary bindings by default.

arlolra added a commit that referenced this pull request Jul 20, 2016
@arlolra arlolra mentioned this pull request Jul 20, 2016
@arlolra
Copy link
Member

arlolra commented Jul 20, 2016

I think it's fine to provide the TB interface for those developers who are willing to use TBs, but I don't think the PAD should issue temporary bindings by default.

Ok, I'm on board with that. I guess I'm most uncomfortable with NewTemporaryBinding taking the PAD as input. I'd rather see a pad.TB() which returns the new binding, for those that wish to use it.

@masomel
Copy link
Member

masomel commented Jul 20, 2016

I guess I'm most uncomfortable with NewTemporaryBinding taking the PAD as input. I'd rather see a pad.TB() which returns the new binding, for those that wish to use it.

This makes sense to me.

@vqhuy
Copy link
Member Author

vqhuy commented Jul 21, 2016

Ok, I'm on board with that. I guess I'm most uncomfortable with NewTemporaryBinding taking the PAD as input. I'd rather see a pad.TB() which returns the new binding, for those that wish to use it.

The reason I did it is I thought it would be more consistent with other NewXxx functions in other source files. But it's a bad idea.
I also changed the TB to str.sig in 60ee33f3c7e6adfd01374e83e6d394ca826f2aa5. The verify prove function would be implemented in a separate pull as #24

sig []byte
}

func (pad *PAD) NewTemporaryBinding(key string, value []byte) *TemporaryBinding {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to pad.go though, to be closer to PAD's other methods? And maybe rename it to just .TB().

@liamsi
Copy link
Member

liamsi commented Jul 21, 2016

I approve of everything @arlolra commented on. Especially of making NewTemporaryBinding a method of PAD and calling it TB or TempBinding.

Also I'm not sure if we'll need all the getters (Index(), Value(), ...). We could remove them for now.

@vqhuy
Copy link
Member Author

vqhuy commented Jul 21, 2016

Also I'm not sure if we'll need all the getters (Index(), Value(), ...). We could remove them for now.

I think we still need these getters since we need to expose these values to the client to allow them verify the signature. Does it make sense?

tb = append(tb, index...)
tb = append(tb, value...)
sig := crypto.Sign(pad.key, tb)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also call pad.Set(key, value) in here? If we're issuing a TB, it's kind of implying that, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I couldn't find out any other reasons to not to do it, so we should do it.

@arlolra arlolra merged commit 8e2f380 into master Jul 21, 2016
@arlolra arlolra deleted the tb branch July 21, 2016 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants