use of java.security.ProviderException in project android_frameworks_base by AOSPA.
the class AndroidKeyStoreKeyPairGeneratorSpi method generateKeystoreKeyPair.
private void generateKeystoreKeyPair(final String privateKeyAlias, KeymasterArguments args, byte[] additionalEntropy, final int flags) throws ProviderException {
KeyCharacteristics resultingKeyCharacteristics = new KeyCharacteristics();
int errorCode = mKeyStore.generateKey(privateKeyAlias, args, additionalEntropy, mEntryUid, flags, resultingKeyCharacteristics);
if (errorCode != KeyStore.NO_ERROR) {
throw new ProviderException("Failed to generate key pair", KeyStore.getKeyStoreException(errorCode));
}
}
use of java.security.ProviderException in project robovm by robovm.
the class ProviderExceptionTest method testProviderException09.
/**
* Test for <code>ProviderException(String, Throwable)</code> constructor
* Assertion: constructs ProviderException when <code>cause</code> is not
* null <code>msg</code> is not null
*/
public void testProviderException09() {
ProviderException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new ProviderException(msgs[i], tCause);
String getM = tE.getMessage();
String toS = tCause.toString();
if (msgs[i].length() > 0) {
assertTrue("getMessage() must contain ".concat(msgs[i]), getM.indexOf(msgs[i]) != -1);
if (!getM.equals(msgs[i])) {
assertTrue("getMessage() should contain ".concat(toS), getM.indexOf(toS) != -1);
}
}
assertNotNull("getCause() must not return null", tE.getCause());
assertEquals("getCause() must return ".concat(tCause.toString()), tE.getCause(), tCause);
}
}
use of java.security.ProviderException in project robovm by robovm.
the class ProviderExceptionTest method testProviderException04.
/**
* Test for <code>ProviderException(Throwable)</code> constructor
* Assertion: constructs ProviderException when <code>cause</code> is null
*/
public void testProviderException04() {
Throwable cause = null;
ProviderException tE = new ProviderException(cause);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
}
use of java.security.ProviderException in project jdk8u_jdk by JetBrains.
the class RSAPublicKey method getPublicExponent.
/**
* Returns the public exponent.
*/
public BigInteger getPublicExponent() {
if (exponent == null) {
try {
publicKeyBlob = getPublicKeyBlob(handles.hCryptKey);
exponent = new BigInteger(1, getExponent(publicKeyBlob));
} catch (KeyException e) {
throw new ProviderException(e);
}
}
return exponent;
}
use of java.security.ProviderException in project jdk8u_jdk by JetBrains.
the class RSAPublicKey method getModulus.
/**
* Returns the modulus.
*/
public BigInteger getModulus() {
if (modulus == null) {
try {
publicKeyBlob = getPublicKeyBlob(handles.hCryptKey);
modulus = new BigInteger(1, getModulus(publicKeyBlob));
} catch (KeyException e) {
throw new ProviderException(e);
}
}
return modulus;
}
Aggregations