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

api: Create new pkg/encrypt package and use it. #641

Merged
merged 1 commit into from Apr 10, 2017

Conversation

harshavardhana
Copy link
Member

This is implemented to avoid references of any
HTTP or aws based constants. Simply to show that
encryption is implemented for generic purposes.

// save in the object metadata
type EncryptionMaterials interface {
// Materials - provides generic interface to encrypt any stream of data.
type Materials interface {
Copy link
Member

Choose a reason for hiding this comment

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

'Materials' could be more generic without GetIV(), GetKey() and GetMatDesc().

Think about it this way: any encryption module can save any information it wants in headers, that information will be retrieved from headers later to decrypt data.

As this becomes a separate package, I think we can replace http.Header with map[string]string.

type Materials interface {
   Read(b []byte) (int, error)
   SetupEncryptMode(stream io.Reader) (map[string]string, error)
   SetupDecryptMode(stream io.Reader, decryptInfo map[string]string) error
}

Copy link
Member Author

Choose a reason for hiding this comment

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

An IV and Key are much to do with Crypto rather than to do with AWS, AWS SPEC just names them properly and uses them.

So it is correct the way it is right now, perhaps i can change it.. further.

@@ -44,8 +46,10 @@ func (c Client) GetEncryptedObject(bucketName, objectName string, encryptMateria
return nil, err
}

encryptMaterials.SetupDecryptMode(encReader, st.Metadata)
// Start decrypting the object.
Copy link
Member

Choose a reason for hiding this comment

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

Decryption doesn't start here actually, this is just a setup. Data are decrypted when Read() is called.

This is implemented to avoid references of any
HTTP or aws based constants. Simply to show that
encryption is implemented for generic purposes.
@harshavardhana harshavardhana merged commit b07bdc0 into minio:master Apr 10, 2017
@harshavardhana harshavardhana deleted the encrypt-decrypt branch April 10, 2017 06:33
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.

None yet

2 participants