1e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrompackage org.bouncycastle.cms; 2e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 3e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport java.util.ArrayList; 4e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport java.util.HashMap; 5e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport java.util.HashSet; 6e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport java.util.Iterator; 7e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport java.util.List; 8e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport java.util.Map; 9e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport java.util.Set; 10e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 11a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.asn1.ASN1Encodable; 12e1142c149e244797ce73b0e7fad40816e447a817Brian Carlstromimport org.bouncycastle.asn1.ASN1ObjectIdentifier; 13e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport org.bouncycastle.asn1.DERTaggedObject; 14e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport org.bouncycastle.asn1.cms.CMSObjectIdentifiers; 15e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom// BEGIN android-removed 16a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom// import org.bouncycastle.asn1.cms.OtherRevocationInfoFormat; 17e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom// import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 18e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom// END android-removed 19e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport org.bouncycastle.asn1.nist.NISTObjectIdentifiers; 20e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 21e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 22e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; 23e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport org.bouncycastle.asn1.x509.AlgorithmIdentifier; 24e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport org.bouncycastle.asn1.x9.X9ObjectIdentifiers; 25a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.cert.X509AttributeCertificateHolder; 26a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.cert.X509CRLHolder; 27a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.cert.X509CertificateHolder; 28a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstromimport org.bouncycastle.util.Arrays; 29e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstromimport org.bouncycastle.util.Store; 30e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 31e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrompublic class CMSSignedGenerator 32e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom{ 33e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom /** 34e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom * Default type for the signed data. 35e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom */ 36e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String DATA = CMSObjectIdentifiers.data.getId(); 37e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 38e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String DIGEST_SHA1 = OIWObjectIdentifiers.idSHA1.getId(); 3987490acd76f544251011cf49753d4d0a61f86a66Kenny Root public static final String DIGEST_SHA224 = NISTObjectIdentifiers.id_sha224.getId(); 40e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String DIGEST_SHA256 = NISTObjectIdentifiers.id_sha256.getId(); 41e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String DIGEST_SHA384 = NISTObjectIdentifiers.id_sha384.getId(); 42e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String DIGEST_SHA512 = NISTObjectIdentifiers.id_sha512.getId(); 43e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String DIGEST_MD5 = PKCSObjectIdentifiers.md5.getId(); 44e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // BEGIN android-removed 45e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // public static final String DIGEST_GOST3411 = CryptoProObjectIdentifiers.gostR3411.getId(); 46e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // public static final String DIGEST_RIPEMD128 = TeleTrusTObjectIdentifiers.ripemd128.getId(); 47e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // public static final String DIGEST_RIPEMD160 = TeleTrusTObjectIdentifiers.ripemd160.getId(); 48e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // public static final String DIGEST_RIPEMD256 = TeleTrusTObjectIdentifiers.ripemd256.getId(); 49e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // END android-removed 50e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 51e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String ENCRYPTION_RSA = PKCSObjectIdentifiers.rsaEncryption.getId(); 52e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String ENCRYPTION_DSA = X9ObjectIdentifiers.id_dsa_with_sha1.getId(); 53e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String ENCRYPTION_ECDSA = X9ObjectIdentifiers.ecdsa_with_SHA1.getId(); 54e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public static final String ENCRYPTION_RSA_PSS = PKCSObjectIdentifiers.id_RSASSA_PSS.getId(); 55e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // BEGIN android-removed 56e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // public static final String ENCRYPTION_GOST3410 = CryptoProObjectIdentifiers.gostR3410_94.getId(); 57e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // public static final String ENCRYPTION_ECGOST3410 = CryptoProObjectIdentifiers.gostR3410_2001.getId(); 58e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom // END android-removed 59e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 60e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom private static final String ENCRYPTION_ECDSA_WITH_SHA1 = X9ObjectIdentifiers.ecdsa_with_SHA1.getId(); 6187490acd76f544251011cf49753d4d0a61f86a66Kenny Root private static final String ENCRYPTION_ECDSA_WITH_SHA224 = X9ObjectIdentifiers.ecdsa_with_SHA224.getId(); 62e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom private static final String ENCRYPTION_ECDSA_WITH_SHA256 = X9ObjectIdentifiers.ecdsa_with_SHA256.getId(); 63e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom private static final String ENCRYPTION_ECDSA_WITH_SHA384 = X9ObjectIdentifiers.ecdsa_with_SHA384.getId(); 64e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom private static final String ENCRYPTION_ECDSA_WITH_SHA512 = X9ObjectIdentifiers.ecdsa_with_SHA512.getId(); 65e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 66e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom private static final Set NO_PARAMS = new HashSet(); 67e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom private static final Map EC_ALGORITHMS = new HashMap(); 68e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 69e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom static 70e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 71e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom NO_PARAMS.add(ENCRYPTION_DSA); 72e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom NO_PARAMS.add(ENCRYPTION_ECDSA); 73e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom NO_PARAMS.add(ENCRYPTION_ECDSA_WITH_SHA1); 7487490acd76f544251011cf49753d4d0a61f86a66Kenny Root NO_PARAMS.add(ENCRYPTION_ECDSA_WITH_SHA224); 75e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom NO_PARAMS.add(ENCRYPTION_ECDSA_WITH_SHA256); 76e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom NO_PARAMS.add(ENCRYPTION_ECDSA_WITH_SHA384); 77e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom NO_PARAMS.add(ENCRYPTION_ECDSA_WITH_SHA512); 78e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 79e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom EC_ALGORITHMS.put(DIGEST_SHA1, ENCRYPTION_ECDSA_WITH_SHA1); 8087490acd76f544251011cf49753d4d0a61f86a66Kenny Root EC_ALGORITHMS.put(DIGEST_SHA224, ENCRYPTION_ECDSA_WITH_SHA224); 81e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom EC_ALGORITHMS.put(DIGEST_SHA256, ENCRYPTION_ECDSA_WITH_SHA256); 82e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom EC_ALGORITHMS.put(DIGEST_SHA384, ENCRYPTION_ECDSA_WITH_SHA384); 83e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom EC_ALGORITHMS.put(DIGEST_SHA512, ENCRYPTION_ECDSA_WITH_SHA512); 84e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 85e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 86e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom protected List certs = new ArrayList(); 87e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom protected List crls = new ArrayList(); 88e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom protected List _signers = new ArrayList(); 89e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom protected List signerGens = new ArrayList(); 90e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom protected Map digests = new HashMap(); 91e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 92e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom /** 93e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom * base constructor 94e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom */ 95e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom protected CMSSignedGenerator() 96e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 97e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 98e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 99e1142c149e244797ce73b0e7fad40816e447a817Brian Carlstrom protected Map getBaseParameters(ASN1ObjectIdentifier contentType, AlgorithmIdentifier digAlgId, byte[] hash) 100e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 101e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom Map param = new HashMap(); 102e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom param.put(CMSAttributeTableGenerator.CONTENT_TYPE, contentType); 103e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom param.put(CMSAttributeTableGenerator.DIGEST_ALGORITHM_IDENTIFIER, digAlgId); 104a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom param.put(CMSAttributeTableGenerator.DIGEST, Arrays.clone(hash)); 105e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom return param; 106e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 107e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 108a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom /** 109a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * Add a certificate to the certificate set to be included with the generated SignedData message. 110a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * 111a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @param certificate the certificate to be included. 112a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @throws CMSException if the certificate cannot be encoded for adding. 113a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom */ 114a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom public void addCertificate( 115a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom X509CertificateHolder certificate) 116a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom throws CMSException 117a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom { 118a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom certs.add(certificate.toASN1Structure()); 119a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom } 120a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom 121a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom /** 122a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * Add the certificates in certStore to the certificate set to be included with the generated SignedData message. 123a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * 124a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @param certStore the store containing the certificates to be included. 125a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @throws CMSException if the certificates cannot be encoded for adding. 126a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom */ 127e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public void addCertificates( 128e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom Store certStore) 129e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom throws CMSException 130e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 131e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom certs.addAll(CMSUtils.getCertificatesFromStore(certStore)); 132e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 133e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 134a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom /** 135a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * Add a CRL to the CRL set to be included with the generated SignedData message. 136a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * 137a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @param crl the CRL to be included. 138a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom */ 139a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom public void addCRL(X509CRLHolder crl) 140a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom { 141a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom crls.add(crl.toASN1Structure()); 142a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom } 143a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom 144a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom /** 145a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * Add the CRLs in crlStore to the CRL set to be included with the generated SignedData message. 146a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * 147a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @param crlStore the store containing the CRLs to be included. 148a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @throws CMSException if the CRLs cannot be encoded for adding. 149a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom */ 150e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public void addCRLs( 151e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom Store crlStore) 152e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom throws CMSException 153e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 154e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom crls.addAll(CMSUtils.getCRLsFromStore(crlStore)); 155e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 156e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 157a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom /** 158a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * Add the attribute certificates in attrStore to the certificate set to be included with the generated SignedData message. 159a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * 160a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @param attrCert the store containing the certificates to be included. 161a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @throws CMSException if the attribute certificate cannot be encoded for adding. 162a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom */ 163a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom public void addAttributeCertificate( 164a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom X509AttributeCertificateHolder attrCert) 165a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom throws CMSException 166a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom { 167a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom certs.add(new DERTaggedObject(false, 2, attrCert.toASN1Structure())); 168a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom } 169a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom 170a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom /** 171a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * Add the attribute certificates in attrStore to the certificate set to be included with the generated SignedData message. 172a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * 173a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @param attrStore the store containing the certificates to be included. 174a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom * @throws CMSException if the attribute certificate cannot be encoded for adding. 175a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom */ 176e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public void addAttributeCertificates( 177e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom Store attrStore) 178e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom throws CMSException 179e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 180e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom certs.addAll(CMSUtils.getAttributeCertificatesFromStore(attrStore)); 181e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 182e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 183a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // BEGIN android-removed 184a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // /** 185a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // * Add a single instance of otherRevocationData to the CRL set to be included with the generated SignedData message. 186a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // * 187a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // * @param otherRevocationInfoFormat the OID specifying the format of the otherRevocationInfo data. 188a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // * @param otherRevocationInfo the otherRevocationInfo ASN.1 structure. 189a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // */ 190a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // public void addOtherRevocationInfo( 191a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // ASN1ObjectIdentifier otherRevocationInfoFormat, 192a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // ASN1Encodable otherRevocationInfo) 193a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // { 194a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // crls.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, otherRevocationInfo))); 195a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // } 196a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // 197a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // /** 198a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // * Add a Store of otherRevocationData to the CRL set to be included with the generated SignedData message. 199a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // * 200a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // * @param otherRevocationInfoFormat the OID specifying the format of the otherRevocationInfo data. 201a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // * @param otherRevocationInfos a Store of otherRevocationInfo data to add. 202a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // */ 203a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // public void addOtherRevocationInfo( 204a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // ASN1ObjectIdentifier otherRevocationInfoFormat, 205a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // Store otherRevocationInfos) 206a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // { 207a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // crls.addAll(CMSUtils.getOthersFromStore(otherRevocationInfoFormat, otherRevocationInfos)); 208a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // } 209a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom // END android-removed 210a198e1ecc615e26a167d0f2dca9fa7e5fc62de10Brian Carlstrom 211e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom /** 2125db505e1f6a68c8d5dfdb0fed0b8607dea7bed96Kenny Root * Add a store of pre-calculated signers to the generator. 213e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom * 214e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom * @param signerStore store of signers 215e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom */ 216e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public void addSigners( 217e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom SignerInformationStore signerStore) 218e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 219e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom Iterator it = signerStore.getSigners().iterator(); 220e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 221e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom while (it.hasNext()) 222e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 223e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom _signers.add(it.next()); 224e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 225e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 226e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 2275db505e1f6a68c8d5dfdb0fed0b8607dea7bed96Kenny Root /** 2285db505e1f6a68c8d5dfdb0fed0b8607dea7bed96Kenny Root * Add a generator for a particular signer to this CMS SignedData generator. 2295db505e1f6a68c8d5dfdb0fed0b8607dea7bed96Kenny Root * 2305db505e1f6a68c8d5dfdb0fed0b8607dea7bed96Kenny Root * @param infoGen the generator representing the particular signer. 2315db505e1f6a68c8d5dfdb0fed0b8607dea7bed96Kenny Root */ 232e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public void addSignerInfoGenerator(SignerInfoGenerator infoGen) 233e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 234e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom signerGens.add(infoGen); 235e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 236e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom 237e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom /** 238e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom * Return a map of oids and byte arrays representing the digests calculated on the content during 239e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom * the last generate. 240e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom * 241e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom * @return a map of oids (as String objects) and byte[] representing digests. 242e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom */ 243e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom public Map getGeneratedDigests() 244e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom { 245e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom return new HashMap(digests); 246e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom } 247e6bf3e8dfa2804891a82075cb469b736321b4827Brian Carlstrom} 248