Skip to content

Commit

Permalink
Merge pull request #997 from /issues/996-dead-local-store
Browse files Browse the repository at this point in the history
Fix #996: Coverity: Dead local store
  • Loading branch information
banterCZ authored Sep 4, 2023
2 parents 799e961 + 178e5c3 commit 6aa1791
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@
import io.getlime.security.powerauth.app.server.converter.ServerPrivateKeyConverter;
import io.getlime.security.powerauth.app.server.converter.SignatureTypeConverter;
import io.getlime.security.powerauth.app.server.database.RepositoryCatalogue;
import io.getlime.security.powerauth.app.server.database.model.enumeration.ActivationStatus;
import io.getlime.security.powerauth.app.server.database.model.enumeration.EncryptionMode;
import io.getlime.security.powerauth.app.server.database.model.ServerPrivateKey;
import io.getlime.security.powerauth.app.server.database.model.entity.ActivationRecordEntity;
import io.getlime.security.powerauth.app.server.database.model.entity.ApplicationVersionEntity;
import io.getlime.security.powerauth.app.server.database.model.entity.TokenEntity;
import io.getlime.security.powerauth.app.server.database.model.enumeration.ActivationStatus;
import io.getlime.security.powerauth.app.server.database.model.enumeration.EncryptionMode;
import io.getlime.security.powerauth.app.server.database.model.enumeration.UniqueValueType;
import io.getlime.security.powerauth.app.server.service.replay.ReplayVerificationService;
import io.getlime.security.powerauth.app.server.service.exceptions.GenericServiceException;
import io.getlime.security.powerauth.app.server.service.i18n.LocalizationProvider;
import io.getlime.security.powerauth.app.server.service.model.ServiceError;
import io.getlime.security.powerauth.app.server.service.model.TokenInfo;
import io.getlime.security.powerauth.app.server.service.replay.ReplayVerificationService;
import io.getlime.security.powerauth.crypto.lib.encryptor.EncryptorFactory;
import io.getlime.security.powerauth.crypto.lib.encryptor.ServerEncryptor;
import io.getlime.security.powerauth.crypto.lib.encryptor.exception.EncryptorException;
Expand All @@ -64,11 +64,9 @@
import org.springframework.stereotype.Component;

import javax.crypto.SecretKey;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.ECPrivateKey;
import java.security.spec.InvalidKeySpecException;
import java.util.Base64;
import java.util.Calendar;
Expand Down Expand Up @@ -213,8 +211,8 @@ private EncryptedResponse createToken(String activationId, String applicationKey
new EncryptorParameters(version, applicationKey, activationId),
new ServerEncryptorSecrets(serverPrivateKey, applicationVersion.getApplicationSecret(), transportKeyBytes)
);
// Try to decrypt request data, the data must not be empty. Currently only '{}' is sent in request data.
final byte[] decryptedData = serverEncryptor.decryptRequest(encryptedRequest);
// Try to decrypt request data, the data must not be empty. Currently only '{}' is sent in request data. Ignore result of decryption.
serverEncryptor.decryptRequest(encryptedRequest);

// Generate unique token ID.
String tokenId = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ public StartUpgradeResponse startUpgrade(StartUpgradeRequest request) throws Gen
new ServerEncryptorSecrets(serverPrivateKey, applicationVersion.getApplicationSecret(), transportKeyBytes)
);

// Try to decrypt request data, the data must not be empty. Currently only '{}' is sent in request data.
final byte[] decryptedData = serverEncryptor.decryptRequest(encryptedRequest);
// Try to decrypt request data, the data must not be empty. Currently only '{}' is sent in request data. Ignore result of decryption.
serverEncryptor.decryptRequest(encryptedRequest);

// Request is valid, generate hash based counter if it does not exist yet
final String ctrDataBase64;
Expand Down

0 comments on commit 6aa1791

Please sign in to comment.