Skip to content

Commit

Permalink
Fix IDE warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
demsey committed Jan 2, 2015
1 parent 188d7ce commit 5c3ed94
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ public byte[] generateMAC(byte[] data, Key kd, String macAlgorithm) throws JCEHa
* Class used for indexing MAC algorithms in cache
*/
protected static class MacEngineKey {
private String macAlgorithm;
private Key macKey;
private final String macAlgorithm;
private final Key macKey;

protected MacEngineKey(String macAlgorithm, Key macKey) {
this.macAlgorithm = macAlgorithm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public JCESecurityModule (Configuration cfg, Logger logger, String realm) throws
* ANSI X9.19<br>
* @throws ConfigurationException
*/
@Override
public void setConfiguration (Configuration cfg) throws ConfigurationException {
this.cfg = cfg;
try {
Expand All @@ -177,13 +178,15 @@ public void setConfiguration (Configuration cfg) throws ConfigurationException {
}
}

@Override
public SecureDESKey generateKeyImpl (short keyLength, String keyType) throws SMException {
SecureDESKey generatedSecureKey = null;
Key generatedClearKey = jceHandler.generateDESKey(keyLength);
generatedSecureKey = encryptToLMK(keyLength, keyType, generatedClearKey);
return generatedSecureKey;
}

@Override
public SecureDESKey importKeyImpl (short keyLength, String keyType, byte[] encryptedKey,
SecureDESKey kek, boolean checkParity) throws SMException {
SecureDESKey importedKey = null;
Expand All @@ -195,6 +198,7 @@ public SecureDESKey importKeyImpl (short keyLength, String keyType, byte[] encry
return importedKey;
}

@Override
public byte[] exportKeyImpl (SecureDESKey key, SecureDESKey kek) throws SMException {
byte[] exportedKey = null;
// get key in clear
Expand Down Expand Up @@ -245,6 +249,7 @@ private static KeyScheme getScheme (int keyLength, String keyType) {
return scheme;
}

@Override
public EncryptedPIN encryptPINImpl (String pin, String accountNumber) throws SMException {
EncryptedPIN encryptedPIN = null;
byte[] clearPINBlock = calculatePINBlock(pin, FORMAT00, accountNumber);
Expand All @@ -254,6 +259,7 @@ public EncryptedPIN encryptPINImpl (String pin, String accountNumber) throws SME
return encryptedPIN;
}

@Override
public String decryptPINImpl (EncryptedPIN pinUnderLmk) throws SMException {
String pin = null;
byte[] clearPINBlock = jceHandler.decryptData(pinUnderLmk.getPINBlock(),
Expand All @@ -262,6 +268,7 @@ public String decryptPINImpl (EncryptedPIN pinUnderLmk) throws SMException {
return pin;
}

@Override
public EncryptedPIN importPINImpl (EncryptedPIN pinUnderKd1, SecureDESKey kd1) throws SMException {
EncryptedPIN pinUnderLmk = null;
// read inputs
Expand All @@ -283,6 +290,7 @@ public EncryptedPIN importPINImpl (EncryptedPIN pinUnderKd1, SecureDESKey kd1) t
return pinUnderLmk;
}

@Override
public EncryptedPIN exportPINImpl (EncryptedPIN pinUnderLmk, SecureDESKey kd2,
byte destinationPINBlockFormat) throws SMException {
EncryptedPIN exportedPIN = null;
Expand Down Expand Up @@ -871,6 +879,7 @@ private boolean isVSDCPinBlockFormat(byte pinBlockFormat) {
* @return generated CBC-MAC bytes
* @throws SMException
*/
@Override
protected byte[] generateCBC_MACImpl (byte[] data, SecureDESKey kd) throws SMException {
LogEvent evt = new LogEvent(this, "jce-provider-cbc-mac");
try {
Expand All @@ -890,6 +899,7 @@ protected byte[] generateCBC_MACImpl (byte[] data, SecureDESKey kd) throws SMExc
* @return generated EDE-MAC bytes
* @throws SMException
*/
@Override
protected byte[] generateEDE_MACImpl (byte[] data, SecureDESKey kd) throws SMException {
LogEvent evt = new LogEvent(this, "jce-provider-ede-mac");
try {
Expand Down Expand Up @@ -949,6 +959,7 @@ String generateClearKeyComponent (short keyLength) throws SMException {
* @return generated Key Check Value
* @throws SMException
*/
@Override
protected byte[] generateKeyCheckValueImpl (SecureDESKey secureDESKey) throws SMException {
return calculateKeyCheckValue(decryptFromLMK(secureDESKey));
}
Expand Down Expand Up @@ -1596,7 +1607,7 @@ private SecretKey getLMK (Integer lmkIndex) throws SMException {
/**
* The clear Local Master Keys
*/
private Map<Integer,SecretKey> lmks = new TreeMap<Integer,SecretKey>();
private final Map<Integer,SecretKey> lmks = new TreeMap<Integer,SecretKey>();
/**
* A index for the LMK used to encrypt the PINs
*/
Expand Down Expand Up @@ -1926,6 +1937,7 @@ private KeySerialNumber getKSN(String s)
);
}

@Override
protected EncryptedPIN translatePINImpl
(EncryptedPIN pinUnderDuk, KeySerialNumber ksn,
SecureDESKey bdk, SecureDESKey kd2, byte destinationPINBlockFormat)
Expand Down

0 comments on commit 5c3ed94

Please sign in to comment.