public void shareDirAccepted(String parentPath, String dirName, String friendName, String mod, String expo) {
		Map<String, Map<SafeFile, Vector<SafeFile>>> m = user.getFileMap();
		Set<SafeFile> safeFiles = m.get(user.getUsername()).keySet();
		String dirPath;
		
		if (!parentPath.equals("null")) {
			dirPath = user.getUsername() + "\\" + parentPath + "\\" + dirName; // path: username\parentPath\dirName
		} else {
			dirPath = user.getUsername() + "\\" + dirName;
		}
		
		for(SafeFile sf : safeFiles) {
			if (sf.getFilePath().equals(dirPath)) {
				sf.addFriend(friendName);
				shareSubFiles(safeFiles, sf.getFilePath(), friendName);
			} 
		}
		
		BigInteger n = new BigInteger(mod);
		BigInteger e = new BigInteger(expo);
				
		RSAPublicKeySpec spec = new RSAPublicKeySpec(n, e);
		
		try {
			KeyFactory keyFactory = KeyFactory.getInstance("RSA");
			RSAPublicKey pk = (RSAPublicKey) keyFactory.generatePublic(spec);
			
			publicKeyMap.put(friendName, pk);
			
			// use pk to encrypt aesFileString, then put it on AWS
		    String aesfilePath = user.getUsername() + "\\" + user.getUsername() + "_" + friendName + "_AESKEY";
			File aesStringFile = new File(aesfilePath);
			if (aesStringFile.createNewFile()) {
				//System.out.println("Encrypted AES String file is created in local, " + aesfilePath);
			} else {
				System.out.println("Encrypted AES String file exists in local, " + aesfilePath);
			}
			
			Cipher cipherAES = Cipher.getInstance("RSA");
			cipherAES.init(Cipher.ENCRYPT_MODE, pk);
			String encryptedAESInfo = parseByte2HexStr(cipherAES.doFinal(aesFileString.getBytes()));

			BufferedWriter outputAES = new BufferedWriter(new FileWriter(aesfilePath));
		    outputAES.write(encryptedAESInfo);
		    outputAES.close();
		    
		    System.out.println("Generated AES File Key string for " + friendName + ", "+ aesfilePath);
		    //System.out.println("AES File Key string: " + aesFileString);
		   // System.out.println("Encrypted AES File Key string: " + encryptedAESInfo);
		    
	        String keyAES = aesfilePath.replace("\\", "/");

	        fileStorage.putObject("SafeBox", keyAES, aesStringFile);        
			//System.out.println("Encrypted AES String file uploaded successfully on AWS, " + aesfilePath);
			
			// send notification to server
			String os = String.format("%d;%s;%s;%s;%s", SHARE_AES_KEY, user.getUsername(), parentPath, dirName, friendName);
			//System.out.println(os);
			outToServer.println(os);
			outToServer.flush();			
			
		    if (aesStringFile.delete()) {
		    	//System.out.println("Encrypted AES String file is deleted in local, " + aesfilePath);
		    }
			
		} catch (AmazonServiceException ase) {
            System.out.println("Caught an AmazonServiceException, which means your request made it "
                    + "to Amazon S3, but was rejected with an error response for some reason.");
            System.out.println("Error Message:    " + ase.getMessage());
            System.out.println("HTTP Status Code: " + ase.getStatusCode());
            System.out.println("AWS Error Code:   " + ase.getErrorCode());
            System.out.println("Error Type:       " + ase.getErrorType());
            System.out.println("Request ID:       " + ase.getRequestId());
        } catch (AmazonClientException ace) {
            System.out.println("Caught an AmazonClientException, which means the client encountered "
                    + "a serious internal problem while trying to communicate with S3, "
                    + "such as not being able to access the network.");
            System.out.println("Error Message: " + ace.getMessage());
        } catch (Exception exc) {
			System.out.println("Failed to generate RSA key pairs!\n" + exc.toString());
		}
		
		//createShareAESKey(String friendName, String mod, String expo);
	}