Skip to content

Commit

Permalink
Sign and encrypt works - going to debug decrypt and verify now.
Browse files Browse the repository at this point in the history
  • Loading branch information
thsc42 committed Sep 24, 2020
1 parent ae105ca commit ab2b3b2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file modified ASAPAndroidService/ASAPService_0.1.1.aar
Binary file not shown.
Binary file modified app/libs/ASAPCertificate_0.1.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -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;
}

/*
Expand All @@ -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;
}
*/

Expand Down Expand Up @@ -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();
}
}

Expand Down

0 comments on commit ab2b3b2

Please sign in to comment.