();
- }
- 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);
-
- }
-
-}