Improve naming and allow for custom keys in our AES encryption methods.

Review Request #8814 — Created March 12, 2017 and submitted

Information

Review Board
release-2.5.x
09aa291...

Reviewers

Our AES encryption/decryption methods were primarily intended for
internal use, but a use case has cropped up that requires using a custom
encryption key. This change adds that support, and improves the naming
of our encryption/decryption methods to spell out that they're for AES
specifically. The old methods remain but raise deprecation warnings.

There's also a new method for getting the default AES encryption key,
preventing callers from having to do their own logic here if they want
to supply the same key to an encryption method.

Unit tests pass.

Description From Last Updated

If key is actually bytes, it's not correct to call encode here. You're also doing the encode inside get_default_aes_encryption_key.

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/tests/test_crypto_utils.py
        reviewboard/scmtools/crypto_utils.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/tests/test_crypto_utils.py
        reviewboard/scmtools/crypto_utils.py
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/scmtools/crypto_utils.py (Diff revision 1)
     
     
    Show all issues

    If key is actually bytes, it's not correct to call encode here. You're also doing the encode inside get_default_aes_encryption_key.

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.5.x (30893d5)