<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>src/groovy/cr/co/arquetipos/password/KeyCache.groovy</filename>
    </added>
    <added>
      <filename>src/groovy/cr/co/arquetipos/password/PasswordTools.groovy</filename>
    </added>
    <added>
      <filename>test/integration/SimplePasswordManagerServiceTests.groovy</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,9 +4,6 @@
     &lt;facet type=&quot;Grails&quot; name=&quot;Grails&quot;&gt;
       &lt;configuration /&gt;
     &lt;/facet&gt;
-    &lt;facet type=&quot;Groovy&quot; name=&quot;Groovy&quot;&gt;
-      &lt;configuration /&gt;
-    &lt;/facet&gt;
   &lt;/component&gt;
   &lt;component name=&quot;NewModuleRootManager&quot; inherit-compiler-output=&quot;true&quot;&gt;
     &lt;exclude-output /&gt;</diff>
      <filename>crypto.iml</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,4 @@
 import cr.co.arquetipos.crypto.Blowfish
-import cr.co.arquetipos.crypto.PasswordTools
-
 /*
     Simple record-based storage for encrypted data.   This was created with
     the intention of storing encrypted passwords, so there are some design
@@ -17,6 +15,7 @@ import cr.co.arquetipos.crypto.PasswordTools
     assigned ids: http://jira.codehaus.org/browse/GRAILS-1984
  */
 class EncryptedData {
+
     String id
     String dataItem
 
@@ -24,7 +23,7 @@ class EncryptedData {
     private String tempPassword = ''
 
 
-    static transients = ['data', 'password']
+    static transients = ['decryptedData', 'password']
 
     static constraints = {
         id(size:1..32)
@@ -78,7 +77,7 @@ class EncryptedData {
     }
 
 
-    public getData()
+    public getDecryptedData()
     {
         if (!tempData)
         {
@@ -88,7 +87,7 @@ class EncryptedData {
         return tempData
     }
 
-    public setData(String newData)
+    public setDecryptedData(String newData)
     {
         assert tempPassword, 'Unknown password, assign it first'
         tempData = newData
@@ -102,5 +101,14 @@ class EncryptedData {
         tempPassword = ''
         tempData = ''
     }
-    
+
+    static EncryptedData getOrCreate(java.lang.String theId) {
+        EncryptedData item = EncryptedData.get(theId)
+        if (!item)
+        {
+            item = new EncryptedData()
+            item.id = theId
+        }
+        return item
+    }
 }</diff>
      <filename>grails-app/domain/EncryptedData.groovy</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,7 @@ passwords.
   &lt;resources&gt;
     &lt;resource&gt;UrlMappings&lt;/resource&gt;
     &lt;resource&gt;EncryptedData&lt;/resource&gt;
+    &lt;resource&gt;SimplePasswordManagerService&lt;/resource&gt;
     &lt;resource&gt;HexCodec&lt;/resource&gt;
   &lt;/resources&gt;
 &lt;/plugin&gt;
\ No newline at end of file</diff>
      <filename>plugin.xml</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ class EncryptedDataTests extends GroovyTestCase {
         def cipher = new EncryptedData()
         cipher.id = 'newvalue'
         cipher.password = 'supersecret'
-        cipher.data = &quot;Don't tell anyone&quot;
+        cipher.decryptedData = &quot;Don't tell anyone&quot;
 
         assert cipher.save()
 
@@ -12,13 +12,13 @@ class EncryptedDataTests extends GroovyTestCase {
         shouldFail()
         {
             // Fails because a password has not been set
-            cipher.data = &quot;New data&quot;
+            cipher.decryptedData = &quot;New data&quot;
         }
 
         shouldFail(org.springframework.orm.hibernate3.HibernateSystemException)
         {
             cipher.password = 'newpass'
-            cipher.data = 'New data'
+            cipher.decryptedData = 'New data'
             assert cipher.save() // Fails because we haven't set an ID
         }
     }
@@ -31,17 +31,17 @@ class EncryptedDataTests extends GroovyTestCase {
         def cipher = new EncryptedData()
         cipher.id = 'secret-message'
         cipher.password = password
-        cipher.data = message
+        cipher.decryptedData = message
         assert cipher.save()
 
-        assertEquals cipher.data, message
+        assertEquals cipher.decryptedData, message
 
         // Forget the temporary passwords
         cipher.lockDown()
 
         shouldFail(AssertionError)
         {
-            def str = cipher.data // Can't get the data without the password    
+            def str = cipher.decryptedData // Can't get the data without the password
         }
 
         shouldFail(AssertionError)
@@ -50,7 +50,7 @@ class EncryptedDataTests extends GroovyTestCase {
         }
 
         cipher.decrypt(password)
-        assertEquals cipher.data, message
+        assertEquals cipher.decryptedData, message
         // Lock it down before saving it to ensure we're not carrying over any unnecessary data
         cipher.lockDown()
         assert cipher.save()
@@ -64,6 +64,6 @@ class EncryptedDataTests extends GroovyTestCase {
             loaded.decrypt('Selina XoXo')
         }
         cipher.decrypt(password)
-        assertEquals loaded.data, message
+        assertEquals loaded.decryptedData, message
     }
 }</diff>
      <filename>test/integration/EncryptedDataTests.groovy</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-import cr.co.arquetipos.crypto.PasswordTools
+import cr.co.arquetipos.password.PasswordTools
 
 class PasswordToolsTests extends GroovyTestCase {
 </diff>
      <filename>test/unit/PasswordToolsTests.groovy</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 import cr.co.arquetipos.crypto.PGP
-import cr.co.arquetipos.crypto.PasswordTools
+import cr.co.arquetipos.password.PasswordTools
 
 class PgpTests extends GroovyTestCase {
 </diff>
      <filename>test/unit/PgpTests.groovy</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>src/groovy/cr/co/arquetipos/crypto/PasswordTools.groovy</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>f4977a480fc2d84388c00274f546d34b2e5647f2</id>
    </parent>
  </parents>
  <author>
    <name>Ricardo J. Mendez</name>
    <email>ricardo@arquetipos.co.cr</email>
  </author>
  <url>http://github.com/ricardojmendez/grails-encryption/commit/5ce79096ef67d26fb9cc2b9840326caf8bb84033</url>
  <id>5ce79096ef67d26fb9cc2b9840326caf8bb84033</id>
  <committed-date>2008-12-26T10:16:45-08:00</committed-date>
  <authored-date>2008-12-26T10:16:45-08:00</authored-date>
  <message>Miscellaneous changes:
- Renamed EncryptedData member 'data' to more explicit 'decryptedData'
- Moved PasswordTools to package cr.co.arquetipos.password
- Created SimplePasswordManagerService. Work in progress, needs tests</message>
  <tree>4d61d0814c68b95940d976438a2582aca155feb0</tree>
  <committer>
    <name>Ricardo J. Mendez</name>
    <email>ricardo@arquetipos.co.cr</email>
  </committer>
</commit>
