Skip to content

Commit e5b46ea

Browse files
committed
widened RSA private key support - relates to github #1528
1 parent d7d5e73 commit e5b46ea

File tree

1 file changed

+2
-2
lines changed
  • prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/rsa

1 file changed

+2
-2
lines changed

prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.bouncycastle.crypto.engines.RSABlindedEngine;
3333
import org.bouncycastle.crypto.params.ParametersWithRandom;
3434
import org.bouncycastle.crypto.params.RSAKeyParameters;
35-
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters;
3635
import org.bouncycastle.crypto.tls.TlsRsaKeyExchange;
3736
import org.bouncycastle.jcajce.provider.asymmetric.util.BaseCipherSpi;
3837
import org.bouncycastle.jcajce.provider.util.BadBlockException;
@@ -335,10 +334,11 @@ else if (key instanceof RSAPrivateKey)
335334
}
336335
else if (params instanceof TLSRSAPremasterSecretParameterSpec)
337336
{
338-
if (!(param instanceof RSAPrivateCrtKeyParameters))
337+
if (!(param instanceof RSAKeyParameters) || !((RSAKeyParameters)param).isPrivate())
339338
{
340339
throw new InvalidKeyException("RSA private key required for TLS decryption");
341340
}
341+
342342
this.tlsRsaSpec = (TLSRSAPremasterSecretParameterSpec)params;
343343
}
344344
}

0 commit comments

Comments
 (0)