Fields Summary |
---|
public static final String | DATADefault type for the signed data. |
public static final String | DIGEST_SHA1 |
public static final String | DIGEST_SHA224 |
public static final String | DIGEST_SHA256 |
public static final String | DIGEST_SHA384 |
public static final String | DIGEST_SHA512 |
public static final String | DIGEST_MD5 |
public static final String | DIGEST_GOST3411 |
public static final String | DIGEST_RIPEMD128 |
public static final String | DIGEST_RIPEMD160 |
public static final String | DIGEST_RIPEMD256 |
public static final String | ENCRYPTION_RSA |
public static final String | ENCRYPTION_DSA |
public static final String | ENCRYPTION_ECDSA |
public static final String | ENCRYPTION_RSA_PSS |
public static final String | ENCRYPTION_GOST3410 |
public static final String | ENCRYPTION_ECGOST3410 |
private static final String | ENCRYPTION_ECDSA_WITH_SHA1 |
private static final String | ENCRYPTION_ECDSA_WITH_SHA224 |
private static final String | ENCRYPTION_ECDSA_WITH_SHA256 |
private static final String | ENCRYPTION_ECDSA_WITH_SHA384 |
private static final String | ENCRYPTION_ECDSA_WITH_SHA512 |
private static final Set | NO_PARAMS |
private static final Map | EC_ALGORITHMS |
protected List | _certs |
protected List | _crls |
protected List | _signers |
protected Map | _digests |
protected final SecureRandom | rand |
Methods Summary |
---|
public void | addAttributeCertificates(org.bouncycastle.x509.X509Store store)Add the attribute certificates contained in the passed in store to the
generator.
try
{
for (Iterator it = store.getMatches(null).iterator(); it.hasNext();)
{
X509AttributeCertificate attrCert = (X509AttributeCertificate)it.next();
_certs.add(new DERTaggedObject(false, 2,
AttributeCertificate.getInstance(ASN1Object.fromByteArray(attrCert.getEncoded()))));
}
}
catch (IllegalArgumentException e)
{
throw new CMSException("error processing attribute certs", e);
}
catch (IOException e)
{
throw new CMSException("error processing attribute certs", e);
}
|
public void | addCertificatesAndCRLs(java.security.cert.CertStore certStore)add the certificates and CRLs contained in the given CertStore
to the pool that will be included in the encoded signature block.
Note: this assumes the CertStore will support null in the get
methods.
_certs.addAll(CMSUtils.getCertificatesFromStore(certStore));
_crls.addAll(CMSUtils.getCRLsFromStore(certStore));
|
public void | addSigners(SignerInformationStore signerStore)Add a store of precalculated signers to the generator.
Iterator it = signerStore.getSigners().iterator();
while (it.hasNext())
{
_signers.add(it.next());
}
|
protected org.bouncycastle.asn1.ASN1Set | getAttributeSet(org.bouncycastle.asn1.cms.AttributeTable attr)
if (attr != null)
{
return new DERSet(attr.toASN1EncodableVector());
}
return null;
|
protected java.util.Map | getBaseParameters(org.bouncycastle.asn1.DERObjectIdentifier contentType, org.bouncycastle.asn1.x509.AlgorithmIdentifier digAlgId, byte[] hash)
Map param = new HashMap();
param.put(CMSAttributeTableGenerator.CONTENT_TYPE, contentType);
param.put(CMSAttributeTableGenerator.DIGEST_ALGORITHM_IDENTIFIER, digAlgId);
if (hash != null)
{
param.put(CMSAttributeTableGenerator.DIGEST, hash.clone());
}
return param;
|
protected org.bouncycastle.asn1.x509.AlgorithmIdentifier | getEncAlgorithmIdentifier(java.lang.String encOid)
if (NO_PARAMS.contains(encOid))
{
return new AlgorithmIdentifier(
new DERObjectIdentifier(encOid));
}
else
{
return new AlgorithmIdentifier(
new DERObjectIdentifier(encOid), new DERNull());
}
|
protected java.lang.String | getEncOID(java.security.PrivateKey key, java.lang.String digestOID)
String encOID = null;
if (key instanceof RSAPrivateKey || "RSA".equalsIgnoreCase(key.getAlgorithm()))
{
encOID = ENCRYPTION_RSA;
}
else if (key instanceof DSAPrivateKey || "DSA".equalsIgnoreCase(key.getAlgorithm()))
{
encOID = ENCRYPTION_DSA;
if (!digestOID.equals(DIGEST_SHA1))
{
throw new IllegalArgumentException("can't mix DSA with anything but SHA1");
}
}
else if ("ECDSA".equalsIgnoreCase(key.getAlgorithm()) || "EC".equalsIgnoreCase(key.getAlgorithm()))
{
encOID = (String)EC_ALGORITHMS.get(digestOID);
if (encOID == null)
{
throw new IllegalArgumentException("can't mix ECDSA with anything but SHA family digests");
}
}
else if (key instanceof GOST3410PrivateKey || "GOST3410".equalsIgnoreCase(key.getAlgorithm()))
{
encOID = ENCRYPTION_GOST3410;
}
else if ("ECGOST3410".equalsIgnoreCase(key.getAlgorithm()))
{
encOID = ENCRYPTION_ECGOST3410;
}
return encOID;
|
public java.util.Map | getGeneratedDigests()Return a map of oids and byte arrays representing the digests calculated on the content during
the last generate.
return new HashMap(_digests);
|