List of usage examples for java.security.interfaces ECPrivateKey getS
BigInteger getS();
From source file:org.cesecore.keys.util.KeyTools.java
/** * Test if a private key is extractable (could be stored). * //w ww. ja v a 2s .co m * @param privK * key to test. * @return true if the key is extractable. */ public static boolean isPrivateKeyExtractable(final PrivateKey privK) { if (privK instanceof RSAPrivateKey) { final RSAPrivateKey rsa = (RSAPrivateKey) privK; final BigInteger result = rsa.getPrivateExponent(); return result != null && result.bitLength() > 0; } if (privK instanceof ECPrivateKey) { final ECPrivateKey ec = (ECPrivateKey) privK; final BigInteger result = ec.getS(); return result != null && result.bitLength() > 0; } if (privK instanceof DHPrivateKey) { final DHPrivateKey dh = (DHPrivateKey) privK; final BigInteger result = dh.getX(); return result != null && result.bitLength() > 0; } if (privK instanceof DSAPrivateKey) { final DSAPrivateKey dsa = (DSAPrivateKey) privK; final BigInteger result = dsa.getX(); return result != null && result.bitLength() > 0; } return false; }