Set password for the docx, ppt, xlsx file - encryption

How to set password for the docx,ppt,xlsx file in Java?
What are APIs available for this?
I was exploring docx4java.
Any examples / options are welcome.

DocRaptor
API
Creating documents using DocRaptor is extremely simple. All you have to do is make a POST request with some parameters!
Authentication
Authentication is done through the use of your API key, which can be found on your account dashboard. You can use the api key in one of two ways: either as the value of the query parameter "user_credentials", or as the username for basic http auth. You can see examples of both of these methods in our coding examples.
REFER

At work we used the JOffice / JWord api to create docx/pptx files and extract text. I am pretty sure you can use JWord to protect docx files with password.
good luck.

Related

Validating FHIR profiles

I'm wondering if there is a way to validate FHIR profiles?
By this I mean validate the xml definition of my profile/extensions are valid, not validate a resource against my profile.
I'm asking this because I've build a tool for producing profiles, and I need to test that the output is correct (and I can't find a definitive clear document that states what is right and wrong).
I'm using HAPI if that makes a difference.
the best way is to use the implementation guide publisher. See http://wiki.hl7.org/index.php?title=IG_Publisher_Documentation#Command_Line_Mode - look for the alternative mode
Alternatively you can upload your StructureDefinition to Simplifier.net, which will do basic validation of the StructureDefinition. When it renders correctly on the Simplifier site after uploading, you'll know you're SD is valid.

How to download article from WSJ with RCurl

I am trying to use RCurl along with XML package to download and mine article from the WSJ (wall street journal). However, whenever i use getURL from RCurl, i do get the version of the article which is available for public viewer.
What i would like to be able to do is to download the full version of the article - as i am paying member. I imagine i have to pass the login credential, when i call the function getURL, however, i am not sure how to do so..
Is this information stored in cookies?
Do i need be "authenticated" - whatever the difference (in purpose maybe) is?
I would appreciate if someone could explain how do website such as WSJ, uses login-info to fetch data, and how can i tweak RCurl in order to take such information into account. A very simple example will go a long way in explaining the different concept of setting cookies (files, jar, ..) etc
Thank you in advance
Typically, authentication information is not stored in cookies. Instead, a "session cookie" is stored on your computer - and refers to authentication stored on the server. See the Session management article on Wikipedia for a bit more information and pointers.
So basically you will need to create a cookie jar file for this site, login with curl (this can be painful, as WSJ doesn't use the standard form-based POST but instead relies on javascript), and then you'll be able to tell curl to re-use the cookie for the following requests on the articles. Read this answer to see how to do it in practice.

HTTP PUT and POST alternatives for uploading content

Other than HTTP PUT and POST, what other methods can a web application designer use to allow users to upload content (either files or listbox text) from a page of his web app to a remote server?
On the same topic, I was wondering what technology/APIs does a service like Google Docs or Google Drive use? The reason I ask this is: Our Sys Admin has disabled file uploading (via Squid proxy), yet I was able to create and share a document using Google Docs / Google Drive.
Many thanks in advance,
/HS
EDIT Please see the strikeout above.
This depends on the server in question - as the standard set of HTTP commands can be expanded, and some may not be configured/allowed. One of the common commands is "OPTIONS" that ask "what can I do".
But to answer more helpfully: you generally have two main options:
POST (the one you probably want to user as it's nearly always avaiable
GET. You could use GET (but I'm NOT advocating it - just saying you could you it - you should not use a GET to make changes to the server). There are problems with this approach (including size of files, manually handling the encoding etc) but it's possible if you have to go this route.
PUT it often not enabled on servers for security reasons.
More reading: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
Edit: if "file uploading" is prevented by proxy, have you tried encoding the POST? i.e. As opposed to sending a multipart POST, try encoding the files yourself into POST string and sending that instead? Or encode the file and split into multiple small posts and piecing them together at the other end?
Google Docs uses a mixture of POST and GET. POST for the updates. Google Drive I don't know.

Encrypted Query String

I have used MachineKey.Encode to encrypt a ID that is getting passed as a query string to a page but as expected this is making the URL huge.
Is there a option such as HTTP handlers that could customize the url but still load the required page?
Also I am yet to find out if MachineKey.Encode is using the MachineKey that I have defined in my web.config file to encrypt the data, can anybody confirm this for me with web information that backs this up.
Thanks.
Also I am yet to find out if MachineKey.Encode is using the MachineKey that I have defined in my web.config file to encrypt the data, can anybody confirm this for me with web information that backs this up.
It does indeed use the configured keys. MachineKey calls MachineKeySection.EncryptOrDecryptData to perform the encryption, which uses encryption objects configured from the machine key section. If you want to see for yourself, the interesting calls are EncryptOrDecryptData=>EnsureConfig=>ConfigureEncryptionObject=>SetKeyOnSymAlgorithm

webcal:// Format - Export to Google Calendar/iCal

I've a home-made php based web calendar which I would like my users to import into Google Calendar, iCal, etc. so they have up-to-date information available on their calendar of choice. I understand providing a webcal link is the way to go but I am not sure how to create it. I've donwloaded an example .ics file but did not have much info..
Where can I find more info on creating a webcal feed? Also, does webcal allow authentication? The feed will most likely be password protected.
Thanks!
A webcal feed use iCalendar format as defined in RFC 5545. It's a rather complex and cumbersome format. You'll find simple examples on wikipedia which may fit your needs. You could also opt to use a library to abstract the format, such as:
http://framework.zend.com/svn/framework/laboratory/Zend_Ical/
http://bennu.sourceforge.net/
http://sourceforge.net/projects/icalcreator/
http://sabre.io/vobject/
From all of these the last one might be your best bet (all others seemed to be dead last time I checked).
As for authentication you may use basic HTTP authentication. Or use a secret token to identify the user (as seen in Google Calendar). Anyway, in both cases you probably should use secure connection (SSL) so data (and passwords) are not sent in clear.
And finally I would recommend the use of webcal:// or webcals:// scheme for ease of use for end-user. But you may face troubles with some clients (eg: Outlook 2007 and forced SSL). I don't have a work-for-all solution yet...
EDIT
I forgot to mention the ICS validator in case you don't use a lib .

Resources