-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Added support for encryption algorithms for symmetric keys #17209
Merged
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2514dd1
Added support for encryption AES encryption algorithms.
vcolin7 c48a75a
Added CryptographyOptions and ensured the initialization vector is po…
vcolin7 7d030d0
Added APIs that accept CryptographyOptions to CryptographyClient.
vcolin7 67e837c
Fixed Javadoc issues.
vcolin7 17b8e1b
Fixed checkstyle issues. Added samples.
vcolin7 37d0e65
Added checkstyle exceptions.
vcolin7 059c29c
Fixed test and spotbugs issues.
vcolin7 df0aeb7
Applied PR feedback and added local tests.
vcolin7 596d98e
Made the EncryptOptions and DecryptOptions constructor package-privat…
vcolin7 8b93751
Fixed build issues.
vcolin7 b1f1511
Changed EncryptOptions and DecryptOptions to use a factory model.
vcolin7 ff77ba1
Added iv, additionalAuthenticatedDate and authenticationTag to Encryp…
vcolin7 53c8771
Made `plainText` and `cipherText` all lowercase.
vcolin7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...yvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes128CbcPad.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.security.keyvault.keys.cryptography; | ||
|
||
class Aes128CbcPad extends AesCbcPad { | ||
private static final int KEY_SIZE = 128; | ||
public static final String ALGORITHM_NAME = "A128CBCPAD"; | ||
|
||
Aes128CbcPad() { | ||
super(ALGORITHM_NAME, KEY_SIZE); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes128Gcm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.security.keyvault.keys.cryptography; | ||
|
||
class Aes128Gcm extends AesGcm { | ||
private static final int KEY_SIZE = 128; | ||
public static final String ALGORITHM_NAME = "A128GCM"; | ||
|
||
Aes128Gcm() { | ||
super(ALGORITHM_NAME, KEY_SIZE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...yvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes192CbcPad.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.security.keyvault.keys.cryptography; | ||
|
||
class Aes192CbcPad extends AesCbcPad { | ||
private static final int KEY_SIZE = 192; | ||
public static final String ALGORITHM_NAME = "A192CBCPAD"; | ||
|
||
Aes192CbcPad() { | ||
super(ALGORITHM_NAME, KEY_SIZE); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes192Gcm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.security.keyvault.keys.cryptography; | ||
|
||
class Aes192Gcm extends AesGcm { | ||
private static final int KEY_SIZE = 192; | ||
public static final String ALGORITHM_NAME = "A192GCM"; | ||
|
||
Aes192Gcm() { | ||
super(ALGORITHM_NAME, KEY_SIZE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...yvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes256CbcPad.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.security.keyvault.keys.cryptography; | ||
|
||
class Aes256CbcPad extends AesCbcPad { | ||
private static final int KEY_SIZE = 256; | ||
public static final String ALGORITHM_NAME = "A256CBCPAD"; | ||
|
||
Aes256CbcPad() { | ||
super(ALGORITHM_NAME, KEY_SIZE); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes256Gcm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.security.keyvault.keys.cryptography; | ||
|
||
class Aes256Gcm extends AesGcm { | ||
private static final int KEY_SIZE = 256; | ||
public static final String ALGORITHM_NAME = "A256GCM"; | ||
|
||
Aes256Gcm() { | ||
super(ALGORITHM_NAME, KEY_SIZE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lusitanian should this be zero-padding? When we spoke about .NET, you said zero-padding was what the service was using.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...if this is right, I'll have to change .NET's implementation to NoPadding as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going from the name only it made sense to me that we should not use padding for AES-CBC and use padding for AES-CBC-PAD. Is that not the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I asked MHSM about it, the reply was that zero-padding seems to be closer. I'm honestly not sure. If you're writing tests, maybe try it against the service and see what it does with CBC vs CBCPAD.