@@ -75,11 +75,12 @@ abstract Cipher buildUnwrappingCipher(Key key, byte[] extraInfo, int offset,
75
75
* Encrypts the given key, incorporating the given keyName and encryptionContext.
76
76
* @param key The key to encrypt.
77
77
* @param keyName A UTF-8 encoded representing a name for the key.
78
+ * @param keyNamespace A UTF-8 encoded value that namespaces the key.
78
79
* @param encryptionContext A key-value mapping of arbitrary, non-secret, UTF-8 encoded strings used
79
80
* during encryption and decryption to provide additional authenticated data (AAD).
80
81
* @return The encrypted data key.
81
82
*/
82
- public EncryptedDataKey encryptKey (final byte [] key , final String keyName ,
83
+ public EncryptedDataKey encryptKey (final byte [] key , final String keyName , final String keyNamespace ,
83
84
final Map <String , String > encryptionContext ) {
84
85
85
86
final byte [] keyNameBytes = keyName .getBytes (KEY_NAME_ENCODING );
@@ -93,7 +94,7 @@ public EncryptedDataKey encryptKey(final byte[] key, final String keyName,
93
94
System .arraycopy (keyNameBytes , 0 , provInfo , 0 , keyNameBytes .length );
94
95
System .arraycopy (wData .extraInfo , 0 , provInfo , keyNameBytes .length , wData .extraInfo .length );
95
96
96
- return new KeyBlob (keyName , provInfo , encryptedKey );
97
+ return new KeyBlob (keyNamespace , provInfo , encryptedKey );
97
98
} catch (final GeneralSecurityException gsex ) {
98
99
throw new AwsCryptoException (gsex );
99
100
}
@@ -103,7 +104,7 @@ public EncryptedDataKey encryptKey(final byte[] key, final String keyName,
103
104
* Decrypts the given encrypted data key.
104
105
*
105
106
* @param edk The encrypted data key.
106
- * @param keyName A UTF-8 encoded representing a name for the key.
107
+ * @param keyName A UTF-8 encoded String representing a name for the key.
107
108
* @param encryptionContext A key-value mapping of arbitrary, non-secret, UTF-8 encoded strings used
108
109
* during encryption and decryption to provide additional authenticated data (AAD).
109
110
* @return The decrypted key.
0 commit comments