public final class SecurityUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
BOUNCY_CASTLE |
public static final String BOUNCY_CASTLE
public static boolean hasEcc()
public static void setSecurityProvider(String securityProvider)
public static void setRegisterBouncyCastle(boolean registerBouncyCastle)
public static String getSecurityProvider()
public static boolean isBouncyCastleRegistered()
public static KeyPair loadKeyPairIdentity(String resourceKey, InputStream inputStream, FilePasswordProvider provider) throws IOException, GeneralSecurityException
resourceKey - An identifier of the key being loaded - used as
argument to the FilePasswordProvider.getPassword(String)
invocationinputStream - The InputStream for the private keyprovider - A FilePasswordProvider - may be null
if the loaded key is guaranteed not to be encryptedKeyPairIOException - If failed to read/parse the input streamGeneralSecurityException - If failed to generate the keys - specifically,
NoSuchProviderException is thrown also if isBouncyCastleRegistered()
is falsepublic static AbstractFileKeyPairProvider createFileKeyPairProvider()
public static AbstractClassLoadableResourceKeyPairProvider createClassLoadableResourceKeyPairProvider()
public static AbstractGeneratorHostKeyProvider createGeneratorHostKeyProvider(Path path)
public static RandomFactory getRandomFactory()
isBouncyCastleRegistered() then a BouncyCastleRandomFactory
instance, otherwise a JceRandomFactory onepublic static KeyFactory getKeyFactory(String algorithm) throws GeneralSecurityException
GeneralSecurityExceptionpublic static Cipher getCipher(String transformation) throws GeneralSecurityException
GeneralSecurityExceptionpublic static MessageDigest getMessageDigest(String algorithm) throws GeneralSecurityException
GeneralSecurityExceptionpublic static KeyPairGenerator getKeyPairGenerator(String algorithm) throws GeneralSecurityException
GeneralSecurityExceptionpublic static KeyAgreement getKeyAgreement(String algorithm) throws GeneralSecurityException
GeneralSecurityExceptionpublic static Mac getMac(String algorithm) throws GeneralSecurityException
GeneralSecurityExceptionpublic static Signature getSignature(String algorithm) throws GeneralSecurityException
GeneralSecurityExceptionCopyright © 2008–2015 The Apache Software Foundation. All rights reserved.