- java.lang.Object
-
- com.appslandia.common.base.InitializeObject
-
- com.appslandia.common.crypto.KeyFactoryUtil
-
- All Implemented Interfaces:
InitializeSupport
public class KeyFactoryUtil extends InitializeObject
- Author:
- Loc Ha
-
-
Field Summary
Fields Modifier and Type Field Description static KeyFactoryUtilDSAstatic KeyFactoryUtilRSA
-
Constructor Summary
Constructors Constructor Description KeyFactoryUtil()KeyFactoryUtil(String algorithm)KeyFactoryUtil(String algorithm, String provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PrivateKeycopy(PrivateKey key)PublicKeycopy(PublicKey key)protected voidinit()KeyFactoryUtilsetAlgorithm(String algorithm)KeyFactoryUtilsetProvider(String provider)PrivateKeytoPrivateKey(InputStream keyInDer)PrivateKeytoPrivateKey(String keyInPem)PublicKeytoPublicKey(InputStream keyInDer)PublicKeytoPublicKey(String keyInPem)-
Methods inherited from class com.appslandia.common.base.InitializeObject
assertNotInitialized, destroy, initialize
-
-
-
-
Field Detail
-
DSA
public static final KeyFactoryUtil DSA
-
RSA
public static final KeyFactoryUtil RSA
-
-
Method Detail
-
init
protected void init() throws Exception- Specified by:
initin classInitializeObject- Throws:
Exception
-
toPrivateKey
public PrivateKey toPrivateKey(String keyInPem) throws CryptoException
- Throws:
CryptoException
-
toPrivateKey
public PrivateKey toPrivateKey(InputStream keyInDer) throws IOException, CryptoException
- Throws:
IOExceptionCryptoException
-
toPublicKey
public PublicKey toPublicKey(String keyInPem) throws CryptoException
- Throws:
CryptoException
-
toPublicKey
public PublicKey toPublicKey(InputStream keyInDer) throws IOException, CryptoException
- Throws:
IOExceptionCryptoException
-
copy
public PrivateKey copy(PrivateKey key) throws CryptoException
- Throws:
CryptoException
-
copy
public PublicKey copy(PublicKey key) throws CryptoException
- Throws:
CryptoException
-
setAlgorithm
public KeyFactoryUtil setAlgorithm(String algorithm)
-
setProvider
public KeyFactoryUtil setProvider(String provider)
-
-