Skip to content
Merged
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
Original file line numberDiff line numberDiff line change
Expand Up@@ -590,7 +590,7 @@ public KMOperation createSymmetricCipher(short alg, short purpose, short macLeng
poolMgr.getOperationImpl(purpose, cipherAlg, alg, padding, blockMode, macLength, secretLength, false);

KMKeyObject keyObj = operation.getKeyObject();
Key key = (Key)keyObj.getKeyObject();
Key key = (Key)keyObj.getKeyObjectInstance();
switch (secretLength) {
case 32:
case 16:
Expand All@@ -616,7 +616,7 @@ public KMOperation createHmacSignerVerifier(short purpose, short digest,
poolMgr.getOperationImpl(purpose, Signature.ALG_HMAC_SHA_256,
KMType.HMAC, KMType.INVALID_VALUE, KMType.INVALID_VALUE, KMType.INVALID_VALUE, (short)0, false);
KMKeyObject keyObj = operation.getKeyObject();
HMACKey key = (HMACKey)keyObj.getKeyObject();
HMACKey key = (HMACKey)keyObj.getKeyObjectInstance();
key.setKey(secret, secretStart, secretLength);
((KMOperationImpl) operation).init(key, digest, null, (short) 0, (short) 0);
return operation;
Expand DownExpand Up@@ -671,7 +671,7 @@ public KMOperation createRsaSigner(short digest, short padding, byte[] secret,
KMOperation operation = poolMgr.getOperationImpl(KMType.SIGN, alg, KMType.RSA, padding,
KMType.INVALID_VALUE, KMType.INVALID_VALUE, secretLength, false);
KMKeyObject keyObj = operation.getKeyObject();
RSAPrivateKey key = (RSAPrivateKey)((KeyPair)(keyObj.getKeyObject())).getPrivate();
RSAPrivateKey key = (RSAPrivateKey)((KeyPair)(keyObj.getKeyObjectInstance())).getPrivate();
key.setExponent(secret, secretStart, secretLength);
key.setModulus(modBuffer, modOff, modLength);
((KMOperationImpl) operation).init(key, digest, null, (short) 0, (short) 0);
Expand All@@ -685,7 +685,7 @@ public KMOperation createRsaDecipher(short padding, short mgfDigest, byte[] secr
KMOperation operation = poolMgr.getOperationImpl(KMType.DECRYPT, cipherAlg, KMType.RSA, padding,
KMType.INVALID_VALUE, KMType.INVALID_VALUE, secretLength, false);
KMKeyObject keyObj = operation.getKeyObject();
RSAPrivateKey key = (RSAPrivateKey) ((KeyPair)(keyObj.getKeyObject())).getPrivate();
RSAPrivateKey key = (RSAPrivateKey) ((KeyPair)(keyObj.getKeyObjectInstance())).getPrivate();
key.setExponent(secret, secretStart, secretLength);
key.setModulus(modBuffer, modOff, modLength);
((KMOperationImpl) operation).init(key, KMType.INVALID_VALUE, null, (short) 0, (short) 0);
Expand All@@ -699,7 +699,7 @@ public KMOperation createEcSigner(short digest, byte[] secret,
.getOperationImpl(KMType.SIGN, alg, KMType.EC, KMType.INVALID_VALUE,
KMType.INVALID_VALUE, KMType.INVALID_VALUE, secretLength, false);
KMKeyObject keyObj = operation.getKeyObject();
ECPrivateKey key = (ECPrivateKey) ((KeyPair)(keyObj.getKeyObject())).getPrivate();
ECPrivateKey key = (ECPrivateKey) ((KeyPair)(keyObj.getKeyObjectInstance())).getPrivate();
key.setS(secret, secretStart, secretLength);
((KMOperationImpl) operation).init(key, digest, null, (short) 0, (short) 0);
return operation;
Expand All@@ -711,7 +711,7 @@ public KMOperation createKeyAgreement(byte[] secret, short secretStart,
.getOperationImpl(KMType.AGREE_KEY, KeyAgreement.ALG_EC_SVDP_DH_PLAIN,
KMType.EC, KMType.INVALID_VALUE, KMType.INVALID_VALUE, KMType.INVALID_VALUE, (short)0, false);
KMKeyObject keyObj = operation.getKeyObject();
ECPrivateKey key = (ECPrivateKey) ((KeyPair)(keyObj.getKeyObject())).getPrivate();
ECPrivateKey key = (ECPrivateKey) ((KeyPair)(keyObj.getKeyObjectInstance())).getPrivate();
key.setS(secret, secretStart, secretLength);
((KMOperationImpl) operation).init(key, KMType.INVALID_VALUE, null, (short) 0, (short) 0);
return operation;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@ public byte getAlgorithm() {
return this.algorithm;
}

public Object getKeyObject() {
public Object getKeyObjectInstance() {
return keyObjectInst;
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -447,7 +447,7 @@ public KMOperation getOperationImpl(short purpose, short alg, short strongboxAlg
maxOperations = HMAC_MAX_OPERATION_INSTANCES;
}

KMKeyObject keyObject = reserveKeyObject(alg, secretLength, maxOperations);
KMKeyObject keyObject = getKeyObjectFromPool(alg, secretLength, maxOperations);
while (index < pool.length) {
if (usageCount >= maxOperations) {
KMException.throwIt(KMError.TOO_MANY_OPERATIONS);
Expand DownExpand Up@@ -475,7 +475,7 @@ public KMOperation getOperationImpl(short purpose, short alg, short strongboxAlg
return operation;
}

public KMKeyObject reserveKeyObject(short alg, short secretLength, short maxOperations) {
public KMKeyObject getKeyObjectFromPool(short alg, short secretLength, short maxOperations) {
KMKeyObject keyObject = null;
byte algo = mapAlgorithm(alg, secretLength);
short index = 0;
Expand Down