public class SecurityFactoryImpl extends AbstractSecurityFactory
SecurityFactory.| Constructor and Description |
|---|
SecurityFactoryImpl() |
| Modifier and Type | Method and Description |
|---|---|
KeyCertPair |
createPrivateKeyAndCert(String type,
SignerConf conf,
X509Cert cert)
Create secret key and certificate pair.
|
ConcurrentContentSigner |
createSigner(String type,
SignerConf conf,
X509Cert[] certificateChain)
Creates signer.
|
byte[] |
extractMinimalKeyStore(String keystoreType,
byte[] keystoreBytes,
String keyname,
char[] password,
X509Cert[] newCertChain)
Extracts the keystore with minimal required information.
|
PublicKey |
generatePublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo subjectPublicKeyInfo)
Create PublicKey from the
subjectPublicKeyInfo. |
org.bouncycastle.operator.ContentVerifierProvider |
getContentVerifierProvider(PublicKey publicKey,
DHSigStaticKeyCertPair ownerKeyAndCert)
Gets the ContentVerifierProvider from the public key.
|
int |
getDfltSignerParallelism() |
org.xipki.password.PasswordResolver |
getPasswordResolver() |
SecureRandom |
getRandom4Key() |
SecureRandom |
getRandom4Sign() |
Set<String> |
getSupportedSignerTypes()
Retrieves the types of supported signers.
|
boolean |
isStrongRandom4KeyEnabled() |
boolean |
isStrongRandom4SignEnabled() |
void |
refreshTokenForSignerType(String signerType) |
void |
setDefaultSignerParallelism(int defaultSignerParallelism) |
void |
setPasswordResolver(org.xipki.password.PasswordResolver passwordResolver) |
void |
setSignerFactoryRegister(SignerFactoryRegister signerFactoryRegister) |
void |
setStrongRandom4KeyEnabled(boolean strongRandom4KeyEnabled) |
void |
setStrongRandom4SignEnabled(boolean strongRandom4SignEnabled) |
boolean |
verifyPopo(org.bouncycastle.pkcs.PKCS10CertificationRequest csr,
AlgorithmValidator algoValidator,
DHSigStaticKeyCertPair ownerKeyAndCert)
Verifies the signature of CSR.
|
createSigner, getContentVerifierProvider, getContentVerifierProvider, verifyPopo, verifyPopo, verifyPopopublic Set<String> getSupportedSignerTypes()
SecurityFactorynull.public boolean isStrongRandom4KeyEnabled()
public void setStrongRandom4KeyEnabled(boolean strongRandom4KeyEnabled)
public boolean isStrongRandom4SignEnabled()
public void setStrongRandom4SignEnabled(boolean strongRandom4SignEnabled)
public ConcurrentContentSigner createSigner(String type, SignerConf conf, X509Cert[] certificateChain) throws org.xipki.util.ObjectCreationException
SecurityFactorytype - Type of the signer. Must not be null.conf - Configuration of the signer. Could be null.certificateChain - Certificates of the signer. If not null, it will be used; otherwise
the certificates contained in the token will be used.org.xipki.util.ObjectCreationException - if could not create the signerpublic org.bouncycastle.operator.ContentVerifierProvider getContentVerifierProvider(PublicKey publicKey, DHSigStaticKeyCertPair ownerKeyAndCert) throws InvalidKeyException
SecurityFactorypublicKey - Signature verification key. Must not be null.ownerKeyAndCert - The owner's key and certificate for the CSR with Diffie-Hellman PoC.
May be null.InvalidKeyException - If the publicKey is invalid or unsupported.public PublicKey generatePublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo subjectPublicKeyInfo) throws InvalidKeyException
SecurityFactorysubjectPublicKeyInfo.subjectPublicKeyInfo - From which the public key will be created. Must not be null.InvalidKeyException - if could not create public key.public boolean verifyPopo(org.bouncycastle.pkcs.PKCS10CertificationRequest csr,
AlgorithmValidator algoValidator,
DHSigStaticKeyCertPair ownerKeyAndCert)
SecurityFactorycsr - CSR to be verified. Must not be null.algoValidator - Signature algorithms validator. null to accept all algorithmsownerKeyAndCert - The owner's key and certificate for the CSR with Diffie-Hellman PoC.
May be null.true if the signature is valid and the signature algorithm is accepted,
false otherwise.public int getDfltSignerParallelism()
public void setDefaultSignerParallelism(int defaultSignerParallelism)
public void setSignerFactoryRegister(SignerFactoryRegister signerFactoryRegister)
public void setPasswordResolver(org.xipki.password.PasswordResolver passwordResolver)
public org.xipki.password.PasswordResolver getPasswordResolver()
public KeyCertPair createPrivateKeyAndCert(String type, SignerConf conf, X509Cert cert) throws org.xipki.util.ObjectCreationException
SecurityFactorytype - Type of the signer. Must not be null.conf - Configuration of the signer. Could be null.cert - Certificate of the signer. If not null, it will be used; otherwise
the certificates contained in the token will be used.org.xipki.util.ObjectCreationException - if could not create the objectpublic SecureRandom getRandom4Key()
public SecureRandom getRandom4Sign()
public byte[] extractMinimalKeyStore(String keystoreType, byte[] keystoreBytes, String keyname, char[] password, X509Cert[] newCertChain) throws KeyStoreException
SecurityFactorykeyname is set, and its associated entry is a key entry, then only this
entry is remained.keyname is null and there exists at least one key entry, then only
the first entry is remained.KeyStoreException will be thrown.keystoreType - Type of the keystore. Must not be null.keystoreBytes - Content of the keystpre. Must not be null.keyname - Name (alias) of the key. Could be null.password - Password of the keystore and key. Must not be null.newCertChain - New certificates. If not null, the certificates in the keystore will be
replaced.KeyStoreException - If case 3 occurs.public void refreshTokenForSignerType(String signerType) throws XiSecurityException
XiSecurityExceptionCopyright © 2020. All rights reserved.