Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementación de firma por lotes (batchsign) #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion afirma-ui-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dependencies {
implementation 'es.gob.afirma:afirma-crypto-cades-multi:1.6.5'
implementation 'es.gob.afirma:afirma-crypto-core-pkcs7:1.6.5'
implementation 'es.gob.afirma:afirma-crypto-core-pkcs7-tsp:1.6.5'
implementation 'es.gob.afirma:afirma-crypto-batch-client:1.6.5'
implementation 'es.gob.afirma.jmulticard:jmulticard-jse:1.5'

//implementation 'com.android.support:multidex:1.0.3'
Expand All @@ -69,4 +70,4 @@ dependencies {
//androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

//apply plugin: 'com.google.gms.google-services'
//apply plugin: 'com.google.gms.google-services'
17 changes: 16 additions & 1 deletion afirma-ui-android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="es.gob.afirma">

<!-- Permisos normales -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.NFC" />
Expand Down Expand Up @@ -60,6 +59,22 @@
<activity
android:name=".android.LocalSignResultActivity"
android:label="@string/title_activity_save_data" />
<activity
android:name=".android.WebBatchSignActivity"
android:label="@string/title_activity_sign_data"
android:theme="@style/Theme.AppCompat">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="es.gob.afirma.android.SIGN_SERVICE" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="batchsign"
android:scheme="afirma" />
</intent-filter>
</activity>
<activity
android:name=".android.WebSignActivity"
android:label="@string/title_activity_sign_data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public abstract class SignFragmentActivity extends LoadKeyStoreFragmentActivity
private String format = null;
private String algorithm = null;
private Properties extraParams = null;
protected PrivateKeyEntry pke;

/**
* Inicia el proceso de firma.
Expand All @@ -58,7 +59,7 @@ public void sign(String signOperation, final byte[] data, final String format,
throw new IllegalArgumentException("No se han indicado la operacion de firma");
}
try {
this.signOperation = Operation.valueOf(signOperation);
this.signOperation = Operation.valueOf(signOperation.toUpperCase());
}
catch (Exception e) {
throw new IllegalArgumentException(String.format(
Expand All @@ -82,13 +83,17 @@ public void sign(String signOperation, final byte[] data, final String format,
this.extraParams = extraParams;

// Iniciamos la carga del almacen
loadKeyStore(this);
if (pke != null)
doSign(pke);
else
loadKeyStore(this);
}

@Override
public synchronized void keySelected(final SelectCertificateEvent kse) {

PrivateKeyEntry pke;
Logger.i(ES_GOB_AFIRMA, " -- SignFragmentActivity keySelected");

try {
pke = kse.getPrivateKeyEntry();
}
Expand Down
Loading