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

Raw encryption #4

Open
starekrow opened this issue Dec 9, 2017 · 2 comments
Open

Raw encryption #4

starekrow opened this issue Dec 9, 2017 · 2 comments

Comments

@starekrow
Copy link
Owner

For improved interoperability, CryptoKey should have some facility for returning and accepting raw binary ciphertext and IVs.

For example, update the signature of Lock() to accept a second argument $raw. If true, return an array of [ "iv" => "...", "data" => "..." ]. Likewise, Unlock() could accept such an array.

@alexmanno
Copy link
Contributor

alexmanno commented Dec 9, 2017

You mean something like this?

return [
            'message' => $message,
            'cipher' => $this->cipher,
            'data' => $this->data,
            'options' => $options,
            'iv' => $iv
];

@starekrow
Copy link
Owner Author

Not exactly; I think the separation between the key (details of encryption) and the output of Lock (encrypted message) is fairly important. The most that Lock() should return is probably:

[
     "iv" => $iv
    ,"mac" => $hmac
    ,"data" => $ciphertext
]

The other part should probably come from an Extract() method or an optional argument to Export(), to return:

[
     "key" => $this->data
    ,"cipher" => $this->cipher
    ,"mac" => $this->mac
    ,"id" => $this->id
    ,"kdf" => "hdkf-sha-256"
]

This assumes that #5 is addressed and a configurable MAC is set up at some point in response to #11.

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

No branches or pull requests

2 participants