<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1864133399285459995</id><updated>2026-07-17T10:54:37.733-07:00</updated><category term="PKI"/><category term="java"/><category term="Alfresco"/><category term="Document Management"/><category term="EJBCA"/><category term="certificate Authority"/><category term="digital Certificates"/><category term="ECM"/><category term="PKCS#11"/><category term="RSA"/><category term="smart card"/><category term="Alfresco SDK"/><category term="JSF"/><category term="Lucene"/><category term="X509"/><category term="X509Certificate"/><category term="jndi"/><category term="ldap"/><category term="openldap"/><title type='text'>Developers Tutorials</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-3748350994440173259</id><published>2010-12-04T06:51:00.000-08:00</published><updated>2014-09-11T16:37:26.604-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Alfresco"/><category scheme="http://www.blogger.com/atom/ns#" term="Document Management"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><title type='text'>automatic document classification with Alfresco Part 2</title><content type='html'>
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In the &lt;a href=&quot;http://surjava.blogspot.com/2010/11/alfresco-automatic-document.html&quot;&gt;first part&lt;/a&gt; of this article, i explained how you can use Lucene to query a document (Word, PDF etc...), and find matches for specific keywords, which was necessary for us in order to automatically identify the document&#39;s category based on its content.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
We&#39;ve chosen a simple approach to demonstrate the automatic classification extension : if a document contains the name of a category, then it belongs to it, of course we can use other approaches like assigning multiple keywords to a category, example : if a document contains one of the following words &quot;java, .Net, c#...&quot; then assign it to category &quot;Software development&quot;, it can easily be implemented once you finish reading and understanding this article, and of course how you implement it depends on your specific needs, you might need some more advanced classification algorithm.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
The first question we might ask is : Where does the code to customize Alfresco goes? meaning, which class should we extend or modify in order to add the automatic classification logic? , if you want it applied all across the repository, you should extend the implementation of &quot;&lt;b&gt;NodeService&lt;/b&gt;&quot;, especially the method &quot;&lt;b&gt;createContent&lt;/b&gt;&quot;, if you want to be applied only for the JSF web-client users, you will need to extend the managed bean of the &quot;Add content&quot; dialog :&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; import org.alfresco.web.bean.content.AddContentDialog;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now we will create our own custom version of &quot;&lt;code class=&quot;CICodeFormatter&quot;&gt;AddContentDialog&quot; :&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; /**  
  *  
  * @author Haltout Sohaib  
  */  
 public class CustomAddContentDialog extends AddContentDialog{&amp;nbsp;&lt;/code&gt;
 }  
&lt;/pre&gt;
&lt;br /&gt;
As for all other Alfresco Dialogs, the business logic is implemented in the method :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; protected String finishImpl(FacesContext context, String outcome) throws Exception;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Meaning that&#39;s the method we should override in order to add our own custom classification logic, that will be executed right after the document node is created at the repository :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;   @Override  
   protected String finishImpl(FacesContext context, String outcome) throws Exception {  
     //We fetch any change in the navigation outcome  
     String outc = super.finishImpl(context, outcome);  
     addCategories();  
     return outc;  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&amp;nbsp;Now we will implement the method &quot;addCategories()&quot; :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;   private Map&amp;lt;String,NodeRef&amp;gt; getAvailableCategories(){  
     Map&amp;lt;String,NodeRef&amp;gt; categories = new HashMap&amp;lt;String,NodeRef&amp;gt;();  
     //Get the nodeService  
     NodeService nodeService = this.getNodeService();  
     //We fetch a collection of all available categories  
     Collection&amp;lt;ChildAssociationRef&amp;gt; assoc =   
          categoryService.getCategories(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,   
           ContentModel.ASPECT_GEN_CLASSIFIABLE, CategoryService.Depth.ANY);  
     for(ChildAssociationRef child : assoc){  
       NodeRef node = child.getChildRef();  
       //Get the name of the category from nodeService  
       String name = (String) nodeService.getProperty(node, ContentModel.PROP_NAME);  
       //Add the category to the map  
       categories.put(name, node);  
     }  
     return categories;  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
First we fetched all the available categories defined in Alfresco, searched the content of the uploaded document finding matching categories using the &quot;SearchUtils&quot; class we defined in the&amp;nbsp; &lt;a href=&quot;http://surjava.blogspot.com/2010/11/alfresco-automatic-document.html&quot;&gt;previous article&lt;/a&gt;, and then add each one to the created node.&lt;br /&gt;
We will now implement the method&amp;nbsp; &quot;getAvailableCategories()&quot; :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;   private Map&amp;lt;String,NodeRef&amp;gt; getAvailableCategories(){  
     Map&amp;lt;String,NodeRef&amp;gt; categories = new HashMap&amp;lt;String,NodeRef&amp;gt;();  
     //Get the nodeService  
     NodeService nodeService = this.getNodeService();  
     //We fetch a collection of all available categories  
     Collection&amp;lt;ChildAssociationRef&amp;gt; assoc =   
          categoryService.getCategories(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,   
           ContentModel.ASPECT_GEN_CLASSIFIABLE, CategoryService.Depth.ANY);  
     for(ChildAssociationRef child : assoc){  
       NodeRef node = child.getChildRef();  
       //Get the name of the category from nodeService  
       String name = (String) nodeService.getProperty(node, ContentModel.PROP_NAME);  
       //Add the category to the map  
       categories.put(name, node);  
     }  
     return categories;  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
In the method &quot;addCategoriesToNode()&quot; we will add the provided list of categories to the created node :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;   private void addCategoriesToNode(ArrayList&amp;lt;NodeRef&amp;gt; foundCategoriesRef) {  
     //Get the nodeService  
     NodeService nodeService = this.getNodeService();  
     if(!nodeService.hasAspect(this.createdNode, ContentModel.ASPECT_GEN_CLASSIFIABLE))  
     {  
       HashMap&amp;lt;QName, Serializable&amp;gt; props = new HashMap&amp;lt;QName, Serializable&amp;gt;();  
       props.put(ContentModel.PROP_CATEGORIES, foundCategoriesRef);  
       nodeService.addAspect(this.createdNode, ContentModel.ASPECT_GEN_CLASSIFIABLE, props);  
     }  
     else  
     {  
       nodeService.setProperty(this.createdNode, ContentModel.PROP_CATEGORIES, foundCategoriesRef);  
     }  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
We used the bean &quot;categoryService()&quot;, we will need to add the getters and setters for dependency injection :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;   private CategoryService categoryService;  
   /**  
    * Get the value of categoryService  
    *  
    * @return the value of categoryService  
    */  
   public CategoryService getCategoryService() {  
     return categoryService;  
   }  
   /**  
    * Set the value of categoryService  
    *  
    * @param categoryService new value of categoryService  
    */  
   public void setCategoryService(CategoryService categoryService) {  
     this.categoryService = categoryService;  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
And finally, now that our bean is ready, we will need JSF to be aware of it, let&#39;s open the file &quot;faces-config-custom.xml&quot; located in the &quot;Web-Inf&quot; directory, and add our bean definition :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; &amp;lt;managed-bean&amp;gt;  
    &amp;lt;description&amp;gt;  
      Custom bean that backs up the Add Content Dialog  
    &amp;lt;/description&amp;gt;  
    &amp;lt;managed-bean-name&amp;gt;AddContentDialog&amp;lt;/managed-bean-name&amp;gt;  
    &amp;lt;managed-bean-class&amp;gt;com.hsohaib.alfresco.CustomAddContentDialog&amp;lt;/managed-bean-class&amp;gt;  
    &amp;lt;managed-bean-scope&amp;gt;session&amp;lt;/managed-bean-scope&amp;gt;  
       &amp;lt;managed-property&amp;gt;  
      &amp;lt;property-name&amp;gt;categoryService&amp;lt;/property-name&amp;gt;  
      &amp;lt;value&amp;gt;#{CategoryService}&amp;lt;/value&amp;gt;  
    &amp;lt;/managed-property&amp;gt;  
    &amp;lt;managed-property&amp;gt;  
      &amp;lt;property-name&amp;gt;nodeService&amp;lt;/property-name&amp;gt;  
      &amp;lt;value&amp;gt;#{NodeService}&amp;lt;/value&amp;gt;  
    &amp;lt;/managed-property&amp;gt;  
    &amp;lt;managed-property&amp;gt;  
      &amp;lt;property-name&amp;gt;fileFolderService&amp;lt;/property-name&amp;gt;  
      &amp;lt;value&amp;gt;#{FileFolderService}&amp;lt;/value&amp;gt;  
    &amp;lt;/managed-property&amp;gt;  
    &amp;lt;managed-property&amp;gt;  
      &amp;lt;property-name&amp;gt;searchService&amp;lt;/property-name&amp;gt;  
      &amp;lt;value&amp;gt;#{SearchService}&amp;lt;/value&amp;gt;  
    &amp;lt;/managed-property&amp;gt;  
    &amp;lt;managed-property&amp;gt;  
      &amp;lt;property-name&amp;gt;navigator&amp;lt;/property-name&amp;gt;  
      &amp;lt;value&amp;gt;#{NavigationBean}&amp;lt;/value&amp;gt;  
    &amp;lt;/managed-property&amp;gt;  
    &amp;lt;managed-property&amp;gt;  
      &amp;lt;property-name&amp;gt;browseBean&amp;lt;/property-name&amp;gt;  
      &amp;lt;value&amp;gt;#{BrowseBean}&amp;lt;/value&amp;gt;  
    &amp;lt;/managed-property&amp;gt;  
    &amp;lt;managed-property&amp;gt;  
      &amp;lt;property-name&amp;gt;contentService&amp;lt;/property-name&amp;gt;  
      &amp;lt;value&amp;gt;#{ContentService}&amp;lt;/value&amp;gt;  
    &amp;lt;/managed-property&amp;gt;  
    &amp;lt;managed-property&amp;gt;  
      &amp;lt;property-name&amp;gt;dictionaryService&amp;lt;/property-name&amp;gt;  
      &amp;lt;value&amp;gt;#{DictionaryService}&amp;lt;/value&amp;gt;  
    &amp;lt;/managed-property&amp;gt;  
   &amp;lt;/managed-bean&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Note that the bean name must be &quot;AddContentDialog&quot;, otherwise Alfresco will use the already defined bean for managing the &quot;Add Content&quot; dialog.&lt;br /&gt;
&lt;br /&gt;
That&#39;s it folks, the extension should be working now, you can test it by adding documents containing the names of multiples categories you have defined, and they should all be classified automatically without your intervention.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/3748350994440173259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/12/automatic-classification-alfresco.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3748350994440173259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3748350994440173259'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/12/automatic-classification-alfresco.html' title='automatic document classification with Alfresco Part 2'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-898378154443827816</id><published>2010-11-30T16:32:00.000-08:00</published><updated>2012-07-28T11:42:09.951-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Alfresco"/><category scheme="http://www.blogger.com/atom/ns#" term="Document Management"/><category scheme="http://www.blogger.com/atom/ns#" term="ECM"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Lucene"/><title type='text'>Alfresco automatic document classification : Part 1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Alfresco&lt;/b&gt; is capable of handling multiple classifications, or hierarchies of classification, it&#39;s a very useful feature, and can make your life a lot easier when looking for documents, especially the ones with no indexed content like pictures, scanned documents etc...&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Classifying a document in &lt;b&gt;Alfresco&lt;/b&gt; can be as easy as few clicks on the browser, however it can be very time-consuming process if you are uploading many documents every day, or if you are migrating to &lt;b&gt;Alfresco&lt;/b&gt; : Imagine having to manually classify a few thousands of documents!&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
If you are still classifying documents manually, analyzing their content, and sorting them into categories, you might be interested in finding out how you can extend &lt;b&gt;Alfresco&lt;/b&gt; to automatically classify your documents for you.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Once a user uploads a document to the repository, our extension will fetch the list of all defined categories, and then crawls the document looking for matches, ex : if a document contains the word &#39;Software&#39;, and there is a category named &#39;Software&#39; defined in &lt;b&gt;Alfresco&lt;/b&gt;, this document will be added to it. This is the simplest approach, a more advanced one will be explained in later posts.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
That said, we will create a SearchUtils helper class that will handle searching the document for keywords, in order to search all types of documents we will be using &lt;a href=&quot;http://lucene.apache.org/java/docs/index.html&quot;&gt;Apache Lucene&lt;/a&gt;, a powerful search engine, already integrated in Alfresco, to lookup the categories in the document.&lt;/div&gt;
&lt;br /&gt;
The main method is :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;   public static List&amp;lt;String&amp;gt; search(File file, Set&amp;lt;String&amp;gt; keyWords) {  
     List&amp;lt;String&amp;gt; result = new ArrayList&amp;lt;String&amp;gt;();  
     RAMDirectory idx = new RAMDirectory();  
   
     try {  
       // Make a writer to create the index  
       IndexWriter writer =  
           new IndexWriter(idx, new StandardAnalyzer(), true);  
   
       // Add the Document Object  
       writer.addDocument(fileToDocument(file));  
   
       // Optimize and close the writer to finish building the index  
       writer.optimize();  
       writer.close();  
   
       // Build an IndexSearcher using the in-memory index  
       Searcher searcher = new IndexSearcher(idx);  
   
       // find to which categories this document belons  
       for(String keyWord :keyWords){  
         if(search(searcher,keyWord)) result.add(keyWord);  
       }  
       searcher.close();  
     } catch (IOException ioe) {  
   
       ioe.printStackTrace();  
     } catch (ParseException pe) {  
       pe.printStackTrace();  
     }  
       
     return result;  
   }&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
it takes as arguments the document, and a list of keywords to lookup, and returns a list of the keywords (categories) found in the document.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In order for Lucene to treat the document, we need to convert the file into a Document object recognized by Lucene, which is why we used another method &quot;fileToDocument&quot; in order to handle the conversion, this method is a part of &lt;b&gt;Lucene&lt;/b&gt;&#39;s demos that can be found in source distribution in the official website :&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;   public static Document fileToDocument(File f)  
     throws java.io.FileNotFoundException {  
   
   // make a new, empty document  
   Document doc = new Document();  
   
   // Add the path of the file as a field named &quot;path&quot;. Use a field that is  
   // indexed (i.e. searchable), but don&#39;t tokenize the field into words.  
   doc.add(new Field(&quot;path&quot;, f.getPath(), Field.Store.YES, Field.Index.NOT_ANALYZED));  
   
   // Add the last modified date of the file a field named &quot;modified&quot;. Use  
   // a field that is indexed (i.e. searchable), but don&#39;t tokenize the field  
   // into words.  
   doc.add(new Field(&quot;modified&quot;,  
     DateTools.timeToString(f.lastModified(), DateTools.Resolution.MINUTE),  
     Field.Store.YES, Field.Index.NOT_ANALYZED));  
   
   // Add the contents of the file to a field named &quot;contents&quot;. Specify a Reader,  
   // so that the text of the file is tokenized and indexed, but not stored.  
   // Note that FileReader expects the file to be in the system&#39;s default encoding.  
   // If that&#39;s not the case searching for special characters will fail.  
   doc.add(new Field(&quot;contents&quot;, new FileReader(f)));  
   
   // return the document  
   return doc;  
  }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
And finally the method &quot;search&quot;, that builds a &lt;b&gt;Lucene&lt;/b&gt; Query Object, executes it, and returns true if any occurrences of the keyword are found.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;   private static boolean search(Searcher searcher, String queryString)  
     throws ParseException, IOException {  
   
     // Build a Query object  
   
     Query query = new QueryParser().parse(  
       queryString, &quot;content&quot;, new StandardAnalyzer());  
   
     // Search for the query  
     Hits hits = searcher.search(query);  
   
     // Examine the Hits object to see if there were any matches  
     int hitCount = hits.length();  
     if (hitCount == 0) {  
       return false;  
     }  
       
     return true;  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
With this, our class &quot;SearchUtils&quot; is complete, in my next post i will explain how to extend and customize &lt;b&gt;Alfresco&lt;/b&gt;, and use what we learned today in order to automaticaly classify documents on the repository based on its content.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/898378154443827816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/11/alfresco-automatic-document.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/898378154443827816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/898378154443827816'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/11/alfresco-automatic-document.html' title='Alfresco automatic document classification : Part 1'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-3268496864585322678</id><published>2010-11-26T02:10:00.000-08:00</published><updated>2012-07-28T11:43:16.910-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Alfresco"/><category scheme="http://www.blogger.com/atom/ns#" term="Alfresco SDK"/><category scheme="http://www.blogger.com/atom/ns#" term="Document Management"/><category scheme="http://www.blogger.com/atom/ns#" term="ECM"/><title type='text'>Getting started with Alfresco</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
During my internship at &lt;a href=&quot;http://www.tgr.gov.ma/&quot;&gt;TGR&lt;/a&gt;, one of the project&#39;s requirements was indexing and managing documents, and that was my first experience with &lt;b&gt;Alfresco&lt;/b&gt;,&amp;nbsp; which is an open source &lt;b&gt;Enterprise Content Management&lt;/b&gt; (&lt;b&gt;ECM&lt;/b&gt;), it combines a collection of content-centric technologies like &lt;b&gt;Document Management &lt;/b&gt;(&lt;b&gt;DM&lt;/b&gt;), &lt;b&gt;Records Management&lt;/b&gt; (&lt;b&gt;RM&lt;/b&gt;), and other technologies that should make your life, if your field of work is Content Management, easier.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Customizing &lt;b&gt;Alfresco&lt;/b&gt; can be a bit tricky, and hard to grasp at first, but after doing it few times, you start to get the feel of it, and this post, as well as the future articles about &lt;b&gt;Alfresco&lt;/b&gt;, are all here for you to get there.&lt;/div&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
Before you can customize Alfresco, you will need to get your development environment in order, so, first things first : I will show you how to obtain the &lt;b&gt;Software Development Kit&lt;/b&gt; (&lt;b&gt;SDK&lt;/b&gt;), and how to set it up in eclipse.&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Prerequisites&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Make sure you have the following developement tools installed first :&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;JDK 1.6.X.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Eclipse IDE 3.2+ (Recommended) .&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Obtaining the SDK&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;You can either download the SDK from &lt;span id=&quot;goog_1894075498&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_1894075499&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://sourceforge.net/projects/alfresco/files/%5BArchive%5D/%5BArchive%5D%20OldFiles/&quot;&gt;SDK Download Page at SourceForge&lt;/a&gt;, or check out the source code and build it. The SVN URL is : &lt;a href=&quot;svn://svn.alfresco.com&quot;&gt;svn://svn.alfresco.com&lt;/a&gt;.&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Setting up the SDK&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Once downloaded, our next step is setting up the &lt;b&gt;SDK&lt;/b&gt; in &lt;b&gt;Eclipse&lt;/b&gt; :&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Start Eclipse.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Select &quot;File &lt;/span&gt;-&amp;gt; import&quot;.&lt;/li&gt;
&lt;li&gt;Choose &quot;General -&amp;gt; Existing Projects into WorkSpace&quot;.&lt;/li&gt;
&lt;li&gt;Choose &quot;Select root directory&quot;, and click on &quot;Browse&quot;.&lt;/li&gt;
&lt;li&gt;Navigate to the root directory where you unpacked Alfresco SDK, and select OK.&lt;/li&gt;
&lt;li&gt;The Alfresco Projects are listed under &quot;projects&quot;.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Only &quot;SDK AlfrescoRemote&quot; and &quot;SDK AlfrescoEmbedded&quot; are required, but it&#39;s a good idea to include the other &lt;b&gt;SDK&lt;/b&gt; Samples in order to see how it works, and get the feel of it.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span id=&quot;goog_1894075509&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_1894075510&quot;&gt;&lt;/span&gt;If everything went well, the &lt;b&gt;SDK&lt;/b&gt; should be now up and working, in the next article we will see the first example on how to use it in order to customize &lt;b&gt;Alfresco&lt;/b&gt;.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/3268496864585322678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/11/getting-started-alfresco-customization.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3268496864585322678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3268496864585322678'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/11/getting-started-alfresco-customization.html' title='Getting started with Alfresco'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-7556218148038860283</id><published>2010-11-23T05:41:00.000-08:00</published><updated>2010-12-12T09:32:57.915-08:00</updated><title type='text'>IOS 4.2 released</title><content type='html'>Since yesterday, 18h, the latest release of IOS which is 4.2 is officially available for downloads.&lt;br /&gt;
New features :&lt;br /&gt;
&lt;blockquote&gt;&lt;ul&gt;&lt;li&gt; AirPrint: print email, photos, web pages, and documents right from&amp;nbsp; iPhone, iPad, or iPod touch.&lt;/li&gt;
&lt;li&gt;AirPlay: stream digital media wirelessly from your iPhone, iPad, and iPod touch to your Apple TV and AirPlay-enabled speakers.&lt;/li&gt;
&lt;li&gt;Find My IPhone: helps you locate your missing device and protect its data — is now free  on any iPhone 4, iPad, or fourth-generation iPod touch running iOS 4.2.&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/7556218148038860283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/11/latest-ios-iphone-download.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/7556218148038860283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/7556218148038860283'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/11/latest-ios-iphone-download.html' title='IOS 4.2 released'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-4172974298859584293</id><published>2010-11-19T09:23:00.000-08:00</published><updated>2012-07-28T11:44:16.485-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="EJBCA"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="PKCS#11"/><category scheme="http://www.blogger.com/atom/ns#" term="PKI"/><category scheme="http://www.blogger.com/atom/ns#" term="RSA"/><category scheme="http://www.blogger.com/atom/ns#" term="smart card"/><category scheme="http://www.blogger.com/atom/ns#" term="X509Certificate"/><title type='text'>smart Card tutorial : Part 2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In my previous article &lt;a href=&quot;http://surjava.blogspot.com/2010/11/smart-card-tutorial-part-1.html&quot;&gt;smart Card tutorial : Part 1&lt;/a&gt;, i explained how you can use the Cryptographic Token Interface Standard &lt;b&gt;PKCS#11&lt;/b&gt; in order to access your &lt;b&gt;smart card&lt;/b&gt; or &lt;b&gt;USB Token&lt;/b&gt;,  and perform some simple operations like listing the connected tokens,  and displaying each device&#39;s informations (Serial Number, Vendor  etc...).&lt;/div&gt;
This second part will cover some advanced usage of &lt;b&gt;PKCS#11&lt;/b&gt; like :&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Generating on-card &lt;b&gt;RSA&lt;/b&gt; Keypair.&lt;/li&gt;
&lt;li&gt;Storing certificates and objects.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;Generating on-card RSA Keypair&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In order to use your smart card for authentication or digital signature,  you need first to store your private key and certificate inside it,  which obviously means you need to generate the Key-pair first! for that  you can either generate a PKCS#12 keystore using Openssl, or your  certificate authority management software like &lt;a href=&quot;http://www.ejbca.org/&quot; title=&quot;EJBCA : a small presentation&quot;&gt;EJBCA&lt;/a&gt;  , but in doing so, there is a chance that someone may intercept your  &quot;.p12&quot; file, and therefore compromise your private key, not to mention  that the admin can keep a copy of the file to himself.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
A more secure way is generating the key-pair inside the &lt;b&gt;smart card&lt;/b&gt;,  this way the private key never leaves it, always protected, and more  importantly : only the card holder will have access to the private key,  and none else, not even the admin will have such access.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
So, let&#39;s see how we can use &lt;b&gt;PKCS#11&lt;/b&gt; to achieve this, we will be working on the same &quot;SmartCardTutorial&quot; class that we created in the previous article.&lt;/div&gt;
First, we will define a method that returns the first available connected Token :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; public Token getFirstAvailableToken() {  
     Token result = null;  
     try {  
 //Get all available slots  
       Slot[] slots = this.getTokenSlots();  
       if (slots.length != 0) {  
 //Get the first available token  
         result = slots[0].getToken();  
       }  
     } catch (TokenException ex) {  
       Logger.getLogger(SmartCardTutorial.class.getName()).log(Level.SEVERE, null, ex);  
     }  
     return result;  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Now we can define a method that generates the keypair on the card, and  returns the public key for later use. We will need to define templates  for both the private and public key that we want to generate : the  public exponent, the keys length etc...&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; public KeyPair generateKeyPair(Session session) throws Exception {  
     Mechanism keyPairGenerationMechanism = Mechanism.RSA_PKCS_KEY_PAIR_GEN;  
     RSAPublicKey rsaPublicKeyTemplate = new RSAPublicKey();  
     RSAPrivateKey rsaPrivateKeyTemplate = new RSAPrivateKey();  
     // set the general attributes for the public key  
     // We want keys of length 2048 bits  
     rsaPublicKeyTemplate.getModulusBits().setLongValue(new Long(2048));  
     // With public exponent equal 2^16 + 1  
     byte[] publicExponentBytes = {0x01, 0x00, 0x01};  
     rsaPublicKeyTemplate.getPublicExponent().setByteArrayValue(publicExponentBytes);  
     rsaPublicKeyTemplate.getToken().setBooleanValue(Boolean.TRUE);  
     byte[] id = new byte[20];  
     new Random().nextBytes(id);  
     rsaPublicKeyTemplate.getId().setByteArrayValue(id);  
     rsaPrivateKeyTemplate.getSensitive().setBooleanValue(Boolean.TRUE);  
     rsaPrivateKeyTemplate.getToken().setBooleanValue(Boolean.TRUE);  
     rsaPrivateKeyTemplate.getPrivate().setBooleanValue(Boolean.TRUE);  
     rsaPrivateKeyTemplate.getId().setByteArrayValue(id);  
     rsaPrivateKeyTemplate.getSign().setBooleanValue(Boolean.TRUE);  
     rsaPrivateKeyTemplate.getDecrypt().setBooleanValue(Boolean.TRUE);  
     rsaPublicKeyTemplate.getVerify().setBooleanValue(Boolean.TRUE);  
     rsaPublicKeyTemplate.getEncrypt().setBooleanValue(Boolean.TRUE);  
     rsaPublicKeyTemplate.getKeyType().setPresent(false);  
     rsaPublicKeyTemplate.getObjectClass().setPresent(false);  
     rsaPrivateKeyTemplate.getKeyType().setPresent(false);  
     rsaPrivateKeyTemplate.getObjectClass().setPresent(false);  
     KeyPair generatedKeyPair = session.generateKeyPair(keyPairGenerationMechanism, rsaPublicKeyTemplate, rsaPrivateKeyTemplate);  
     return generatedKeyPair;  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h4&gt;
Importing Certificates to your token&lt;/h4&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This method defined above generates and stores the private key on the  card, and returns the keypair, our next move would be generating a &lt;b&gt;CSR&lt;/b&gt; (&lt;b&gt;Certificate Signing Request&lt;/b&gt;)  with the generated public key, and sending it to our certificate  authority in order to get a digital certificate, and then store it in  our token. However the part about generating and signing the CSR is out  of scope, for now we will just create a dummy  &quot;getCertificateFromKeyPair&#39; method that returns an &lt;a href=&quot;http://download.oracle.com/javase/1.4.2/docs/api/java/security/cert/X509Certificate.html&quot; title=&quot;X509Certificate class&quot;&gt;X509Certificate&lt;/a&gt;, how to implement a real one will be explained in future articles about EJBCA web service API.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; public void storeCertificate(Session session, X509Certificate x509Certificate) throws Exception {  
     PublicKey publicKey = (PublicKey) x509Certificate.getPublicKey();  
     java.security.interfaces.RSAPublicKey rsaPublicKey = (java.security.interfaces.RSAPublicKey) publicKey;  
     RSAPrivateKey rsaPrivateKeySearchTemplate = new RSAPrivateKey();  
     byte[] modulus = iaik.pkcs.pkcs11.Util.unsignedBigIntergerToByteArray(rsaPublicKey.getModulus());  
     rsaPrivateKeySearchTemplate.getModulus().setByteArrayValue(modulus);  
     // We want to find objects on the card having the same properties as our template  
     session.findObjectsInit(rsaPrivateKeySearchTemplate);  
     // There is just 1 private key we stored, so we want just 1 result  
     Object[] foundKeyObjects = session.findObjects(1);  
     byte[] objectID = null;  
     if (foundKeyObjects.length &amp;gt; 0) {  
       //Get the found key  
       Key foundKey = (Key) foundKeyObjects[0];  
       //Get its ID  
       objectID = foundKey.getId().getByteArrayValue();  
     }  
     session.findObjectsFinal();  
     // create certificate object template  
     X509PublicKeyCertificate pkcs11X509PublicKeyCertificate = new X509PublicKeyCertificate();  
     Name subjectName = (Name) x509Certificate.getSubjectDN();  
     Name issuerName = (Name) x509Certificate.getIssuerDN();  
     String subjectCommonName = subjectName.getRDN(objectID.commonName);  
     String issuerCommonName = issuerName.getRDN(ObjectID.commonName);  
     char[] label = (subjectCommonName + &quot;&#39;s &quot;  
         + ((issuerCommonName != null) ? issuerCommonName + &quot; &quot; : &quot;&quot;) + &quot;Certificate&quot;).toCharArray();  
     byte[] newObjectID;  
     // if we need a new object ID, create one  
     if (objectID == null) {  
       newObjectID = ((java.security.interfaces.RSAPublicKey) publicKey).getModulus().toByteArray();  
       MessageDigest digest = MessageDigest.getInstance(&quot;SHA-1&quot;);  
       newObjectID = digest.digest(newObjectID);  
     } else {  
       // we already got one from a corresponding private key before  
       newObjectID = objectID;  
     }  
     byte[] encodedSubject = ((Name) currentCertificate.getSubjectDN()).getEncoded();  
     byte[] encodedIssuer = ((Name) currentCertificate.getIssuerDN()).getEncoded();  
     pkcs11X509PublicKeyCertificate.getToken().setBooleanValue(Boolean.TRUE);  
     pkcs11X509PublicKeyCertificate.getPrivate().setBooleanValue(Boolean.FALSE);  
     pkcs11X509PublicKeyCertificate.getLabel().setCharArrayValue(label);  
     pkcs11X509PublicKeyCertificate.getId().setByteArrayValue(newObjectID);  
     pkcs11X509PublicKeyCertificate.getSubject().setByteArrayValue(encodedSubject);  
     pkcs11X509PublicKeyCertificate.getIssuer().setByteArrayValue(encodedIssuer);  
     pkcs11X509PublicKeyCertificate.getSerialNumber().setByteArrayValue(serialNumber);  
     pkcs11X509PublicKeyCertificate.getValue().setByteArrayValue(currentCertificate.getEncoded());  
     //And finaly store the certificate on the token  
     session.createObject(pkcs11X509PublicKeyCertificate);  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
That&#39;s pretty much it for today, i hope it was helpful, and will continue shortly with the &quot;&lt;b&gt;smart card Tutorials&lt;/b&gt;&quot; series with more advanced topics. Until then, my best regards everyone.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/4172974298859584293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/11/smart-card-tutorial-part-2.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/4172974298859584293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/4172974298859584293'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/11/smart-card-tutorial-part-2.html' title='smart Card tutorial : Part 2'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-4094909559394965069</id><published>2010-11-19T09:21:00.000-08:00</published><updated>2012-07-28T11:45:10.261-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="certificate Authority"/><category scheme="http://www.blogger.com/atom/ns#" term="digital Certificates"/><category scheme="http://www.blogger.com/atom/ns#" term="PKCS#11"/><category scheme="http://www.blogger.com/atom/ns#" term="PKI"/><category scheme="http://www.blogger.com/atom/ns#" term="RSA"/><category scheme="http://www.blogger.com/atom/ns#" term="smart card"/><category scheme="http://www.blogger.com/atom/ns#" term="X509"/><title type='text'>smart Card tutorial : Part 1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
When your application handles or performs sensitive data  or operations, security becomes a major concern, which is why some  companies decides to use Strong Authentication for their applications,  also known as &#39;two factors authentication&#39; : one thing that you have  (the &lt;b&gt;smart Card&lt;/b&gt;, or &lt;b&gt;USB token&lt;/b&gt;), and one that you know (the PIN or password).&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This article will be the start of a series of tutorials about &lt;b&gt;smart cards&lt;/b&gt;  (USB Tokens are readerless smartcards, so the same applies) : how to  access, manage, generate keys etc... at the end of the articles, tou  should be able to write smart-card-based applications for  authentication, digital signatures and PIN/PUK management.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
All the code will be using Standard interfaces to communicate with the  smart card, no vendor specific one, so it should work with any kind of  equipment you have. In other words, we will be using &lt;b&gt;PKCS#11&lt;/b&gt;, the Cryptographic Token Interface Standard.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In order to use PKCS#11, you can either write your own wrappers using  Java Native Interface (JNI) to export the native functions to java (will  write a tutorial about that later), or you can download a free open  source wrapper like &lt;a href=&quot;http://jce.iaik.tugraz.at/sic/Products/Core-Crypto-Toolkits/PKCS-11-Wrapper&quot; title=&quot;iaik PKCS#11 Wrappers&quot;&gt;iaik PKCS#11 Wrappers&lt;/a&gt;, which we will be using in this tutorial.&lt;/div&gt;
&lt;br /&gt;
Requirements for this tutorial :&lt;br /&gt;
&lt;blockquote&gt;
- A smart Card or USB Token of course.&lt;br /&gt;
- PKCS#11 Wrappers for java.&lt;br /&gt;
- PKCS#11 implementation library.&lt;/blockquote&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
So, first things first, start by downloading the PKCS#11 wrappers from &lt;a href=&quot;http://jce.iaik.tugraz.at/sic/Products/Core-Crypto-Toolkits/PKCS-11-Wrapper&quot; title=&quot;iaik PKCS#11 wrappers&quot;&gt;iaik web site&lt;/a&gt;.  For the implementation librarie you will need to get it from your  vendor, it&#39;s a .dll for windows, or a .so for linux, in my case i will  be working with SafeNet Etoken Pro, so the library name is  &quot;eTPKCS11.dll&quot;.&lt;/div&gt;
&lt;br /&gt;
Let&#39;s start by creating our class &quot;SmartCardTutorial&quot; with a constructor taking the library path as arg :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; public class SmartCardTutorial {  
   private Module pkcs11Module;  
   public SmartCardTutorial(String librarayPath) {  
     try {  
       pkcs11Module = Module.getInstance(librarayPath);  
       pkcs11Module.initialize(null);  
     } catch (IOException ex) {  
       Logger.getLogger(SmartCardTutorial.class.getName()).log(Level.SEVERE, null, ex);  
     } catch (TokenException ex) {  
       Logger.getLogger(SmartCardTutorialclass.getName()).log(Level.SEVERE, null, ex);  
     }  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
in the code above we instantiated pkcs11Module, which will provide us  informations about the connected smart cards/Tokens that we can access.  Now, we will create a method that returns a list of all available slots,  as we are not interested in empty slots, we will specify that we only  want these with a token present :&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; public Slot[] getTokenSlots() throws TokenException {  
     return pkcs11Module.getSlotList(Module.SlotRequirement.TOKEN_PRESENT);  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Now let&#39;s write a simple method that will print on the console the  informations about the present token in the first slot, like its Serial  number, vendor etc...&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; public void printTokenInfos() throws TokenException {  
     Slot[] slots = getTokenSlots();  
     if (slots.length == 0) { //No tokens connected  
       System.out.println(&quot;Sorry, Couldn&#39;t find any token&quot;);  
     } else {  
       //Let&#39;s get the first slot  
       Slot selectedSlot = slots[0];  
       //Let&#39;s get the connected token  
       Token token = selectedSlot.getToken();  
       //Get the token infos  
       TokenInfo tokenInfo = token.getTokenInfo();  
       System.out.println(&quot;Token : &quot; + tokenInfo.getLabel());  
       System.out.println(&quot;Vendor : &quot; + tokenInfo.getManufacturerID());  
       System.out.println(&quot;Serial Number : &quot; + tokenInfo.getSerialNumber());  
     }  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
That&#39;s it for today folks, in the next article i will explain how to  perform more advanced manipulation, like on-card RSA key-pair  generation, storing and retrieving X509 certificates etc...&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/4094909559394965069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/11/smart-card-tutorial-part-1.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/4094909559394965069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/4094909559394965069'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/11/smart-card-tutorial-part-1.html' title='smart Card tutorial : Part 1'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-3377262672529837785</id><published>2010-11-19T09:18:00.000-08:00</published><updated>2010-12-12T09:33:48.284-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jndi"/><category scheme="http://www.blogger.com/atom/ns#" term="ldap"/><category scheme="http://www.blogger.com/atom/ns#" term="openldap"/><title type='text'>Java JNDI Tutoriel : Ldap query</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Our topic of discussion today will be &lt;b&gt;JNDI&lt;/b&gt; (&lt;b&gt;Java Naming and Directory Interface&lt;/b&gt;), which is a standard way to query directories for different kind of available informations.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;We will see how you can use &lt;b&gt;Java&lt;/b&gt; to interact with &lt;b&gt;OpenLdap&lt;/b&gt; or any other directory (like &lt;b&gt;Apache&lt;/b&gt; &lt;b&gt;OpenDS&lt;/b&gt; etc...).&lt;/div&gt;In order to connect to an &lt;b&gt;ldap &lt;/b&gt;directory server we will need to know :&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;The server url (in our case localhost)&lt;/li&gt;
&lt;li&gt;The authentication used : Simple, Digest etc...&lt;/li&gt;
&lt;li&gt;the base DN, or the root element.&lt;/li&gt;
&lt;li&gt;Bind DN, the user we will connect to the directory as.&lt;/li&gt;
&lt;li&gt;Bind password.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;so let&#39;s add these fields to our class : &lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;   private String serverUrl = &quot;ldap://localhost:389&quot;;  
   private String authentication = &quot;simple&quot;;  
   private String baseDN = &quot;dc=myComp,dc=net&quot;;  
   private String bindDN = &quot;cn=Admin&quot;;  
   private String bindPassword = &quot;password&quot;;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;We will need to get a DirContext Object which allows us to contact &lt;b&gt;Ldap&lt;/b&gt; for adding or querying users or other form of entries, so lets add that field as well : &lt;/div&gt;&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; private DirContext ldapContext;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
now, inside the init() method, let&#39;s establish a connection to the ldap server, and get our &lt;b&gt;DirContext&lt;/b&gt; :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt;     Hashtable ldapEnv = new Hashtable(11);  
     ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, &quot;com.sun.jndi.ldap.LdapCtxFactory&quot;);  
     ldapEnv.put(Context.PROVIDER_URL, serverUrl);  
     ldapEnv.put(Context.SECURITY_AUTHENTICATION, authentication);  
     ldapEnv.put(Context.SECURITY_PRINCIPAL, bindDN + &quot;,&quot; + baseDN);  
     ldapEnv.put(Context.SECURITY_CREDENTIALS, bindPassword);  
     ldapContext = new InitialDirContext(ldapEnv);  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;Now that we got our DirContext, let&#39;s query the directory for entries of  class inetOrgPerson, of course you can change the query to get whatever  entry you want :&lt;/div&gt;&lt;br /&gt;
&lt;pre class=&quot;CICodeFormatter&quot;&gt;&lt;code class=&quot;CICodeFormatter&quot;&gt; String query = &quot;(objectclass=inetOrgPerson)&quot;;  
     SearchControls ctrl = new SearchControls();  
     //Search the sub tree  
     ctrl.setSearchScope(SearchControls.SUBTREE_SCOPE);  
     //Return all attributes  
     ctrl.setReturningAttributes(null);  
     //Query the directory  
     NamingEnumeration enumeration = ldapContext.search(baseDN, query, ctrl);  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
There we go, we got now an enumeration with all the search results our query returned.</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/3377262672529837785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/11/java-jndi-tutoriel-ldap-query.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3377262672529837785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3377262672529837785'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/11/java-jndi-tutoriel-ldap-query.html' title='Java JNDI Tutoriel : Ldap query'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-89604024692242765</id><published>2010-11-19T06:52:00.000-08:00</published><updated>2012-07-28T11:45:51.097-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="certificate Authority"/><category scheme="http://www.blogger.com/atom/ns#" term="digital Certificates"/><category scheme="http://www.blogger.com/atom/ns#" term="EJBCA"/><category scheme="http://www.blogger.com/atom/ns#" term="PKI"/><title type='text'>EJBCA : a Step By Step install Guide</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
As mentionned in my previous Article &lt;a href=&quot;http://surjava.blogspot.com/2010/11/presenting-ejbca.html&quot;&gt;Presenting EJBCA&lt;/a&gt;, this article will explain how to have an In-House &lt;b&gt;Certificate Authority&lt;/b&gt; up and running using &lt;b&gt;EJBCA&lt;/b&gt;. &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;EJBCA&lt;/b&gt; needs a couple of componenets to be installed in order for it to work, we will be using :&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;EJBCA&lt;/b&gt; 3.9.5&lt;/li&gt;
&lt;li&gt;Mysql Server 5&lt;/li&gt;
&lt;li&gt;Apache Ant 1.7&lt;/li&gt;
&lt;li&gt;OpenJDK 6 JDK&lt;/li&gt;
&lt;li&gt;JCE (Java Cryptographique Extension) 6&lt;/li&gt;
&lt;li&gt;JBoss Application Server 4.4&lt;/li&gt;
&lt;li&gt;MySQL Java Connector 5 &lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;We will be using Ubuntu Server for the install.            &lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4&gt;
Installing and configuring MySQL Server&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
install MySQL Server using the following Shell command :&lt;br /&gt;
&lt;blockquote&gt;
$&amp;gt;sudo apt-get install mysql-server &lt;/blockquote&gt;
&lt;br /&gt;
once the install ends, open MySQL command line interface, and connect as the root user :&lt;br /&gt;
&lt;blockquote&gt;
#&amp;gt;mysql -u root -p&lt;br /&gt;
#&amp;gt;Password: (enter your root password)&lt;/blockquote&gt;
&lt;br /&gt;
now we will create a database for &lt;b&gt;EJBCA&lt;/b&gt; : &lt;br /&gt;
&lt;blockquote&gt;
Mysql&amp;gt;CREATE database ejbca;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
create a new user that will be used by ejbca to connect to MySQL, and authorize him access on ejbca database :&lt;/div&gt;
&lt;blockquote&gt;
Mysql&amp;gt;USE ejbca;&lt;br /&gt;
Mysql&amp;gt;CREATE user &#39;ejbca&#39;@&#39;localhost&#39; IDENTIFIED BY  &#39;ejbca&#39;;&lt;br /&gt;
Mysql&amp;gt;GRANT SELECT,UPDATE,DELETE,CREATE on ejbca.* to &#39;ejbca&#39;@&#39;localhost&#39;;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4&gt;
Installing Apache Ant&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
install Apache Ant using the following Shell command :&lt;br /&gt;
&lt;blockquote&gt;
$&amp;gt;sudo apt-get install ant &lt;/blockquote&gt;
That&#39;s all there is to installing ANT :).&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4&gt;
Installing JDK 6&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
for JDK you can either install sun jdk using &lt;br /&gt;
&lt;blockquote&gt;
$&amp;gt;sudo apt-get install java-6-jdk-sun &lt;/blockquote&gt;
Or install openJDK :&lt;br /&gt;
&lt;blockquote&gt;
$&amp;gt;sudo apt-get install openjdk-6-jdk&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4&gt;
Installing JCE&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
EJBCA needs to be able to generate keys of lengths greater than usualy supported by &lt;b&gt;JCE&lt;/b&gt;, so you will need to download &lt;a href=&quot;http://www.oracle.com/technetwork/java/javase/downloads/index.html&quot; title=&quot;jce&quot;&gt;Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6&lt;/a&gt;, and extract it to your &quot;jre/lib/security/&quot; in JAVA_HOME Directory.&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4&gt;
Installing MySQL Java Connector&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Download the connector from &lt;a href=&quot;http://www.mysql.com/downloads/connector/j/&quot; title=&quot;MySQL Java Connector&quot;&gt;MySQL Java Connector download page&lt;/a&gt;, and keep it until we begin installing JBoss Application Server.&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4&gt;
Installing &lt;b&gt;JBoss Application Server&lt;/b&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Download JBoss AS from &lt;a href=&quot;http://www.jboss.org/jbossas/downloads&quot; title=&quot;JBoss AS&quot;&gt;JBoss AS Download Page&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Unzip the file downloaded, and copy it to &quot;/opt/&quot;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Copy the MySQL Java connector previously downloaded to &quot;/opt/jboss/server/default/lib&quot;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
create a user and group &quot;jboss&quot;, with working directory &quot;/opt/jboss&quot; using the following Shell commands :&lt;/div&gt;
&lt;blockquote&gt;
#&amp;gt;groupadd jboss&lt;br /&gt;
#&amp;gt;useradd -d /opt/jboss -g jboss jboss&lt;br /&gt;
#&amp;gt;passwd jboss&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4&gt;
Setting up environment variables&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
create a file &#39;ejbca.sh&#39; in &#39;/etc/profile.d&#39; using :&lt;br /&gt;
&lt;blockquote&gt;
#&amp;gt;touch /etc/profile.d/ejbca.sh&lt;/blockquote&gt;
edit the file and add these lines to it :&lt;br /&gt;
&lt;blockquote&gt;
#!/bin/sh&lt;br /&gt;
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk&lt;br /&gt;
export JBOSS_HOME=/opt/jboss&lt;br /&gt;
export APPSRV_HOME=/opt/jboss&lt;br /&gt;
export ANT_OPTS=-Xmx512m&lt;br /&gt;
export JBOSS_HOST=0.0.0.0&lt;br /&gt;
export ANT_HOME=/opt/ant&lt;br /&gt;
export EJBCA_HOME=/opt/ejbca&lt;br /&gt;
export JBOSS_CONSOLE=/var/log/jboss.log&lt;br /&gt;
export JBOSSUS=jboss&lt;br /&gt;
export JBOSS_SERVER=default&lt;br /&gt;
export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH&lt;/blockquote&gt;
make the file executable using : &lt;br /&gt;
&lt;blockquote&gt;
#&amp;gt;chmod +x /etc/profile.d/ejbca.sh&lt;/blockquote&gt;
save the file, logout, and relogin.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4&gt;
Installing EJBCA&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Download EJBCA from &lt;a href=&quot;http://www.ejbca.org/download.html&quot; title=&quot;EJBCA Download Link&quot;&gt;EJBCA Download Page&lt;/a&gt;, unzip it to &#39;/opt/ejbca&#39;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
rename the file &#39;database.properties.sample&#39; in the conf directory to  &#39;database.properties&#39;, and edit its properties to match the database of  your choice (in our case MySQL).&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Make sure &lt;b&gt;JBoss&lt;/b&gt; is not running, then run these commands : &lt;/div&gt;
&lt;blockquote&gt;
#&amp;gt;cd $EJBCA_HOME&lt;br /&gt;
#&amp;gt;ant clean&lt;br /&gt;
#&amp;gt;ant bootstrap&lt;/blockquote&gt;
Now start JBoss AS :&lt;br /&gt;
&lt;blockquote&gt;
#&amp;gt;cd $JBOSS_HOME/bin&lt;br /&gt;
#&amp;gt;chmod +x run.sh&lt;br /&gt;
#&amp;gt;./run.sh&lt;/blockquote&gt;
once JBoss is running, start EJBCA Install task :&lt;br /&gt;
&lt;blockquote&gt;
#&amp;gt;cd $EJBCA_HOME&lt;br /&gt;
#&amp;gt;ant install&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
once the install finished, and you get the &quot;BUILD SUCCESSEFUL&quot; message, shutdown JBoss, and start the deploy : &lt;/div&gt;
&lt;blockquote&gt;
#&amp;gt;$JBOSS_HOME/bin/shutdown.sh -s&lt;br /&gt;
#&amp;gt;cd $EJBCA_HOME&lt;br /&gt;
#&amp;gt;ant deploy&lt;/blockquote&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
after the deploy ends, start JBoss, and EJBCA should be up and running at http://localhost:8080/ejbca.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In order to access the administration interface, you will need to import the superadmin.p12 generated in the &lt;b&gt;p12&lt;/b&gt; directory of your &lt;b&gt;EJBCA &lt;/b&gt;install.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/89604024692242765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/11/ejbca-step-by-step-install-guide.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/89604024692242765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/89604024692242765'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/11/ejbca-step-by-step-install-guide.html' title='EJBCA : a Step By Step install Guide'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-3716103414614848406</id><published>2010-11-19T06:41:00.000-08:00</published><updated>2010-12-12T09:34:20.866-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="certificate Authority"/><category scheme="http://www.blogger.com/atom/ns#" term="digital Certificates"/><category scheme="http://www.blogger.com/atom/ns#" term="EJBCA"/><category scheme="http://www.blogger.com/atom/ns#" term="PKI"/><title type='text'>Presenting EJBCA</title><content type='html'>Your enterprise decided recently to start using &lt;b&gt;digital Certificates&lt;/b&gt; for authentication, digital signatures, Server authentication etc... in other words, you need a &lt;b&gt;Certificate Authority&lt;/b&gt;(&lt;b&gt;CA&lt;/b&gt;) in order to deliver certificates for your servers and users.&lt;br /&gt;
&lt;br /&gt;
Of course, you can choose to buy certificates from known vendors like  VerSign,Thawte etc... but you will need to pay for every certificate a  user or a server needs! a better approach would be hosting you own  In-House &lt;b&gt;certificate Authority&lt;/b&gt;, this way you can issue as many certificates as you need.&lt;br /&gt;
Now that you decided to host your own &lt;b&gt;CA&lt;/b&gt;,have your own &lt;b&gt;Public Key Infrastructure&lt;/b&gt; (&lt;b&gt;PKI&lt;/b&gt;),&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;you need to  be able to manage the certificates : delivering, revoking etc... for  that you can either reinvent the wheel, and create your own web  application for this purpose, using OpenSSL + Batches. Or, you can use  an open source Certificate Authority Management Solution like &lt;b&gt;EJBCA&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;EJBCA&lt;/b&gt; is an enterprise class &lt;b&gt;PKI &lt;/b&gt;Certificate Authority built on &lt;b&gt;J2EE&lt;/b&gt;  technology. It is a robust, high performance, platform independent,  flexible, and component based CA to be used stand-alone or integrated in  other &lt;b&gt;J2EE&lt;/b&gt; applications. &lt;br /&gt;
&lt;br /&gt;
The next Article will be a step by step guide on how to set up &lt;b&gt;EJBCA&lt;/b&gt;.</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/3716103414614848406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/11/presenting-ejbca.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3716103414614848406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3716103414614848406'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/11/presenting-ejbca.html' title='Presenting EJBCA'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1864133399285459995.post-3902662202681505877</id><published>2010-11-19T06:37:00.000-08:00</published><updated>2010-11-19T06:37:20.351-08:00</updated><title type='text'>A new Software Engineering Blog</title><content type='html'>Hi and welcome everyone,&lt;br /&gt;
&lt;br /&gt;
My name is Haltout Sohaib, a Moroccan Software Engineer, software  building, engineering and security auditing always been my passion,  although being a student right now, i did work as freelancer a couple of  times, especially security related jobs.&lt;br /&gt;
&lt;br /&gt;
My friends, and people i worked with, or helped, have always recommended  me to start a blog, but never really had time to for various reasons,  but decided finally to start one, because i believe that if we are where  we stand today, it&#39;s all thanks to sharing knowledge, it&#39;s all about  sharing!&lt;br /&gt;
&lt;br /&gt;
So, starting today, i will write and share tricks, best practices, tutoriels, guides etc... on various topics like :&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;Security&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Software Engineering &lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Public Key Infrastructure&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;Enterprise Content Management (&lt;b&gt;ECM&lt;/b&gt;), especially &lt;b&gt;Alfresco&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;J2ee&lt;/b&gt;, &lt;b&gt;JEE5&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Spring Security&lt;/b&gt;, &lt;b&gt;MVC&lt;/b&gt; ....&lt;/li&gt;
&lt;/ul&gt;And other frameworks, technologies i worked with.&lt;br /&gt;
&lt;br /&gt;
If you need help with a project you&#39;re working on, or have a question feel free to contact me at : haltout.sohaib@gmail.com .&lt;br /&gt;
&lt;br /&gt;
I&#39;m currently transferring messages from my old blog hsohaib.com to this one.</content><link rel='replies' type='application/atom+xml' href='http://surjava.blogspot.com/feeds/3902662202681505877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://surjava.blogspot.com/2010/11/new-software-engineering-blog.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3902662202681505877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1864133399285459995/posts/default/3902662202681505877'/><link rel='alternate' type='text/html' href='http://surjava.blogspot.com/2010/11/new-software-engineering-blog.html' title='A new Software Engineering Blog'/><author><name>Sohaib Haltout</name><uri>http://www.blogger.com/profile/07522992981374303727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='30' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8D12wXAQDNtN9d41j9Mf5t8XOvKDwJzTVxLm3vy1OCPZDOSLauU4d9Ai6hJk7-2_cDK1GYvdDGJaayqAik3atbrT6LnYLzTuuivNxhbErQlcDrNgzJfecgs_XwMjLA/s220/pic.gif'/></author><thr:total>1</thr:total></entry></feed>