Package codec.x509.extensions

Examples of codec.x509.extensions.CertHashExtension


  // if(!Name.defaultEncoding_)
  // throw new BadNameException("Use the constructor that explicitly set
  // the Name encoding type");

  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 */
  issuer_ = new Name(cert.getIssuerDN().getName(), -1);
  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());
  cipher.init(Cipher.ENCRYPT_MODE, pub);

  /*
   * Key Encryption Algorithm Identifier
   */
  cAlg_ = (AlgorithmIdentifier) aid.clone();
  add(cAlg_);

  /*
   * Encrypt the bulk encryption key. Better safe than sorry - we check
   * for bad return values from both the key and the cipher. This already
View Full Code Here


    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());
  cipher.init(Cipher.ENCRYPT_MODE, pub);

  /*
   * Key Encryption Algorithm Identifier
   */
  cAlg_ = (AlgorithmIdentifier) aid.clone();
  add(cAlg_);

  /*
   * Encrypt the bulk encryption key. Better safe than sorry - we check
   * for bad return values from both the key and the cipher. This already
View Full Code Here

    ASN1OctetString os_ = null;

    public DigestInfo() {
  super(2);
  aid_ = new AlgorithmIdentifier();
  os_ = new ASN1OctetString();
  add(aid_);
  add(os_);
    }
View Full Code Here

     * returns an array of Strings containing all CRL-DP URL's
     * RelativeDistinguishedName not implemented yet!
     */
    public String[] getDPURLs() {
  ASN1Sequence names;
  GeneralName gn;
  Iterator i;
  String[] res;
  int n;

  names = getDistributionPointNames();

  if (names == null) {
      return null;
  }
  res = new String[names.size()];

  for (n = 0, i = names.iterator(); i.hasNext(); n++) {
      try {
    gn = (GeneralName) i.next();
    res[n] = gn.getGeneralName().getValue().toString();
      } catch (codec.x509.X509Exception ex) {
    res[n] = "<could not decode this URL!>";
      }
  }
  return res;
View Full Code Here

    /**
     * in case of an empty conctructor default values are set.
     */
    public AccessDescription() {
  accessLocation = new GeneralName();
  accessLocation.setUniformResourceIdentifier(new ASN1IA5String(
    "http://ocsptest:8080/ocsp"));
  accessMethod = new ASN1ObjectIdentifier("1.3.6.1.5.5.7.48.1");

  add(accessMethod);
View Full Code Here

     * returns an array of Strings containing all CRL-DP URL's
     * RelativeDistinguishedName not implemented yet!
     */
    public String[] getDPURLs() {
  ASN1Sequence names;
  GeneralName gn;
  Iterator i;
  String[] res;
  int n;

  names = getDistributionPointNames();

  if (names == null) {
      return null;
  }
  res = new String[names.size()];

  for (n = 0, i = names.iterator(); i.hasNext(); n++) {
      try {
    gn = (GeneralName) i.next();
    res[n] = gn.getGeneralName().getValue().toString();
      } catch (codec.x509.X509Exception ex) {
    res[n] = "<could not decode this URL!>";
      }
  }
  return res;
View Full Code Here

  certificationRequestInfo_.add(version_);

  subject_ = new Name();
  certificationRequestInfo_.add(subject_);

  subjectPublicKeyInfo_ = new SubjectPublicKeyInfo();
  certificationRequestInfo_.add(subjectPublicKeyInfo_);

  attributes_ = new ASN1SetOf(Attribute.class);
  certificationRequestInfo_.add(new ASN1TaggedType(0, attributes_, false,
    false));
View Full Code Here

     *                the public key to be put into this certification request
     *                Creation date: (20.08.99 21:42:03)
     */
    private void setPublicKey(PublicKey pk) throws InvalidKeyException {

  subjectPublicKeyInfo_ = new SubjectPublicKeyInfo(pk);
  certificationRequestInfo_.set(2, subjectPublicKeyInfo_);

    }
View Full Code Here

  // Fraunhofer IGD
  // if(!Name.defaultEncoding_)
  // throw new BadNameException("Use the constructor that explicitly set
  // the Name encoding type");

  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 */
  issuer_ = new Name(cert.getIssuerDN().getName(), -1);
  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());
View Full Code Here

     */
    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());
View Full Code Here

TOP

Related Classes of codec.x509.extensions.CertHashExtension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.