Skip to content

Commit

Permalink
adress comments
Browse files Browse the repository at this point in the history
  • Loading branch information
weijjia committed Apr 19, 2016
1 parent 0baf4e7 commit 2e06bfc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/src/com/microsoft/aad/adal/StorageHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import java.security.KeyStoreException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
Expand Down Expand Up @@ -452,7 +453,8 @@ final synchronized private SecretKey getSecretKeyFromAndroidKeyStore() throws IO
// the key data is wiped, if this is the case, the retrieved keypair will
// be empty, and when we use the private key to do unwrap, we'll encounter
// IllegalArgumentException
if (mKeyPair.getPrivate() == null || mKeyPair.getPrivate().getEncoded().length == 0) {
final PrivateKey privateKey = mKeyPair.getPrivate();
if (privateKey == null || privateKey.getEncoded() == null || privateKey.getEncoded().length == 0) {
throw new UnrecoverableKeyException("Retrieved private key is empty.");
}

Expand Down

0 comments on commit 2e06bfc

Please sign in to comment.