diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 5b5a814..7b157bc 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/ASAPAndroidService/ASAPService_0.1.1.aar b/ASAPAndroidService/ASAPService_0.1.1.aar index 030d2a5..ddc74fa 100644 Binary files a/ASAPAndroidService/ASAPService_0.1.1.aar and b/ASAPAndroidService/ASAPService_0.1.1.aar differ diff --git a/app/libs/ASAPCertificate_0.1.0.jar b/app/libs/ASAPCertificate_0.1.0.jar index b1bd9d1..73890ff 100644 Binary files a/app/libs/ASAPCertificate_0.1.0.jar and b/app/libs/ASAPCertificate_0.1.0.jar differ diff --git a/app/src/main/java/net/sharksystem/persons/android/PersonsStorageAndroidComponent.java b/app/src/main/java/net/sharksystem/persons/android/PersonsStorageAndroidComponent.java index 64c52ea..54ac420 100644 --- a/app/src/main/java/net/sharksystem/persons/android/PersonsStorageAndroidComponent.java +++ b/app/src/main/java/net/sharksystem/persons/android/PersonsStorageAndroidComponent.java @@ -41,7 +41,6 @@ public class PersonsStorageAndroidComponent extends FullAsapPKIStorage //ASAPPKIImpl implements ASAPApplicationComponent, PersonsStorage, OwnerFactory /*InMemoPersonsStorageImpl*/ { - public static final String SN_ANDROID_DEFAULT_SIGNING_ALGORITHM = "SHA256withRSA/PSS"; private static final String PERSONS_STORAGE_FILE_NAME = "sn2_personsStorageFile"; private static PersonsStorageAndroidComponent instance = null; @@ -61,8 +60,7 @@ private PersonsStorageAndroidComponent(ASAPApplication asapApplication, asapApplication.getOwnerID(), // id asapApplication.getOwnerName() // name ), - keyStorage, - SN_ANDROID_DEFAULT_SIGNING_ALGORITHM + keyStorage ); // set up component helper diff --git a/app/src/main/java/net/sharksystem/sharknet/android/AndroidASAPKeyStorage.java b/app/src/main/java/net/sharksystem/sharknet/android/AndroidASAPKeyStorage.java index 3b93a17..4403b0e 100644 --- a/app/src/main/java/net/sharksystem/sharknet/android/AndroidASAPKeyStorage.java +++ b/app/src/main/java/net/sharksystem/sharknet/android/AndroidASAPKeyStorage.java @@ -6,19 +6,14 @@ import android.security.keystore.KeyProperties; import android.util.Log; -import net.sharksystem.SharkException; import net.sharksystem.asap.ASAPException; import net.sharksystem.asap.ASAPSecurityException; import net.sharksystem.asap.android.apps.ASAPComponentNotYetInitializedException; import net.sharksystem.asap.util.DateTimeHelper; import net.sharksystem.crypto.ASAPCertificateImpl; import net.sharksystem.crypto.ASAPKeyStorage; -import net.sharksystem.crypto.BasicKeyStore; import net.sharksystem.crypto.InMemoASAPKeyStorage; import net.sharksystem.crypto.SharkCryptoException; -import net.sharksystem.persons.ASAPKeyStoreWithWriteAccess; -import net.sharksystem.persons.ASAPPKI; -import net.sharksystem.persons.SampleFullAsapPKIStorage; import net.sharksystem.persons.android.PersonsStorageAndroidComponent; import java.io.IOException; @@ -38,10 +33,9 @@ /** * Overwrites key creation and add kex persistence to the more general super class */ -public class AndroidASAPKeyStorage extends InMemoASAPKeyStorage -// SampleFullAsapPKIStorage -// implements ASAPKeyStoreWithWriteAccess, ASAPPKI, BasicKeyStore -{ +public class AndroidASAPKeyStorage extends InMemoASAPKeyStorage { + + public static final String SN_ANDROID_DEFAULT_SIGNING_ALGORITHM = "SHA256withRSA/PSS"; private static final String KEYPAIR_CREATION_TIME = "ASAPCertificatesKeyPairCreationTime"; public static final String KEYSTORE_NAME = "AndroidKeyStore"; @@ -70,9 +64,8 @@ public AndroidASAPKeyStorage(Context initialContext, ///////////////////////////////////////////////////////////////////////////////////////////// @Override - public String getRSASigningAlgorithm() { -// return DEFAULT_SIGNATURE_ALGORITHM; - return "SHA256withECDSA"; + public String getAsymmetricSigningAlgorithm() { + return SN_ANDROID_DEFAULT_SIGNING_ALGORITHM; } /* @@ -87,12 +80,17 @@ public String getSymmetricKeyType() { @Override public int getSymmetricKeyLen() { - return DEFAULT_AES_KEY_SIZE; + return DEFAULT_SYMMETRIC_KEY_SIZE; } @Override - public String getRSAEncryptionAlgorithm() { - return DEFAULT_RSA_ENCRYPTION_ALGORITHM; + public String getAsymmetricEncryptionAlgorithm() { + return DEFAULT_ASYMMETRIC_ENCRYPTION_ALGORITHM; + } + + @Override + public String getAsymmetricSigningAlgorithm() { + return DEFAULT_ASYMMETRIC_SIGNATURE_ALGORITHM; } */ @@ -239,7 +237,11 @@ protected void reloadKeys() throws ASAPSecurityException { super.setPrivateKey(privateKeyEntry.getPrivateKey()); super.setPublicKey(privateKeyEntry.getCertificate().getPublicKey()); } catch (KeyStoreException | UnrecoverableEntryException | NoSuchAlgorithmException e) { - throw new ASAPSecurityException(e.getLocalizedMessage()); + Log.d(this.getLogStart(), e.getLocalizedMessage()); + e.printStackTrace(); + + // maybe not generated yet. + this.generateKeyPair(); } }