Package org.xipki.security
Class SecurityFactoryImpl
- java.lang.Object
-
- org.xipki.security.AbstractSecurityFactory
-
- org.xipki.security.SecurityFactoryImpl
-
- All Implemented Interfaces:
SecurityFactory
public class SecurityFactoryImpl extends AbstractSecurityFactory
An implementation ofSecurityFactory.- Since:
- 2.0.0
- Author:
- Lijun Liao (xipki)
-
-
Constructor Summary
Constructors Constructor Description SecurityFactoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeypairGeneratorcreateKeypairGenerator(String type, String conf)Creates keypair generator.ConcurrentContentSignercreateSigner(String type, SignerConf conf, X509Cert[] certificateChain)Creates signer.PublicKeygeneratePublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo subjectPublicKeyInfo)Create PublicKey from thesubjectPublicKeyInfo.org.bouncycastle.operator.ContentVerifierProvidergetContentVerifierProvider(PublicKey publicKey, DHSigStaticKeyCertPair ownerKeyAndCert)Gets the ContentVerifierProvider from the public key.intgetDfltSignerParallelism()org.xipki.password.PasswordResolvergetPasswordResolver()SecureRandomgetRandom4Key()SecureRandomgetRandom4Sign()Set<String>getSupportedKeypairGeneratorTypes()Retrieves the types of supported keypair generators.Set<String>getSupportedSignerTypes()Retrieves the types of supported signers.booleanisStrongRandom4KeyEnabled()booleanisStrongRandom4SignEnabled()voidsetDefaultSignerParallelism(int defaultSignerParallelism)voidsetKeypairGeneratorFactoryRegister(KeypairGeneratorFactoryRegister keypairGeneratorFactoryRegister)voidsetPasswordResolver(org.xipki.password.PasswordResolver passwordResolver)voidsetSignerFactoryRegister(SignerFactoryRegister signerFactoryRegister)voidsetStrongRandom4KeyEnabled(boolean strongRandom4KeyEnabled)voidsetStrongRandom4SignEnabled(boolean strongRandom4SignEnabled)booleanverifyPop(org.bouncycastle.pkcs.PKCS10CertificationRequest csr, AlgorithmValidator algoValidator, DHSigStaticKeyCertPair ownerKeyAndCert)Verifies the signature of CSR.-
Methods inherited from class org.xipki.security.AbstractSecurityFactory
createSigner, getContentVerifierProvider, getContentVerifierProvider, verifyPop, verifyPop, verifyPop
-
-
-
-
Method Detail
-
getSupportedSignerTypes
public Set<String> getSupportedSignerTypes()
Description copied from interface:SecurityFactoryRetrieves the types of supported signers.- Returns:
- lower-case types of supported signers, never
null.
-
isStrongRandom4KeyEnabled
public boolean isStrongRandom4KeyEnabled()
-
setStrongRandom4KeyEnabled
public void setStrongRandom4KeyEnabled(boolean strongRandom4KeyEnabled)
-
isStrongRandom4SignEnabled
public boolean isStrongRandom4SignEnabled()
-
setStrongRandom4SignEnabled
public void setStrongRandom4SignEnabled(boolean strongRandom4SignEnabled)
-
createSigner
public ConcurrentContentSigner createSigner(String type, SignerConf conf, X509Cert[] certificateChain) throws org.xipki.util.exception.ObjectCreationException
Description copied from interface:SecurityFactoryCreates signer.- Parameters:
type- Type of the signer. Must not benull.conf- Configuration of the signer. Could benull.certificateChain- Certificates of the signer. If notnull, it will be used; otherwise the certificates contained in the token will be used.- Returns:
- the new signer
- Throws:
org.xipki.util.exception.ObjectCreationException- if could not create the signer
-
getSupportedKeypairGeneratorTypes
public Set<String> getSupportedKeypairGeneratorTypes()
Description copied from interface:SecurityFactoryRetrieves the types of supported keypair generators.- Returns:
- lower-case types of supported keypair generators, never
null.
-
createKeypairGenerator
public KeypairGenerator createKeypairGenerator(String type, String conf) throws org.xipki.util.exception.ObjectCreationException
Description copied from interface:SecurityFactoryCreates keypair generator.- Parameters:
type- Type of the generator. Must not benull.conf- Configuration of the generator. Could benull.- Returns:
- the new keypair generator
- Throws:
org.xipki.util.exception.ObjectCreationException- if could not create the keypair generator
-
getContentVerifierProvider
public org.bouncycastle.operator.ContentVerifierProvider getContentVerifierProvider(PublicKey publicKey, DHSigStaticKeyCertPair ownerKeyAndCert) throws InvalidKeyException
Description copied from interface:SecurityFactoryGets the ContentVerifierProvider from the public key.- Parameters:
publicKey- Signature verification key. Must not benull.ownerKeyAndCert- The owner's key and certificate for the CSR with Diffie-Hellman PoP. May benull.- Returns:
- the ContentVerifierProvider
- Throws:
InvalidKeyException- If the publicKey is invalid or unsupported.
-
generatePublicKey
public PublicKey generatePublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo subjectPublicKeyInfo) throws InvalidKeyException
Description copied from interface:SecurityFactoryCreate PublicKey from thesubjectPublicKeyInfo.- Parameters:
subjectPublicKeyInfo- From which the public key will be created. Must not benull.- Returns:
- the created public key.
- Throws:
InvalidKeyException- if could not create public key.
-
verifyPop
public boolean verifyPop(org.bouncycastle.pkcs.PKCS10CertificationRequest csr, AlgorithmValidator algoValidator, DHSigStaticKeyCertPair ownerKeyAndCert)Description copied from interface:SecurityFactoryVerifies the signature of CSR.- Parameters:
csr- CSR to be verified. Must not benull.algoValidator- Signature algorithms validator.nullto accept all algorithmsownerKeyAndCert- The owner's key and certificate for the CSR with Diffie-Hellman PoP. May benull.- Returns:
trueif the signature is valid and the signature algorithm is accepted,falseotherwise.
-
getDfltSignerParallelism
public int getDfltSignerParallelism()
-
setDefaultSignerParallelism
public void setDefaultSignerParallelism(int defaultSignerParallelism)
-
setSignerFactoryRegister
public void setSignerFactoryRegister(SignerFactoryRegister signerFactoryRegister)
-
setKeypairGeneratorFactoryRegister
public void setKeypairGeneratorFactoryRegister(KeypairGeneratorFactoryRegister keypairGeneratorFactoryRegister)
-
setPasswordResolver
public void setPasswordResolver(org.xipki.password.PasswordResolver passwordResolver)
-
getPasswordResolver
public org.xipki.password.PasswordResolver getPasswordResolver()
-
getRandom4Key
public SecureRandom getRandom4Key()
-
getRandom4Sign
public SecureRandom getRandom4Sign()
-
-