*/
public RecipientInfo(X509Certificate cert, Key bek, int encType)
throws BadNameException, GeneralSecurityException {
super(4);
SubjectPublicKeyInfo pki;
AlgorithmIdentifier aid;
ASN1Sequence seq;
PublicKey pub;
Cipher cipher;
byte[] b;
if (cert == null || bek == null) {
throw new NullPointerException("cert or bulk encryption key");
}
/* Global structure and Version */
version_ = new ASN1Integer(0);
add(version_);
/* Issuer and serial number */
// der scep hack der funktioniert hat
// issuer_ = new Name(cert.getIssuerDN().getName(),true);
issuer_ = new Name(cert.getIssuerDN().getName(), encType);
serial_ = new ASN1Integer(cert.getSerialNumber());
seq = new ASN1Sequence(2);
seq.add(issuer_);
seq.add(serial_);
add(seq);
/*
* Extract algorithm identifier from the public key
*/
pub = cert.getPublicKey();
pki = new SubjectPublicKeyInfo(pub);
aid = pki.getAlgorithmIdentifier();
/*
* Initialize the cipher instance
*/
cipher = Cipher.getInstance(pub.getAlgorithm());