diff --git a/license/.gitignore b/license/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a65a85e96bd7fa720e9d1d493b5b24053b8d007f --- /dev/null +++ b/license/.gitignore @@ -0,0 +1,2 @@ +/ant-target +/bin diff --git a/license/.settings/.svn/all-wcprops b/license/.settings/.svn/all-wcprops deleted file mode 100644 index 01ae42a36b0f2917256ea9a15562f32eaaa4ca1a..0000000000000000000000000000000000000000 --- a/license/.settings/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 73 -/projects/!svn/ver/353/com.patrikdufresne.license/trunk/license/.settings -END -org.eclipse.jdt.core.prefs -K 25 -svn:wc:ra_dav:version-url -V 100 -/projects/!svn/ver/353/com.patrikdufresne.license/trunk/license/.settings/org.eclipse.jdt.core.prefs -END diff --git a/license/.settings/.svn/entries b/license/.settings/.svn/entries deleted file mode 100644 index c267b72aae02a4a056a935a102e01a2838bb86ac..0000000000000000000000000000000000000000 --- a/license/.settings/.svn/entries +++ /dev/null @@ -1,69 +0,0 @@ -10 - -dir -357 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/license/.settings -https://svn.patrikdufresne.com/projects - - - -2012-04-04T16:27:30.286363Z -353 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -org.eclipse.jdt.core.prefs -file - - - - -2012-04-03T22:41:31.000000Z -24fd35997c3402c5b940e3c47fd7a898 -2012-04-04T16:27:30.286363Z -353 -ikus060 - - - - - - - - - - - - - - - - - - - - - -617 - diff --git a/license/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base b/license/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base deleted file mode 100644 index 906a73619e0e06633aaf44d283b8b1f721a2a967..0000000000000000000000000000000000000000 --- a/license/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Apr 03 18:41:31 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/license/.svn/all-wcprops b/license/.svn/all-wcprops deleted file mode 100644 index 41c783684287786f8580145748bab97a07299e00..0000000000000000000000000000000000000000 --- a/license/.svn/all-wcprops +++ /dev/null @@ -1,57 +0,0 @@ -K 26 -svn:wc:ra_dav:activity-url -V 19 -/projects/!svn/act/ -K 25 -svn:wc:ra_dav:version-url -V 63 -/projects/!svn/ver/358/com.patrikdufresne.license/trunk/license -END -BSD -K 25 -svn:wc:ra_dav:version-url -V 67 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/BSD -END -build.xml -K 25 -svn:wc:ra_dav:version-url -V 73 -/projects/!svn/ver/353/com.patrikdufresne.license/trunk/license/build.xml -END -MIT -K 25 -svn:wc:ra_dav:version-url -V 67 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/MIT -END -version.properties -K 25 -svn:wc:ra_dav:version-url -V 82 -/projects/!svn/ver/356/com.patrikdufresne.license/trunk/license/version.properties -END -.project -K 25 -svn:wc:ra_dav:version-url -V 72 -/projects/!svn/ver/353/com.patrikdufresne.license/trunk/license/.project -END -README -K 25 -svn:wc:ra_dav:version-url -V 70 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/README -END -Apache -K 25 -svn:wc:ra_dav:version-url -V 70 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/Apache -END -.classpath -K 25 -svn:wc:ra_dav:version-url -V 74 -/projects/!svn/ver/353/com.patrikdufresne.license/trunk/license/.classpath -END diff --git a/license/.svn/dir-prop-base b/license/.svn/dir-prop-base deleted file mode 100644 index 35db975413d991bb10ede9895f03d1c8e09bfa54..0000000000000000000000000000000000000000 --- a/license/.svn/dir-prop-base +++ /dev/null @@ -1,6 +0,0 @@ -K 10 -svn:ignore -V 11 -ant-target - -END diff --git a/license/.svn/entries b/license/.svn/entries deleted file mode 100644 index 6788538701878a4865edc539e1daad0b0049e89d..0000000000000000000000000000000000000000 --- a/license/.svn/entries +++ /dev/null @@ -1,342 +0,0 @@ -10 - -dir -358 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/license -https://svn.patrikdufresne.com/projects - - - -2012-04-04T19:55:25.868997Z -358 -ikus060 -has-props - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 -immediates -() - -.classpath -file -357 - - - -2012-04-03T22:41:31.000000Z -0feefca3562e5167ed8224d805b3b922 -2012-04-04T16:27:30.286363Z -353 -ikus060 - - - - - - - - - - - - - - - - - - - - - -295 - -.project -file -357 - - - -2012-04-03T23:11:41.000000Z -73ab260e8c61166d65a8273391e8e3bb -2012-04-04T16:27:30.286363Z -353 -ikus060 - - - - - - - - - - - - - - - - - - - - - -366 - -.settings -dir - -Apache -file -359 - - - -2012-04-18T19:13:20.000000Z -175792518e4ac015ab6696d16c4f607e -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -11357 - -BSD -file -359 - - - -2012-04-18T19:15:04.000000Z -8e6d32ff6469dc7bd8ac9f5067680c4a -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -1461 - -LICENSE -file -359 - - - - - - - - - - - - - - - - - - - -deleted - -MIT -file -359 - - - -2012-04-18T18:57:17.000000Z -73a6092c9e82587a0fddc29d0c46d25d -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -1066 - -README -file -359 - - - -2012-04-18T19:16:09.000000Z -ca551f12a9e00adbb84851be4d0daef3 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -1095 - -build.xml -file -357 - - - -2012-04-04T15:51:40.000000Z -967cdacc1e8d02cdddce34ca374b1c14 -2012-04-04T16:27:30.286363Z -353 -ikus060 - - - - - - - - - - - - - - - - - - - - - -2034 - -lib -dir - -src -dir - -version.properties -file -357 - - - -2012-04-04T19:49:12.000000Z -1fc6195b97f3e30e1fb4493dfeafa9b5 -2012-04-04T19:52:41.472047Z -356 -ikus060 - - - - - - - - - - - - - - - - - - - - - -51 - diff --git a/license/.svn/text-base/.classpath.svn-base b/license/.svn/text-base/.classpath.svn-base deleted file mode 100644 index 18d70f02cb8eeded3bb20b75f0cd29bb66157990..0000000000000000000000000000000000000000 --- a/license/.svn/text-base/.classpath.svn-base +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/license/.svn/text-base/.project.svn-base b/license/.svn/text-base/.project.svn-base deleted file mode 100644 index 9c4301f36027b7235c5b3daf0ea3479da671b2fc..0000000000000000000000000000000000000000 --- a/license/.svn/text-base/.project.svn-base +++ /dev/null @@ -1,17 +0,0 @@ - - - license - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/license/.svn/text-base/Apache.svn-base b/license/.svn/text-base/Apache.svn-base deleted file mode 100644 index 7a4a3ea2424c09fbe48d455aed1eaa94d9124835..0000000000000000000000000000000000000000 --- a/license/.svn/text-base/Apache.svn-base +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/license/.svn/text-base/BSD.svn-base b/license/.svn/text-base/BSD.svn-base deleted file mode 100644 index 79684c5c313344b7b295f82b8c4a184fc7c8c2ad..0000000000000000000000000000000000000000 --- a/license/.svn/text-base/BSD.svn-base +++ /dev/null @@ -1,24 +0,0 @@ - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those -of the authors and should not be interpreted as representing official policies, -either expressed or implied, of the FreeBSD Project. \ No newline at end of file diff --git a/license/.svn/text-base/MIT.svn-base b/license/.svn/text-base/MIT.svn-base deleted file mode 100644 index 4d644be563e69d755031dd6e71a76ece3dd14875..0000000000000000000000000000000000000000 --- a/license/.svn/text-base/MIT.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2012 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/license/.svn/text-base/README.svn-base b/license/.svn/text-base/README.svn-base deleted file mode 100644 index c906d39e4bde3e1b0e3d36f6d60cbc7c93fb23bb..0000000000000000000000000000000000000000 --- a/license/.svn/text-base/README.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -Copyright (c) 2012 David Stites, Patrik Dufresne and others. - -LICENSING -========= - -This program is free software; you can redistribute it and/or modify -it under the terms of either: - - a) The MIT License (MIT) - - b) Apache License 2.0 - - c) Simplified BSD License - -You should have received a copy of the MIT License (MIT) with this -software, in the file named "MIT". If not, I'll be glad to provide one. - -You should have received a copy of the Apache License 2.0 -along with this program in the file named "Apache". - -You should have received a copy of the Simplified BSD License -along with this program in the file named "BSD". - -This package is based on the following article: -http://blog.afewguyscoding.com/2012/02/licensing-module-java/ - -Generate your keys -================== - -Create the private key (containing informationto create the public key). - - $ openssl genrsa -out privkey.pem 2048 - $ openssl pkcs8 -topk8 -in privkey.pem -inform PEM -nocrypt -outform DER -out privkey.der - -Extract the public key, fur publishing. - $ openssl rsa -in privkey.pem -out pubkey.der -pubout -outform DER \ No newline at end of file diff --git a/license/.svn/text-base/build.xml.svn-base b/license/.svn/text-base/build.xml.svn-base deleted file mode 100644 index e7babae32abb98bf82d46d6fceb99a66c8317f78..0000000000000000000000000000000000000000 --- a/license/.svn/text-base/build.xml.svn-base +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/license/.svn/text-base/version.properties.svn-base b/license/.svn/text-base/version.properties.svn-base deleted file mode 100644 index f8f6da16e9aedb934595595adf16cc2dd98e7588..0000000000000000000000000000000000000000 --- a/license/.svn/text-base/version.properties.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -version=0.2 -package.name=com.patrikdufresne.license \ No newline at end of file diff --git a/license/bin/com/patrikdufresne/license/AbstractLicense.class b/license/bin/com/patrikdufresne/license/AbstractLicense.class deleted file mode 100644 index 8e958efa653ae1385f5e37e35d16715f298d3a91..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/AbstractLicense.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/EncryptionManager.class b/license/bin/com/patrikdufresne/license/EncryptionManager.class deleted file mode 100644 index 6caae18083f96fccfe67db202208f48a6ce141a9..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/EncryptionManager.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/ILicense.class b/license/bin/com/patrikdufresne/license/ILicense.class deleted file mode 100644 index 3f9b0bb9bb07e2020f40fd6548b3c591f4cafe05..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/ILicense.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/KeyBlackListedException.class b/license/bin/com/patrikdufresne/license/KeyBlackListedException.class deleted file mode 100644 index d08e48c1bcd567b5b278a72252f2d4fa018ad2ff..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/KeyBlackListedException.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/KeyInvalidException.class b/license/bin/com/patrikdufresne/license/KeyInvalidException.class deleted file mode 100644 index 4246e56f33c63bd8a15e45f77ed8cb5d168f0776..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/KeyInvalidException.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/KeyManager.class b/license/bin/com/patrikdufresne/license/KeyManager.class deleted file mode 100644 index a5e7388119a6d4dc8df0a282f77faf261618b1ac..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/KeyManager.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/LicenseException.class b/license/bin/com/patrikdufresne/license/LicenseException.class deleted file mode 100644 index d424b2a1c63353f1cacc9d35760abbb80b640c2e..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/LicenseException.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/LicenseExpiredException.class b/license/bin/com/patrikdufresne/license/LicenseExpiredException.class deleted file mode 100644 index f868aad3ec7ea9b96aec059386a3856cead68ad3..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/LicenseExpiredException.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/LicenseManager.class b/license/bin/com/patrikdufresne/license/LicenseManager.class deleted file mode 100644 index 79ad36de9daca40bc7603c3f757ddd5bda98e0c0..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/LicenseManager.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/LicenseVersionExpiredException.class b/license/bin/com/patrikdufresne/license/LicenseVersionExpiredException.class deleted file mode 100644 index c7b78cd271a767b075c829a15ac0397d522d628d..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/LicenseVersionExpiredException.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/util/ILogger.class b/license/bin/com/patrikdufresne/license/util/ILogger.class deleted file mode 100644 index d2c10926b4b31da7eac78933fd11424c580fb456..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/util/ILogger.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/util/Policy$1.class b/license/bin/com/patrikdufresne/license/util/Policy$1.class deleted file mode 100644 index 14e7442d48e18656abbd7d9fa7d6cb1eaebc31ac..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/util/Policy$1.class and /dev/null differ diff --git a/license/bin/com/patrikdufresne/license/util/Policy.class b/license/bin/com/patrikdufresne/license/util/Policy.class deleted file mode 100644 index ce593a8276c295d657bdc72054cad30bd267943b..0000000000000000000000000000000000000000 Binary files a/license/bin/com/patrikdufresne/license/util/Policy.class and /dev/null differ diff --git a/license/lib/.svn/all-wcprops b/license/lib/.svn/all-wcprops deleted file mode 100644 index 27a780280cae2cc8e3e2e97e28ea98ed68bb81f4..0000000000000000000000000000000000000000 --- a/license/lib/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 67 -/projects/!svn/ver/353/com.patrikdufresne.license/trunk/license/lib -END diff --git a/license/lib/.svn/entries b/license/lib/.svn/entries deleted file mode 100644 index 446ddc120ef0c2a1d11ae82c3a36717a503436e0..0000000000000000000000000000000000000000 --- a/license/lib/.svn/entries +++ /dev/null @@ -1,35 +0,0 @@ -10 - -dir -357 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/license/lib -https://svn.patrikdufresne.com/projects - - - -2012-04-04T16:27:30.286363Z -353 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - diff --git a/license/src/.svn/all-wcprops b/license/src/.svn/all-wcprops deleted file mode 100644 index 2ff4199f77b3ebd1a20b1cae15ed53ebdac45370..0000000000000000000000000000000000000000 --- a/license/src/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 67 -/projects/!svn/ver/356/com.patrikdufresne.license/trunk/license/src -END diff --git a/license/src/.svn/entries b/license/src/.svn/entries deleted file mode 100644 index 780d16c878c31f44513256c628963ae0900f0f78..0000000000000000000000000000000000000000 --- a/license/src/.svn/entries +++ /dev/null @@ -1,38 +0,0 @@ -10 - -dir -357 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/license/src -https://svn.patrikdufresne.com/projects - - - -2012-04-04T19:52:41.472047Z -356 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -com -dir - diff --git a/license/src/com/.svn/all-wcprops b/license/src/com/.svn/all-wcprops deleted file mode 100644 index 84bea0f783bed648ef5bca61f1d8841459571e14..0000000000000000000000000000000000000000 --- a/license/src/com/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 71 -/projects/!svn/ver/356/com.patrikdufresne.license/trunk/license/src/com -END diff --git a/license/src/com/.svn/entries b/license/src/com/.svn/entries deleted file mode 100644 index 8b61b35ba27980d93f4b8ccb9a2756ec38b4c2ab..0000000000000000000000000000000000000000 --- a/license/src/com/.svn/entries +++ /dev/null @@ -1,38 +0,0 @@ -10 - -dir -357 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/license/src/com -https://svn.patrikdufresne.com/projects - - - -2012-04-04T19:52:41.472047Z -356 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -patrikdufresne -dir - diff --git a/license/src/com/patrikdufresne/.svn/all-wcprops b/license/src/com/patrikdufresne/.svn/all-wcprops deleted file mode 100644 index 9a459aadb1b9bdd58caf01e7e95582a0b9e8c411..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 86 -/projects/!svn/ver/356/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne -END diff --git a/license/src/com/patrikdufresne/.svn/entries b/license/src/com/patrikdufresne/.svn/entries deleted file mode 100644 index fb65825f625c22fcdf6ced6386358798e497a641..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/.svn/entries +++ /dev/null @@ -1,38 +0,0 @@ -10 - -dir -357 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne -https://svn.patrikdufresne.com/projects - - - -2012-04-04T19:52:41.472047Z -356 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -license -dir - diff --git a/license/src/com/patrikdufresne/license/.svn/all-wcprops b/license/src/com/patrikdufresne/license/.svn/all-wcprops deleted file mode 100644 index 455c899aa71ffc955e4c1e9d0f9ce9d751848b3f..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/all-wcprops +++ /dev/null @@ -1,65 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 94 -/projects/!svn/ver/356/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license -END -AbstractLicense.java -K 25 -svn:wc:ra_dav:version-url -V 115 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/AbstractLicense.java -END -KeyManager.java -K 25 -svn:wc:ra_dav:version-url -V 110 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/KeyManager.java -END -LicenseException.java -K 25 -svn:wc:ra_dav:version-url -V 116 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/LicenseException.java -END -LicenseManager.java -K 25 -svn:wc:ra_dav:version-url -V 114 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/LicenseManager.java -END -LicenseExpiredException.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/LicenseExpiredException.java -END -EncryptionManager.java -K 25 -svn:wc:ra_dav:version-url -V 117 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/EncryptionManager.java -END -ILicense.java -K 25 -svn:wc:ra_dav:version-url -V 108 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/ILicense.java -END -KeyInvalidException.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/KeyInvalidException.java -END -KeyBlackListedException.java -K 25 -svn:wc:ra_dav:version-url -V 123 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/KeyBlackListedException.java -END -LicenseVersionExpiredException.java -K 25 -svn:wc:ra_dav:version-url -V 130 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/LicenseVersionExpiredException.java -END diff --git a/license/src/com/patrikdufresne/license/.svn/entries b/license/src/com/patrikdufresne/license/.svn/entries deleted file mode 100644 index 17e0fe1199b511e061b8ae3f840ff2226fe07874..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/entries +++ /dev/null @@ -1,378 +0,0 @@ -10 - -dir -357 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license -https://svn.patrikdufresne.com/projects - - - -2012-04-04T19:52:41.472047Z -356 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -AbstractLicense.java -file -359 - - - -2012-04-18T19:15:41.000000Z -0229042bb0b6438c0d27139467846fc3 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -4952 - -EncryptionManager.java -file -359 - - - -2012-04-18T19:16:28.000000Z -5c2ad4fd6c70d88a225b34efdae7bec9 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -6007 - -ILicense.java -file -359 - - - -2012-04-18T19:16:32.000000Z -4fcb85bb9cdbd682485bdbeda30e7872 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -550 - -KeyBlackListedException.java -file -359 - - - -2012-04-18T19:16:35.000000Z -b24d5108b61261c5cf194f7d0227e657 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -721 - -KeyInvalidException.java -file -359 - - - -2012-04-18T19:16:39.000000Z -003f946798fd2748bfe673997df5fe87 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -756 - -KeyManager.java -file -359 - - - -2012-04-18T19:16:42.000000Z -9873cf83c8af8decef8ef82ace5d3bc0 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -9102 - -LicenseException.java -file -359 - - - -2012-04-18T19:16:47.000000Z -a27904a45b3b0a01bba287d6b1c01937 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -2068 - -LicenseExpiredException.java -file -359 - - - -2012-04-18T19:16:50.000000Z -8555332d43cd23da8adc6c9da179f9a3 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -1005 - -LicenseManager.java -file -359 - - - -2012-04-18T19:16:57.000000Z -f554b028124906ab7f0dbb5ef3294fe2 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -7143 - -LicenseVersionExpiredException.java -file -359 - - - -2012-04-18T19:17:01.000000Z -3d46a036ce451b58d9d9316e6c9a8ab0 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -729 - -util -dir - diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/AbstractLicense.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/AbstractLicense.java.svn-base deleted file mode 100644 index 57d4f87ebdf016879f93b428a91a6ae78175bf0d..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/AbstractLicense.java.svn-base +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -import java.io.Serializable; -import java.util.Date; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Abstract implementation of the license interface use by the license manager. - * - * @author Patrik Dufresne - * - */ -public abstract class AbstractLicense implements Serializable, ILicense { - - private static final long serialVersionUID = -144058457108187374L; - - /** - * License type for lifetime version. Always valid. - */ - public static final String TYPE_LIFETIME = "lifetime"; - /** - * License type for single version. This type is valid for the given - * version. - */ - public static final String TYPE_SINGLE_VERSION = "single-version"; - /** - * License type for trial version. This type is valid until the expiration - * date. - */ - public static final String TYPE_TRIAL = "trial"; - - private String email; - - private Date expiration; - - private String licenseNumber; - - private String licenseType; - private String name; - private String version; - - /** - * Create a new license with default property value. - */ - public AbstractLicense() { - name = ""; - email = ""; - licenseNumber = ""; - expiration = new Date(); - version = ""; - licenseType = TYPE_TRIAL; - } - - /** - * Return the associated email value. - * - * @return the email or null - */ - public String getEmail() { - return email; - } - - /** - * @return the expiration - */ - public Date getExpiration() { - return expiration; - } - - /** - * @return the licenseNumber - */ - public String getLicenseNumber() { - return licenseNumber; - } - - /** - * Return the license type. - * - * @return the licenseType - */ - public String getLicenseType() { - return licenseType; - } - - /** - * Return the name associated with the license. - * - * @return the name or null - */ - public String getName() { - return name; - } - - /** - * Return the license version - * - * @return the version or null - */ - public String getVersion() { - return version; - } - - /** - * Sets the associated email - * - * @param email - * the email or null. - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * Set the license expiration date. Required with TYPE_TRIAL - * - * @param expiration - * the expiration date or null. - */ - public void setExpiration(Date expiration) { - this.expiration = expiration; - } - - /** - * Sets the license number. - * - * @param licenseNumber - * the licenseNumber - */ - public void setLicenseNumber(String licenseNumber) { - this.licenseNumber = licenseNumber; - } - - /** - * Sets the license type. - * - * @param licenseType - * the licenseType, one of the TYPE_* constants (can't be null). - */ - public void setLicenseType(String licenseType) { - if (licenseType == null) { - throw new NullPointerException(); - } - this.licenseType = licenseType; - } - - /** - * Sets the name associated with the license - * - * @param name - * the name or null - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the license version. Required with SINGLE_VERSION. - * - * @param version - * the version or null - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * Check if the given license object is valid. - * - * @param license - * the license object - */ - public void validate(Date currentDate, String currentVersion) - throws LicenseException { - - validateExpiration(new Date()); - - validateVersion(currentVersion); - - } - - /** - * Used to validate the expiration date according to the license type. - * - * @param currentDate - * the current date. - * @throws LicenseExpiredException - */ - protected void validateExpiration(Date currentDate) - throws LicenseExpiredException { - if (getLicenseType().equals(TYPE_TRIAL)) { - if (getExpiration() == null || currentDate.after(getExpiration())) { - throw new LicenseExpiredException(); - } - } - // The expiration date doesn't matter for a single version license or a - // lifetime version. - } - - /** - * Used to validate the version according to the license type. - * - * @param currentVersion - * @throws LicenseVersionExpiredException - */ - protected void validateVersion(String currentVersion) - throws LicenseVersionExpiredException { - - if (getLicenseType().equals(TYPE_SINGLE_VERSION)) { - if (getVersion() == null) { - throw new LicenseVersionExpiredException(); - } - Pattern pattern = Pattern.compile(getVersion()); - Matcher matcher = pattern.matcher(currentVersion); - if (!matcher.matches()) { - throw new LicenseVersionExpiredException(); - } - } - - } - -} diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/EncryptionManager.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/EncryptionManager.java.svn-base deleted file mode 100644 index 6282ab7677f26f813ec5ecf2d4e012c18257c867..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/EncryptionManager.java.svn-base +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.security.InvalidKeyException; -import java.security.KeyFactory; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.Signature; -import java.security.SignatureException; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; - -/** - * This class is used to manage the encryption of the license. It's used to - * encrypt, sign and validate using a public or private key. - * - * @author Patrik Dufresne - * - */ -public class EncryptionManager { - - private static final int SIZE = 2048; - - /** - * Single instance of the utility class. - */ - // private static EncryptionManager instance; - - // private static final String PUBLIC_KEY_FILE = "/License/public_key.der"; - - // private static final String PRIVATE_KEY_FILE = - // "/path/to/your/private_key.der"; - - private PublicKey publicKey; - - /** - * Our private key. - */ - private PrivateKey privateKey; - - /** - * Create a new encryption manager. - * - * @param publicKey - * the public key (can't be null). - * @param privateKey - * the private key (null if not available). - * @throws NoSuchAlgorithmException - * if no Provider supports RSA - * @throws InvalidKeySpecException - * if the given key specification is inappropriate for this key - * factory to produce a public key. - */ - public EncryptionManager(byte[] publicKey, byte[] privateKey) - throws NoSuchAlgorithmException, InvalidKeySpecException { - if (publicKey == null) { - throw new NullPointerException("publicKey"); - } - - X509EncodedKeySpec spec = new X509EncodedKeySpec(publicKey); - KeyFactory kf = KeyFactory.getInstance("RSA"); - this.publicKey = kf.generatePublic(spec); - - if (privateKey != null) { - PKCS8EncodedKeySpec privateSpec = new PKCS8EncodedKeySpec( - privateKey); - KeyFactory privateKeyFactory = KeyFactory.getInstance("RSA"); - this.privateKey = privateKeyFactory.generatePrivate(privateSpec); - } - - } - - /** - * This function is used to read a stream. - * - * @param input - * the input stream - * @return the data read from the stream - * @throws IOException - */ - public static byte[] readAll(InputStream input) throws IOException { - // Read the content of the file and store it in a byte array. - ByteArrayOutputStream out = new ByteArrayOutputStream(SIZE); - byte[] buf = new byte[SIZE]; - int size; - while ((size = input.read(buf)) != -1) { - out.write(buf, 0, size); - } - return out.toByteArray(); - } - - /** - * This function maybe used to read the public and/or private key from a - * file. - * - * @param file - * the file to read - * @return the file data - * - * @throws IOException - * if the file does not exist, or if the first byte cannot be - * read for any reason - */ - public static byte[] readAll(File file) throws IOException { - InputStream input = new FileInputStream(file); - try { - return readAll(input); - } finally { - input.close(); - } - } - - /** - * Use to check if the given data matches the given signature. - * - * @param data - * the data - * @param sig - * the signature associated with the data. - * - * @throws NoSuchAlgorithmException - * if the algorithm SHA1withRSA is not supported. - * @throws NoSuchProviderException - * @throws InvalidKeyException - * if the key is invalid. - * @throws SignatureException - * if this signature algorithm is unable to process the input - * data - */ - public boolean verify(byte[] data, byte[] sig) - throws NoSuchAlgorithmException, InvalidKeyException, - SignatureException { - - // Initialize the signing algorithm with our public key - Signature rsaSignature = Signature.getInstance("SHA1withRSA"); - rsaSignature.initVerify(publicKey); - - // Update the signature algorithm with the data. - rsaSignature.update(data); - - // Validate the signature - return rsaSignature.verify(sig); - - } - - /** - * Sign the given input stream data. The signature is append to the output - * stream. - * - * @param data - * the the data to be signed. - * @return the signature for the given data. - * @throws NoSuchAlgorithmException - * if no Provider supports a Signature implementation for - * SHA1withRSA. - * @throws InvalidKeyException - * if the private key is invalid. - * @throws SignatureException - * if this signature algorithm is unable to process the input - * data provided. - * @throws UnsupportedOperationException - * if the private key was not providedin the constructor. - */ - public byte[] sign(byte[] data) throws NoSuchAlgorithmException, - InvalidKeyException, SignatureException { - if (privateKey == null) { - throw new UnsupportedOperationException( - "Can't sign when the private key is not available."); - } - - // Initialize the signing algorithm with our private key - Signature rsaSignature = Signature.getInstance("SHA1withRSA"); - rsaSignature.initSign(privateKey); - rsaSignature.update(data); - - // Generate the signature. - return rsaSignature.sign(); - - } -} diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/ILicense.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/ILicense.java.svn-base deleted file mode 100644 index 5bd3f43ef4200ef26c7d1fa1ff79d2270067cb79..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/ILicense.java.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -import java.io.Serializable; - -/** - * This interface is used to represent a license data. - * - * @author ikus060 - * - */ -public interface ILicense extends Serializable { - -} diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/KeyBlackListedException.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/KeyBlackListedException.java.svn-base deleted file mode 100644 index 7942b5c8f0c6c463d25e0bef26587a597b0dfc82..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/KeyBlackListedException.java.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -/** - * This exception is throw by the key manager when the key is determined to be - * black listed. - * - * @author Patrik Dufresne - * - */ -public class KeyBlackListedException extends LicenseException { - - private static final long serialVersionUID = 4833729281645719038L; - - public KeyBlackListedException() { - super("black listed key"); - } -} diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/KeyInvalidException.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/KeyInvalidException.java.svn-base deleted file mode 100644 index 5445214584bf568acbd92cdddb14bf0e503e1f2d..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/KeyInvalidException.java.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -/** - * This exception is throw when the key manager determine the key as invalid - * because of the checksum or because it's been wrongly generated. - * - * @author Patrik Dufresne - * - */ -public class KeyInvalidException extends LicenseException { - - private static final long serialVersionUID = 3455646784833396158L; - - public KeyInvalidException() { - super("invalid key"); - } -} diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/KeyManager.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/KeyManager.java.svn-base deleted file mode 100644 index 3da04eb3d58f220c65c81a96dc214ded58a6237c..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/KeyManager.java.svn-base +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.HashSet; -import java.util.Set; - -/** - * This class is useful to generate key to identify a specific hardware using - * the network card. - * - * @author Patrik Dufresne - * - */ -public class KeyManager { - /** - * Define the default key length. - */ - private static final int DEFAULT_KEY_LENGTH = 62; - - /** - * Defin the default default mac address. - */ - private static final byte[] DEFAULT_MAC_ADRESS = new byte[] { 24, 4, 124, - 10, 91 }; - private static final byte[][] DEFAULT_PARAMS = new byte[][] { - { 24, 4, 127 }, { 10, 0, 56 }, { 1, 2, 91 }, { 7, 1, 100 } }; - - /** - * Calculate a checksum. - * - * @param string - * @return the check sum value - */ - private static String calculateChecksum(final String string) { - int left = 0x0056; - int right = 0x00AF; - for (byte b : string.getBytes()) { - right += b; - if (right > 0x00FF) { - right -= 0x00FF; - } - left += right; - if (left > 0x00FF) { - left -= 0x00FF; - } - } - int sum = (left << 8) + right; - return intToHex(sum, 4); - } - - /** - * Get the key bytes. - * - * @param seed - * @param a - * @param b - * @param c - * @return - */ - private static byte getKeyByte(final int seed, final byte a, final byte b, - final byte c) { - final int a1 = a % 25; - final int b1 = b % 3; - if (a1 % 2 == 0) { - return (byte) (((seed >> a1) & 0x000000FF) ^ ((seed >> b1) | c)); - } else { - return (byte) (((seed >> a1) & 0x000000FF) ^ ((seed >> b1) & c)); - } - - } - - /** - * - * @param n - * @param chars - * @return - */ - private static String intToHex(final Number n, final int chars) { - return String.format("%0" + chars + "x", n); - } - - /** - * Sets of black listed keys. - */ - private Set blacklist; - - /** - * Default MAC address if no network interface is available. - */ - private byte[] defaultMac; - - /** - * The current key length. - */ - private int keyLen; - - /** - * Arrays used to generate and validate the key. - */ - private byte[][] params; - - public KeyManager() { - this(DEFAULT_KEY_LENGTH, DEFAULT_PARAMS, DEFAULT_MAC_ADRESS); - } - - /** - * - * @param keyLen - * the key length (>=8); - * @param params - * @param defaultMacAddress - * used if no network interface is available - * - */ - public KeyManager(int keyLen, byte[][] params, byte[] defaultMacAddress) { - if (keyLen < 8) { - throw new IllegalArgumentException("keyLen<8"); - } - this.keyLen = keyLen; - - this.params = params; - - this.defaultMac = defaultMacAddress; - - } - - /** - * Ass the given key to the black list. - * - * @param key - * the key to be added - */ - public void addBlackListedKey(String key) { - if (this.blacklist == null) { - this.blacklist = new HashSet(); - } - this.blacklist.add(key); - } - - /** - * - * @param seed - * @param entropy - * @return - */ - public String generateKey(final int seed, String authCode) { - - byte[] entropy = getHardwareEntropy(); - - final byte[] keyBytes = new byte[25]; - // fill keyBytes with values derived from seed. - // the parameters used here must be exactly the same - // as the ones used in the checkKey function. - keyBytes[0] = getKeyByte(seed, params[0][0], params[0][1], params[0][2]); - keyBytes[1] = getKeyByte(seed, params[1][0], params[1][1], params[1][2]); - keyBytes[2] = getKeyByte(seed, params[2][0], params[2][1], params[2][2]); - keyBytes[3] = getKeyByte(seed, params[3][0], params[3][1], params[3][2]); - for (int i = 4, j = 0; (j + 2) < entropy.length; i++, j += 3) { - keyBytes[i] = getKeyByte(seed, entropy[j], entropy[j + 1], - entropy[j + 2]); - } - - // The key string begins with a hexadecimal string of the seed - final StringBuilder result = new StringBuilder(intToHex(seed, 8)); - - // Then is followed by hexadecimal strings of each byte in the key - for (byte b : keyBytes) { - result.append(intToHex(b, 2)); - } - - // Add checksum to key string - String key = result.toString(); - key += calculateChecksum(key); - - return key; - } - - /** - * Return the complete list of blackl listed key. - * - * @return - */ - public String[] getBlackListedKeys() { - if (this.blacklist == null) { - return new String[0]; - } - String[] list = new String[this.blacklist.size()]; - return this.blacklist.toArray(list); - } - - /** - * Generate an hardate entropy based on the network address. - * - * @return the hardware entropy value. - */ - private byte[] getHardwareEntropy() { - // Get the MAC address value - byte[] mac; - try { - NetworkInterface ni = NetworkInterface.getByInetAddress(InetAddress - .getLocalHost()); - if (ni != null) { - mac = ni.getHardwareAddress(); - if (mac == null) { - mac = defaultMac; - } - } else { - mac = defaultMac; - } - } catch (Exception ex) { - mac = defaultMac; - } - - // Hash the value - byte[] entropyEncoded = null; - try { - MessageDigest digest = MessageDigest.getInstance("SHA-512"); - digest.reset(); - entropyEncoded = digest.digest(mac); - } catch (NoSuchAlgorithmException ex) { /* this will never happen */ - } - - return entropyEncoded; - } - - /** - * Remove the given key from the black list. - * - * @param key - * the key to remove. - */ - public void removeBlackListedKey(String key) { - if (this.blacklist != null) { - this.blacklist.remove(key); - if (this.blacklist.size() == 0) { - this.blacklist = null; - } - } - } - - /** - * Check if a key is valid. - * - * @param key - * the key to validate - * @throws KeyInvalidException - * if the key is invalid - */ - public void validateKey(final String key) throws KeyInvalidException, - KeyBlackListedException { - // Validate the key checksum - if (!validateKeyChecksum(key)) { - throw new KeyInvalidException(); - } - - // Look at the black list. - if (this.blacklist != null) { - for (String black : this.blacklist) { - if (key.startsWith(black)) { - throw new KeyBlackListedException(); - } - } - } - - // At this point, the key is either valid or forged, - // because a forged key can have a valid checksum. - // we now test the "bytes" of the key to determine if it is - // actually valid. - - // When building your release application, use conditional defines - // or comment out most of the byte checks! this is the heart - // of the partial key verification system. by not compiling in - // each check, there is no way for someone to build a keygen that - // will produce valid keys. if an invalid keygen is released, you can - // simply change which byte checks are compiled in, and any serial - // number built with the fake keygen no longer works. - - // note that the parameters used for getKeyByte calls MUST - // MATCH the values that makeKey uses to make the key in the - // first place! - - // Extract the seed from the supplied key string - final int seed; - try { - seed = Integer.valueOf(key.substring(0, 8), 16); - } catch (NumberFormatException e) { - throw new KeyInvalidException(); - } - - // test key 0 - final String kb0 = key.substring(8, 10); - final byte b0 = getKeyByte(seed, params[0][0], params[0][1], - params[0][2]); - if (!kb0.equals(intToHex(b0, 2))) { - throw new KeyInvalidException(); - } - - // test key1 - final String kb1 = key.substring(10, 12); - final byte b1 = getKeyByte(seed, params[1][0], params[1][1], - params[1][2]); - if (!kb1.equals(intToHex(b1, 2))) { - throw new KeyInvalidException(); - } - - // test key2 - final String kb2 = key.substring(12, 14); - final byte b2 = getKeyByte(seed, params[2][0], params[2][1], - params[2][2]); - if (!kb2.equals(intToHex(b2, 2))) { - throw new KeyInvalidException(); - } - - // test key3 - final String kb3 = key.substring(14, 16); - final byte b3 = getKeyByte(seed, params[3][0], params[3][1], - params[3][2]); - if (!kb3.equals(intToHex(b3, 2))) { - throw new KeyInvalidException(); - } - - // test the hardware entropy - byte[] encodedEntropy = getHardwareEntropy(); - for (int i = 16, j = 0; (j + 2) < encodedEntropy.length; i += 2, j += 3) { - String kb = key.substring(i, i + 2); - byte b = getKeyByte(seed, encodedEntropy[j], encodedEntropy[j + 1], - encodedEntropy[j + 2]); - if (!kb.equals(intToHex(b, 2))) { - throw new KeyInvalidException(); - } - } - - } - - /** - * Validate the key check sum. - * - * @param key - * the key value - * @return - */ - private boolean validateKeyChecksum(final String key) { - if (key.length() != this.keyLen) { - throw new IllegalArgumentException("key wrong length"); - } - // last four characters are the checksum - final String checksum = key.substring(this.keyLen - 4); - return checksum.equals(calculateChecksum(key.substring(0, - this.keyLen - 4))); - } - -} diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/LicenseException.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/LicenseException.java.svn-base deleted file mode 100644 index 76c58c3c1ff8cea3321dc4ef2b40726c0ee710c9..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/LicenseException.java.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -/** - * - * This exception regroup all the license exceptions. - * - * @author Patrik Dufresne - * - */ -public class LicenseException extends Exception { - - private static final long serialVersionUID = 7895696254570225320L; - - /** - * Constructs a new exception with null as its detail message. The cause is - * not initialized, and may subsequently be initialized by a call to - * Throwable.initCause(java.lang.Throwable). - */ - public LicenseException() { - this(null, null); - } - - /** - * Constructs a new exception with the specified message. - * - * @param message - * the detail message (which is saved for later retrieval by the - * Throwable.getMessage() method). - */ - public LicenseException(String message) { - this(message, null); - } - - /** - * Constructs a new exception with the specified cause. - * - * @param cause - * the cause (which is saved for later retrieval by the - * Throwable.getCause() method). (A null value is permitted, and - * indicates that the cause is nonexistent or unknown.) - */ - public LicenseException(Throwable cause) { - this(null, cause); - } - - /** - * Constructs a new exception with the specified detail message and cause. - * - * @param message - * the detail message (which is saved for later retrieval by the - * Throwable.getMessage() method). - * @param cause - * the cause (which is saved for later retrieval by the - * Throwable.getCause() method). (A null value is permitted, and - * indicates that the cause is nonexistent or unknown.) - */ - public LicenseException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/LicenseExpiredException.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/LicenseExpiredException.java.svn-base deleted file mode 100644 index a7d7e86778a36e0e9c6126b96a3a52409254ace1..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/LicenseExpiredException.java.svn-base +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -/** - * Thrown when the license validation determine the license to be expired. The - * expiration date should then by retrieve using the - * {@link AbstractLicense#getExpiration()}. - * - * @author Patrik Dufresne - * - */ -public class LicenseExpiredException extends LicenseException { - - private static final long serialVersionUID = -9069804052012922999L; - - /** - * Constructs a new exception with null as its detail message. The cause is - * not initialized, and may subsequently be initialized by a call to - * Throwable.initCause(java.lang.Throwable). - */ - public LicenseExpiredException() { - super("license expired"); - } - -} diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/LicenseManager.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/LicenseManager.java.svn-base deleted file mode 100644 index f8c30b61eb9a6c62582d2ce5677719b0458f5025..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/LicenseManager.java.svn-base +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.security.GeneralSecurityException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.security.SignatureException; - -/** - * This the main entry point of the licensing module. This class should be used - * to create and check license files. - *

- * Generally, an application will not required more then one instance of license - * manager. - * - * @author Patrik Dufresne - * - */ -public class LicenseManager { - private static final int SIZE = 2048; - /** - * The encryption manager used by this class.F - */ - private EncryptionManager encryptionManager; - - /** - * Create a new license manager. - * - * @param publicKey - * the public key filename. - * @param privateKey - * the private key filename (null if not available). - * @throws GeneralSecurityException - * if the provided key are invalid. - * @throws IOException - * if the file doesn't exists - */ - public LicenseManager(String publicKey, String privateKey) - throws GeneralSecurityException, IOException { - byte[] pubdata = EncryptionManager.readAll(new File(publicKey)); - byte[] privdata = null; - if (privateKey != null) { - privdata = EncryptionManager.readAll(new File(privateKey)); - } - this.encryptionManager = new EncryptionManager(pubdata, privdata); - } - - /** - * Create a new license manager. - * - * @param publicKey - * the public key file. - * @param privateKey - * the private key file (null if not available). - * @throws GeneralSecurityException - * if the provided key are invalid. - * @throws IOException - * if the file doesn't exists - */ - public LicenseManager(File publicKey, File privateKey) - throws GeneralSecurityException, IOException { - byte[] pubdata = EncryptionManager.readAll(publicKey); - byte[] privdata = null; - if (privateKey != null) { - privdata = EncryptionManager.readAll(privateKey); - } - this.encryptionManager = new EncryptionManager(pubdata, privdata); - } - - /** - * Create a new license manager. - * - * @param publicKey - * an input stream containing the public key - * @param privateKey - * an input stream containing the private key - */ - public LicenseManager(InputStream publicKey, InputStream privateKey) - throws GeneralSecurityException, IOException { - byte[] pubdata = EncryptionManager.readAll(publicKey); - byte[] privdata = null; - if (privateKey != null) { - privdata = EncryptionManager.readAll(privateKey); - } - this.encryptionManager = new EncryptionManager(pubdata, privdata); - } - - /** - * Create a new license manager. Generally, an application will not required - * more then one instance of license manager. - * - * @param publicKey - * the public key (can't be null). - * - * @param privateKey - * the private key (null if not available). - * @throws GeneralSecurityException - * if the provided key are invalid. - */ - public LicenseManager(byte[] publicKey, byte[] privateKey) - throws GeneralSecurityException { - this.encryptionManager = new EncryptionManager(publicKey, privateKey); - } - - /** - * Read the content of an encrypted license file. - * - * @param file - * the location to the license file. - * @return the license object if the license file is valid, null otherwise. - * @throws IOException - * if file not found or read error. - * @throws SignatureException - * if this signature algorithm is unable to process the content - * of the file - * @throws NoSuchAlgorithmException - * if the SHA algorithm doesn't exists - * @throws InvalidKeyException - * if the public key is invalid - * @throws ClassNotFoundException - * if the implementation of {@link ILicense} stored in the file - * can't be found - */ - public ILicense readLicenseFile(File file) throws IOException, - InvalidKeyException, NoSuchAlgorithmException, SignatureException, - ClassNotFoundException { - - // Read the content of the file - byte[] sig; - byte[] data; - ObjectInputStream fileIn = new ObjectInputStream( - new BufferedInputStream(new FileInputStream(file))); - try { - int sigLength = fileIn.readInt(); - sig = new byte[sigLength]; - fileIn.read(sig); - - ByteArrayOutputStream dataStream = new ByteArrayOutputStream(); - byte[] buf = new byte[SIZE]; - int len; - while ((len = fileIn.read(buf)) != -1) { - dataStream.write(buf, 0, len); - } - dataStream.flush(); - data = dataStream.toByteArray(); - dataStream.close(); - } finally { - fileIn.close(); - } - - // Validate the signature - if (!encryptionManager.verify(data, sig)) { - return null; - } - - // Read the license object from the data. - ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream( - data)); - try { - ILicense license = (ILicense) in.readObject(); - return license; - } finally { - in.close(); - } - - } - - /** - * Used to serialize a license object. - * - * @param license - * the license object. - * @param file - * the location where to save the new license file. If file - * exists, it's overwrite. - * @throws IOException - * if the file doesn't exists or can't be written to - * @throws SignatureException - * if this signature algorithm is unable to process the license - * data - * @throws NoSuchAlgorithmException - * if the algorithm SHA is not supported - * @throws InvalidKeyException - * if the private key is invalid. - */ - public void writeLicense(ILicense license, File file) throws IOException, - InvalidKeyException, NoSuchAlgorithmException, SignatureException { - // Write the license information into a byte array. - ByteArrayOutputStream dataStream = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(dataStream); - out.writeObject(license); - byte[] data = dataStream.toByteArray(); - out.close(); - - // Then sign the byte array - byte[] signature = this.encryptionManager.sign(data); - - // Write all the data into one single file. - ObjectOutputStream fileOut = new ObjectOutputStream( - new BufferedOutputStream(new FileOutputStream(file))); - try { - fileOut.writeInt(signature.length); - fileOut.write(signature); - fileOut.write(data); - fileOut.flush(); - } finally { - fileOut.close(); - } - - } - -} diff --git a/license/src/com/patrikdufresne/license/.svn/text-base/LicenseVersionExpiredException.java.svn-base b/license/src/com/patrikdufresne/license/.svn/text-base/LicenseVersionExpiredException.java.svn-base deleted file mode 100644 index 3a53faf92b063095074362a8f6f6447b83848208..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/.svn/text-base/LicenseVersionExpiredException.java.svn-base +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license; - -/** - * This exception is throw when the license version doesn't match the current - * version. - * - * @author Patrik Dufresne - * - */ -public class LicenseVersionExpiredException extends LicenseException { - - private static final long serialVersionUID = 8947235554238066208L; - - public LicenseVersionExpiredException() { - super("version expired"); - } - -} diff --git a/license/src/com/patrikdufresne/license/util/.svn/all-wcprops b/license/src/com/patrikdufresne/license/util/.svn/all-wcprops deleted file mode 100644 index 5abb08f9e27aac3f5c9ddeff60bfbad775add88b..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/util/.svn/all-wcprops +++ /dev/null @@ -1,17 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 99 -/projects/!svn/ver/353/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/util -END -ILogger.java -K 25 -svn:wc:ra_dav:version-url -V 112 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/util/ILogger.java -END -Policy.java -K 25 -svn:wc:ra_dav:version-url -V 111 -/projects/!svn/ver/359/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/util/Policy.java -END diff --git a/license/src/com/patrikdufresne/license/util/.svn/entries b/license/src/com/patrikdufresne/license/util/.svn/entries deleted file mode 100644 index 5a44f06c9cf9b899e1ecbb6db796b7364c96dfe1..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/util/.svn/entries +++ /dev/null @@ -1,103 +0,0 @@ -10 - -dir -357 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/license/src/com/patrikdufresne/license/util -https://svn.patrikdufresne.com/projects - - - -2012-04-04T16:27:30.286363Z -353 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -ILogger.java -file -359 - - - -2012-04-18T19:17:06.000000Z -6dd80050e27d223c0bee144da044a4d7 -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -1378 - -Policy.java -file -359 - - - -2012-04-18T19:17:13.000000Z -de974a113c7dc114f82a2e4555251fca -2012-04-18T19:20:37.071362Z -359 -ikus060 - - - - - - - - - - - - - - - - - - - - - -1480 - diff --git a/license/src/com/patrikdufresne/license/util/.svn/text-base/ILogger.java.svn-base b/license/src/com/patrikdufresne/license/util/.svn/text-base/ILogger.java.svn-base deleted file mode 100644 index 8f4071729d7f120faf40e81ca7bc0b64b7e2d5d1..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/util/.svn/text-base/ILogger.java.svn-base +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license.util; - -/** - * A mechanism to log errors throughout the license framework. - *

- * Clients may provide their own implementation to change how errors are logged - * from within the license framework. - *

- * - */ -public interface ILogger { - /** - * Trace level (value: trace). - */ - public static final String TRACE = "trace"; - /** - * Debug level (value: debug). - */ - public static final String DEBUG = "debug"; - /** - * Info level (value: info). - */ - public static final String INFO = "info"; - /** - * Warn level (value: warn). - */ - public static final String WARN = "warn"; - /** - * Error level (value: error). - */ - public static final String ERROR = "error"; - - /** - * Logs the given status. - * - * @param level - * The level - * @param message - * The message to be logged. - */ - public void log(String level, String message); - - /** - * Logs the given exception. - * - * @param level - * @param exception - */ - public void log(String level, Throwable exception); - -} diff --git a/license/src/com/patrikdufresne/license/util/.svn/text-base/Policy.java.svn-base b/license/src/com/patrikdufresne/license/util/.svn/text-base/Policy.java.svn-base deleted file mode 100644 index 00f54b02c712c1c55d9e281f8312e93c10c7f57d..0000000000000000000000000000000000000000 --- a/license/src/com/patrikdufresne/license/util/.svn/text-base/Policy.java.svn-base +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2012 David Stites, Patrik Dufresne and others. - * - * You may distribute under the terms of either the MIT License, the Apache - * License 2.0 or the Simplified BSD License, as specified in the README file. - * - * Contributors: - * David Stites - initial API and implementation - * Patrik Dufresne - refactoring - */ -package com.patrikdufresne.license.util; - -/** - * The Policy class handles settings for behavior, debug flags and logging - * within the license framework. - * - */ -public class Policy { - - private static ILogger log; - - /** - * Returns the dummy log to use if none has been set - */ - private static ILogger getDummyLog() { - return new ILogger() { - @Override - public void log(String level, String message) { - System.out.print(level + " " + message); - } - - @Override - public void log(String level, Throwable exception) { - exception.printStackTrace(System.out); - } - }; - } - - /** - * Returns the logger used by the license framework to log errors. - *

- * The default logger prints the status to System.err. - *

- * - * @return the logger - */ - public static ILogger getLog() { - if (log == null) { - log = getDummyLog(); - } - return log; - } - - /** - * Sets the logger used by the license framework to log errors. - * - * @param logger - * the logger to use, or null to use the default - * logger - */ - public static void setLog(ILogger logger) { - log = logger; - } - -} diff --git a/unitest/.gitignore b/unitest/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..5e56e040ec0902e58df8573adaec65c5da6e9304 --- /dev/null +++ b/unitest/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/unitest/.settings/.svn/all-wcprops b/unitest/.settings/.svn/all-wcprops deleted file mode 100644 index 88fc1a576e0d398dcb4f4356b72a3e53c56474d7..0000000000000000000000000000000000000000 --- a/unitest/.settings/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 74 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/.settings -END -org.eclipse.jdt.core.prefs -K 25 -svn:wc:ra_dav:version-url -V 101 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/.settings/org.eclipse.jdt.core.prefs -END diff --git a/unitest/.settings/.svn/entries b/unitest/.settings/.svn/entries deleted file mode 100644 index 5a460f575df8a599ffb97d6248a9abdcaf21c649..0000000000000000000000000000000000000000 --- a/unitest/.settings/.svn/entries +++ /dev/null @@ -1,69 +0,0 @@ -10 - -dir -355 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/unittest/.settings -https://svn.patrikdufresne.com/projects - - - -2012-04-04T16:28:32.290129Z -355 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -org.eclipse.jdt.core.prefs -file - - - - -2012-04-03T23:11:01.000000Z -2919c25f5c24570b020be2313653b347 -2012-04-04T16:28:32.290129Z -355 -ikus060 - - - - - - - - - - - - - - - - - - - - - -617 - diff --git a/unitest/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base b/unitest/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base deleted file mode 100644 index e4d9131187a607427f6e26858e30e1c3b3d49e8f..0000000000000000000000000000000000000000 --- a/unitest/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Apr 03 19:11:01 EDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/unitest/.svn/all-wcprops b/unitest/.svn/all-wcprops deleted file mode 100644 index 8a2c050aa6eda8dde456b33321784d56dbd0d6bc..0000000000000000000000000000000000000000 --- a/unitest/.svn/all-wcprops +++ /dev/null @@ -1,35 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 64 -/projects/!svn/ver/354/com.patrikdufresne.license/trunk/unittest -END -privkey.der -K 25 -svn:wc:ra_dav:version-url -V 76 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/privkey.der -END -pubkey.der -K 25 -svn:wc:ra_dav:version-url -V 75 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/pubkey.der -END -privkey.pem -K 25 -svn:wc:ra_dav:version-url -V 76 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/privkey.pem -END -.project -K 25 -svn:wc:ra_dav:version-url -V 73 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/.project -END -.classpath -K 25 -svn:wc:ra_dav:version-url -V 75 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/.classpath -END diff --git a/unitest/.svn/entries b/unitest/.svn/entries deleted file mode 100644 index 87ad9c606e320c3ab62f69b4ab41f7d47ab4ff59..0000000000000000000000000000000000000000 --- a/unitest/.svn/entries +++ /dev/null @@ -1,212 +0,0 @@ -10 - -dir -354 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/unittest -https://svn.patrikdufresne.com/projects - - - -2012-04-04T16:28:05.037077Z -354 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - - -immediates - -.classpath -file -355 - - - -2012-04-03T23:11:41.000000Z -7a0846df6dbcc5f879b144d2a823a877 -2012-04-04T16:28:32.290129Z -355 -ikus060 - - - - - - - - - - - - - - - - - - - - - -445 - -.project -file -355 - - - -2012-04-03T23:11:34.000000Z -96d99216fb8a223b7089af7dde329776 -2012-04-04T16:28:32.290129Z -355 -ikus060 - - - - - - - - - - - - - - - - - - - - - -366 - -.settings -dir - -privkey.der -file -355 - - - -2012-04-04T00:59:52.000000Z -a63b9f8de799c2e21e87bc8e82820c39 -2012-04-04T16:28:32.290129Z -355 -ikus060 -has-props - - - - - - - - - - - - - - - - - - - - -1218 - -privkey.pem -file -355 - - - -2012-04-04T00:13:27.000000Z -cb1635d326f29a28c3ee56b0ba892fb1 -2012-04-04T16:28:32.290129Z -355 -ikus060 - - - - - - - - - - - - - - - - - - - - - -1679 - -pubkey.der -file -355 - - - -2012-04-04T00:23:19.000000Z -290f95f56bc5f18c33906df91780251e -2012-04-04T16:28:32.290129Z -355 -ikus060 -has-props - - - - - - - - - - - - - - - - - - - - -294 - -src -dir - diff --git a/unitest/.svn/prop-base/privkey.der.svn-base b/unitest/.svn/prop-base/privkey.der.svn-base deleted file mode 100644 index 5e9587e658c3c3c18ab62ebc908568efd1226aed..0000000000000000000000000000000000000000 --- a/unitest/.svn/prop-base/privkey.der.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/unitest/.svn/prop-base/pubkey.der.svn-base b/unitest/.svn/prop-base/pubkey.der.svn-base deleted file mode 100644 index 5e9587e658c3c3c18ab62ebc908568efd1226aed..0000000000000000000000000000000000000000 --- a/unitest/.svn/prop-base/pubkey.der.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/unitest/.svn/text-base/.classpath.svn-base b/unitest/.svn/text-base/.classpath.svn-base deleted file mode 100644 index c8824494044dbb65ef5130a1db7ff5621b4c13b8..0000000000000000000000000000000000000000 --- a/unitest/.svn/text-base/.classpath.svn-base +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/unitest/.svn/text-base/.project.svn-base b/unitest/.svn/text-base/.project.svn-base deleted file mode 100644 index c00d4c29e7dccf515556a6413b078197c53585de..0000000000000000000000000000000000000000 --- a/unitest/.svn/text-base/.project.svn-base +++ /dev/null @@ -1,17 +0,0 @@ - - - unitest - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/unitest/.svn/text-base/privkey.der.svn-base b/unitest/.svn/text-base/privkey.der.svn-base deleted file mode 100644 index 19a7bc7a3017c5e1d1d895a176dd4a28b8a4f170..0000000000000000000000000000000000000000 Binary files a/unitest/.svn/text-base/privkey.der.svn-base and /dev/null differ diff --git a/unitest/.svn/text-base/privkey.pem.svn-base b/unitest/.svn/text-base/privkey.pem.svn-base deleted file mode 100644 index 0cb23209c66db5dd5c7e82abbb51f6aa74b561cd..0000000000000000000000000000000000000000 --- a/unitest/.svn/text-base/privkey.pem.svn-base +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAnqTSA0yFOc+POCS/f/CRM0Ju9O0E7fcUO8nKS0Pad3VU0Xm/ -3CJ4Tsa77q9ZV6CybI8oaQlfsgXAQRrL2n+R07anmNsZp+HSIG4E+OwJAJRBAimW -xBd2eSBhYWDLnwcQZLdtD8w75HMF/aOP6HiYQodddf8IWYM/O8xsppfYCiMgeuY5 -MDjvF64IY0hhhmTORduPatTuEyv2L4aLPAngS2L5HcAGJ9IHsE5jPzyUzKZdtAqr -ZIGAkDaaxnslq0QBvuPOIEkdB75XPbzc5D2J7SJRKuiD3TUgAiWva09WwH57I4oY -G9jvZtqFg+k3mkHvwsTDq53GAG8q5eoWLLLyQwIDAQABAoIBAQCGE45as2U1QrIs -JQKjwlE1HURhQ6AS7ervzM9nZOVSaJtSnq8EAS3khhl21EORx4KENUlV3FJARpQB -cgAvnflFEO38RdAdDsFkHxecuP+yuZlnlnaRK7M5E6C5h/EPagz00gEehOFpZbz+ -bCnHs4QbVgQrIWuRG1dp1o9NDK/NgCXEqF7guZDusWEI/lJZNII8Lg2ub4dDyXED -x3MOeIpvuozsmlfNkzCCRy7Qm6JmQ0jXP0UwUd0f5IjHG4iNeN50EilyGEDTO4Ko -d40/698c0Eq5t7uQBGuA5QWhrKqLD5Jpb+O4U6b0s3MEveCUvhgF1+KuNTL7dt74 -xKE/Po4hAoGBAM7qvzjnLEZ95MF8xoaRoVizElNrkL3z0ZqSHp7BUWWyT1p+C5Cc -u6kByM9LglbbdiXTZnY4MQf8I30nNRtIRXZjniYf420rRU/uDCDgDPuKl4CNP46/ -emkq779svsbJzOj8o6l1Q+DfUyhQ93goVs3EWEOE2dpQR3CaDiN68jpVAoGBAMRG -opgL2liCs+zC+gwZSDjy5xCkHbm/nr2J9GYs6FIutkWb9I3pGi/rXc5Db3asHDy1 -qCl9oLz5mg4FKH+rG8YbNYvhZ2SQHeTGuQvGZf2C/bMxSrguf3HWmSGQ6/JDqrk/ -t/LbDayZHjT8u+yBi/kGd2fsO87rB7bSgeKEpMI3AoGAHXQ7Di2SFuK62nQZinRW -hFrRRACu1OtNLfSY2T5piNFuDFKe8NHuwKsZW7DC9/w7gDzse+2ZxSo2Hw2iuKR8 -BtM9Yu3tINAlCLC5F0DteC0NTeZNYtOM6EWNZTFkosV9Hrk/ztJ7fBouKzIDWB5d -5OKLMelKXZJJ6RR06MYKjxUCgYEAp6/NQ+eEgPARtiqSJHoJGRZ1UONVvhc3EKnn -EtA1H9lmwivOkNthEyWb/BfjB9ldOoTcia4aALmi422GvyQ501P1uG83vVPfJlCd -UbEL+73I8Cohsx+OpHx6UZIV8uHa3u/QQXzivt4GT7DJAPNg2b2rkC7knhBwg8Jv -U06N0JsCgYBXDkAUQA2/KRS/0Uarp4Ixyo+ggwVt8Y+P39OR56tg8UNOyNpctY4R -JtqIQW6ZpGg8GNB6euKXsHJu49uPrxRCNJ4epctB7KtKuynQYTXv8psxCHAAup0f -CXiZwXId6qNwCGLi1ao4ylVMum3KOSNQgPCCAWhUc1qt8lmxpggOrQ== ------END RSA PRIVATE KEY----- diff --git a/unitest/.svn/text-base/pubkey.der.svn-base b/unitest/.svn/text-base/pubkey.der.svn-base deleted file mode 100644 index 942833f549f72e7979bad294d002dd627417e361..0000000000000000000000000000000000000000 Binary files a/unitest/.svn/text-base/pubkey.der.svn-base and /dev/null differ diff --git a/unitest/bin/com/patrikdufresne/license/EncryptionManagerTest.class b/unitest/bin/com/patrikdufresne/license/EncryptionManagerTest.class deleted file mode 100644 index 82d03727b60f0555911f38d758dc6493a7db31a4..0000000000000000000000000000000000000000 Binary files a/unitest/bin/com/patrikdufresne/license/EncryptionManagerTest.class and /dev/null differ diff --git a/unitest/bin/com/patrikdufresne/license/KeyManagerTest.class b/unitest/bin/com/patrikdufresne/license/KeyManagerTest.class deleted file mode 100644 index 6c560eef3149449215d7bb8075886d4298f892a7..0000000000000000000000000000000000000000 Binary files a/unitest/bin/com/patrikdufresne/license/KeyManagerTest.class and /dev/null differ diff --git a/unitest/bin/com/patrikdufresne/license/LicenseManagerTest$MockLicense.class b/unitest/bin/com/patrikdufresne/license/LicenseManagerTest$MockLicense.class deleted file mode 100644 index 9620fb1d74ba8f51cf54a3f3759f7183be9633a3..0000000000000000000000000000000000000000 Binary files a/unitest/bin/com/patrikdufresne/license/LicenseManagerTest$MockLicense.class and /dev/null differ diff --git a/unitest/bin/com/patrikdufresne/license/LicenseManagerTest.class b/unitest/bin/com/patrikdufresne/license/LicenseManagerTest.class deleted file mode 100644 index 747373fc7b8e0204eec59132fec86bd38d6cb67a..0000000000000000000000000000000000000000 Binary files a/unitest/bin/com/patrikdufresne/license/LicenseManagerTest.class and /dev/null differ diff --git a/unitest/src/.svn/all-wcprops b/unitest/src/.svn/all-wcprops deleted file mode 100644 index bac46ba260a336a4c0bd35c0811e3f1744fc89a0..0000000000000000000000000000000000000000 --- a/unitest/src/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 68 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/src -END diff --git a/unitest/src/.svn/entries b/unitest/src/.svn/entries deleted file mode 100644 index f1588e638d831add2875dbdbcaa1a036feaae751..0000000000000000000000000000000000000000 --- a/unitest/src/.svn/entries +++ /dev/null @@ -1,38 +0,0 @@ -10 - -dir -355 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/unittest/src -https://svn.patrikdufresne.com/projects - - - -2012-04-04T16:28:32.290129Z -355 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -com -dir - diff --git a/unitest/src/com/.svn/all-wcprops b/unitest/src/com/.svn/all-wcprops deleted file mode 100644 index cefc92c06eb2075891b487f2f9743ce3902b982a..0000000000000000000000000000000000000000 --- a/unitest/src/com/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 72 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/src/com -END diff --git a/unitest/src/com/.svn/entries b/unitest/src/com/.svn/entries deleted file mode 100644 index 37f108e00ad90096eef3eb5288172b261b712f45..0000000000000000000000000000000000000000 --- a/unitest/src/com/.svn/entries +++ /dev/null @@ -1,38 +0,0 @@ -10 - -dir -355 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/unittest/src/com -https://svn.patrikdufresne.com/projects - - - -2012-04-04T16:28:32.290129Z -355 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -patrikdufresne -dir - diff --git a/unitest/src/com/patrikdufresne/.svn/all-wcprops b/unitest/src/com/patrikdufresne/.svn/all-wcprops deleted file mode 100644 index 6483820b75db178b2de9ec12771601b6df0729f8..0000000000000000000000000000000000000000 --- a/unitest/src/com/patrikdufresne/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 87 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/src/com/patrikdufresne -END diff --git a/unitest/src/com/patrikdufresne/.svn/entries b/unitest/src/com/patrikdufresne/.svn/entries deleted file mode 100644 index ed559dc4d14aacb122d0a4048751b2f83533ff34..0000000000000000000000000000000000000000 --- a/unitest/src/com/patrikdufresne/.svn/entries +++ /dev/null @@ -1,38 +0,0 @@ -10 - -dir -355 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/unittest/src/com/patrikdufresne -https://svn.patrikdufresne.com/projects - - - -2012-04-04T16:28:32.290129Z -355 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -license -dir - diff --git a/unitest/src/com/patrikdufresne/license/.svn/all-wcprops b/unitest/src/com/patrikdufresne/license/.svn/all-wcprops deleted file mode 100644 index 57ffc7d9b09087c5a8267562e218c22cc707580f..0000000000000000000000000000000000000000 --- a/unitest/src/com/patrikdufresne/license/.svn/all-wcprops +++ /dev/null @@ -1,23 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 95 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/src/com/patrikdufresne/license -END -KeyManagerTest.java -K 25 -svn:wc:ra_dav:version-url -V 115 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/src/com/patrikdufresne/license/KeyManagerTest.java -END -LicenseManagerTest.java -K 25 -svn:wc:ra_dav:version-url -V 119 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/src/com/patrikdufresne/license/LicenseManagerTest.java -END -EncryptionManagerTest.java -K 25 -svn:wc:ra_dav:version-url -V 122 -/projects/!svn/ver/355/com.patrikdufresne.license/trunk/unittest/src/com/patrikdufresne/license/EncryptionManagerTest.java -END diff --git a/unitest/src/com/patrikdufresne/license/.svn/entries b/unitest/src/com/patrikdufresne/license/.svn/entries deleted file mode 100644 index 57a7f43849ff438d10005f1b857a5f53fc3f3c0d..0000000000000000000000000000000000000000 --- a/unitest/src/com/patrikdufresne/license/.svn/entries +++ /dev/null @@ -1,137 +0,0 @@ -10 - -dir -355 -https://svn.patrikdufresne.com/projects/com.patrikdufresne.license/trunk/unittest/src/com/patrikdufresne/license -https://svn.patrikdufresne.com/projects - - - -2012-04-04T16:28:32.290129Z -355 -ikus060 - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -392366b5-5131-0410-a9e1-b88d89b6244e - - - - - - -0 - -EncryptionManagerTest.java -file - - - - -2012-04-04T01:03:07.000000Z -ad50153fd8a41e462faa155d3373c8a9 -2012-04-04T16:28:32.290129Z -355 -ikus060 - - - - - - - - - - - - - - - - - - - - - -1811 - -KeyManagerTest.java -file - - - - -2012-04-04T13:55:26.000000Z -9ae6a0492d2dbd63d2e122fb5655dcd3 -2012-04-04T16:28:32.290129Z -355 -ikus060 - - - - - - - - - - - - - - - - - - - - - -838 - -LicenseManagerTest.java -file - - - - -2012-04-04T15:49:27.000000Z -af23ee619a56b43d529e5e13af46a018 -2012-04-04T16:28:32.290129Z -355 -ikus060 - - - - - - - - - - - - - - - - - - - - - -1968 - diff --git a/unitest/src/com/patrikdufresne/license/.svn/text-base/EncryptionManagerTest.java.svn-base b/unitest/src/com/patrikdufresne/license/.svn/text-base/EncryptionManagerTest.java.svn-base deleted file mode 100644 index 74daf5a2e5341b16b72e97a3dfdf4f2156260357..0000000000000000000000000000000000000000 --- a/unitest/src/com/patrikdufresne/license/.svn/text-base/EncryptionManagerTest.java.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -package com.patrikdufresne.license; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.security.SignatureException; -import java.security.spec.InvalidKeySpecException; - -import org.junit.Before; -import org.junit.Test; - -import org.junit.Assert; - -/** - * Test the functionality provided by the class {@link EncryptionManager} - * - * @author Patrik Dufresne - * - */ -public class EncryptionManagerTest { - - private EncryptionManager manager; - - private byte[] data; - - @Before - public void initEncryptionManager() throws IOException, - NoSuchAlgorithmException, InvalidKeySpecException { - - byte[] pubKey = EncryptionManager.readAll(new File("pubkey.der")); - byte[] privateKey = EncryptionManager.readAll(new File("privkey.der")); - this.manager = new EncryptionManager(pubKey, privateKey); - - // Prepare data - String string = "This is some data to by sign"; - this.data = string.getBytes(); - } - - @Test - public void sign_WithData_ReturnSignature() throws InvalidKeyException, - NoSuchAlgorithmException, SignatureException { - - byte[] sig = this.manager.sign(data); - - } - - @Test - public void verify_WithDataAndGoodSignature_ReturnTrue() - throws InvalidKeyException, NoSuchAlgorithmException, - SignatureException, FileNotFoundException, IOException { - - byte[] sig = this.manager.sign(data); - - Assert.assertTrue(this.manager.verify(data, sig)); - - } - - @Test - public void verify_WithDataAndWrongSignature_ReturnTrue() - throws InvalidKeyException, NoSuchAlgorithmException, - SignatureException, FileNotFoundException, IOException { - - byte[] sig = this.manager.sign(data); - sig[0] = (byte) (((int) sig[0]) + 3); - - Assert.assertFalse(this.manager.verify(data, sig)); - - } - -} diff --git a/unitest/src/com/patrikdufresne/license/.svn/text-base/KeyManagerTest.java.svn-base b/unitest/src/com/patrikdufresne/license/.svn/text-base/KeyManagerTest.java.svn-base deleted file mode 100644 index 5ffe968fe7a3579546e63a7a6d7853dd2ec0c297..0000000000000000000000000000000000000000 --- a/unitest/src/com/patrikdufresne/license/.svn/text-base/KeyManagerTest.java.svn-base +++ /dev/null @@ -1,44 +0,0 @@ -package com.patrikdufresne.license; - -import org.junit.Before; -import org.junit.Test; - -public class KeyManagerTest { - - private KeyManager manager; - - @Before - public void initKeyManager() { - this.manager = new KeyManager(); - } - - @Test - public void generateKey_WithAuthCode_ReturnKey() { - - String key = this.manager.generateKey(3, "coucou"); - - } - - @Test - public void validateKey_WithValidKey_ReturnTrue() - throws KeyInvalidException, KeyBlackListedException { - - String key = this.manager.generateKey(3, "coucou"); - - this.manager.validateKey(key); - - } - - @Test(expected = KeyInvalidException.class) - public void validateKey_WithInvalidKey_ReturnTrue() - throws KeyInvalidException, KeyBlackListedException { - - String key = this.manager.generateKey(3, "coucou"); - - key = key.replace("0", "1"); - - this.manager.validateKey(key); - - } - -} diff --git a/unitest/src/com/patrikdufresne/license/.svn/text-base/LicenseManagerTest.java.svn-base b/unitest/src/com/patrikdufresne/license/.svn/text-base/LicenseManagerTest.java.svn-base deleted file mode 100644 index aa853a600a81f9ebb80f07363ceb4c15aa582873..0000000000000000000000000000000000000000 --- a/unitest/src/com/patrikdufresne/license/.svn/text-base/LicenseManagerTest.java.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -package com.patrikdufresne.license; - -import static org.junit.Assert.*; - -import java.io.File; -import java.io.IOException; -import java.security.GeneralSecurityException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.security.SignatureException; - -import org.junit.Before; -import org.junit.Test; - -/** - * This class test all the functionnality provided by the {@link LicenseManager} - * . - * - * @author ikus060 - * - */ -public class LicenseManagerTest { - - static class MockLicense extends AbstractLicense { - - private static final long serialVersionUID = -4612807836761969030L; - - } - - private LicenseManager manager; - - @Before - public void initLicenseManager() throws GeneralSecurityException, - IOException { - this.manager = new LicenseManager("pubkey.der", "privkey.der"); - } - - /** - * Check to create a license file - * - * @throws IOException - * @throws SignatureException - * @throws NoSuchAlgorithmException - * @throws InvalidKeyException - */ - @Test - public void writeLicense_WithLicense_CreateTheFile() - throws InvalidKeyException, NoSuchAlgorithmException, - SignatureException, IOException { - MockLicense license = new MockLicense(); - File file = new File("unittest.lic"); - manager.writeLicense(license, file); - assertTrue(file.exists()); - } - - /** - * Read the license file. - * - * @throws IOException - * @throws SignatureException - * @throws NoSuchAlgorithmException - * @throws InvalidKeyException - * @throws ClassNotFoundException - */ - @Test - public void readLicense_WithValidFile_ReadLicense() - throws InvalidKeyException, NoSuchAlgorithmException, - SignatureException, IOException, ClassNotFoundException { - MockLicense license = new MockLicense(); - File file = new File("unittest2.lic"); - manager.writeLicense(license, file); - assertTrue(file.exists()); - - // Read the file - MockLicense license2 = (MockLicense) manager.readLicenseFile(file); - assertNotNull(license2); - - } - -}