/** * Given a secret manager and a username encoded for the encrypted handshake, * determine the encryption key. * * @param userName containing the keyId, blockPoolId, and nonce. * @return secret encryption key. * @throws IOException */ private byte[] getEncryptionKeyFromUserName(String userName) throws IOException { String[] nameComponents = userName.split(NAME_DELIMITER); if (nameComponents.length != 3) { throw new IOException("Provided name '" + userName + "' has " + nameComponents.length + " components instead of the expected 3."); } int keyId = Integer.parseInt(nameComponents[0]); String blockPoolId = nameComponents[1]; byte[] nonce = Base64.decodeBase64(nameComponents[2]); return blockPoolTokenSecretManager.retrieveDataEncryptionKey(keyId, blockPoolId, nonce); }
/** * Given a secret manager and a username encoded for the encrypted handshake, * determine the encryption key. * * @param userName containing the keyId, blockPoolId, and nonce. * @return secret encryption key. * @throws IOException */ private byte[] getEncryptionKeyFromUserName(String userName) throws IOException { String[] nameComponents = userName.split(NAME_DELIMITER); if (nameComponents.length != 3) { throw new IOException("Provided name '" + userName + "' has " + nameComponents.length + " components instead of the expected 3."); } int keyId = Integer.parseInt(nameComponents[0]); String blockPoolId = nameComponents[1]; byte[] nonce = Base64.decodeBase64(nameComponents[2]); return blockPoolTokenSecretManager.retrieveDataEncryptionKey(keyId, blockPoolId, nonce); }
/** * Given a secret manager and a username encoded for the encrypted handshake, * determine the encryption key. * * @param userName containing the keyId, blockPoolId, and nonce. * @return secret encryption key. * @throws IOException */ private byte[] getEncryptionKeyFromUserName(String userName) throws IOException { String[] nameComponents = userName.split(NAME_DELIMITER); if (nameComponents.length != 3) { throw new IOException("Provided name '" + userName + "' has " + nameComponents.length + " components instead of the expected 3."); } int keyId = Integer.parseInt(nameComponents[0]); String blockPoolId = nameComponents[1]; byte[] nonce = Base64.decodeBase64(nameComponents[2]); return blockPoolTokenSecretManager.retrieveDataEncryptionKey(keyId, blockPoolId, nonce); }