cancel
Showing results for 
Search instead for 
Did you mean: 

Content Encryption

thirunavukkaras
Champ in-the-making
Champ in-the-making
Hello Folks,
I have tried out content encryption.decryption in Alfresco.It woks fine.
But when I decrypt the content the decrypted file is saving in Alfresco Company Home as separete file instead of Alfresco Guest home..

Below is the coding part which will create a file into user home space and write the decrypted content in to it.

//create a file into the user home's space
            //and write the decrypted content into it.
            nodeProperties.clear();
            nodeProperties.put(ContentModel.PROP_NAME,namefile+"."+plainContentExt );
            ChildAssociationRef assocRef = this.nodeService.createNode(
                  homeRef,
                  ContentModel.ASSOC_CONTAINS,
                  QName.createQName(NAMESPACE, QName.createValidLocalName(namefile+"."+plainContentExt)),
                  ContentModel.TYPE_CONTENT,
                  nodeProperties);
               NodeRef fileRef = assocRef.getChildRef();
               ContentWriter writer=this.contentService.getWriter(fileRef,ContentModel.PROP_CONTENT,true);
               writer.setEncoding(ENCODING);
               writer.setMimetype(reader.getMimetype());
               writer.putContent(ciph.getOutputAsFile());


Below is the code to write Encrypted content
this.nodeService.setProperty(actionedUponNodeRef,ContentModel.PROP_NAME,plainFileName.toString()+EXT);
            ContentWriter writer=this.contentService.getWriter(actionedUponNodeRef,ContentModel.PROP_CONTENT,true);
            writer.setEncoding("UTF-8");
            writer.setMimetype(MIME);
            writer.putContent(ciph.getOutputAsFile());


Please suggest me that how to create the decrypted file(not a separate file) is on the Alfresco Guest home.

Thanks,
Thiru
1 REPLY 1

mrogers
Star Contributor
Star Contributor
You need to supply more details of what you are doing.   The location of the files will be completely un-related to encryption.