Package codec.asn1

Examples of codec.asn1.ASN1Sequence


    public CertHashExtension() throws ASN1Exception,
      CertificateEncodingException {
  setOID(new ASN1ObjectIdentifier(EXTENSION_OID));
  setCritical(false);

  syntax_ = new ASN1Sequence(2);
  hashAlgorithm_ = new AlgorithmIdentifier();
  certificateHash_ = new ASN1OctetString();

  syntax_.add(hashAlgorithm_);
  syntax_.add(certificateHash_);
View Full Code Here


  aid = new AlgorithmIdentifier(alg);
  dig = MessageDigest.getInstance(alg);
  buf = dig.digest(cert);

  syntax_ = new ASN1Sequence(2);
  hashAlgorithm_ = aid;
  certificateHash_ = new ASN1OctetString(buf);

  syntax_.add(hashAlgorithm_);
  syntax_.add(certificateHash_);
View Full Code Here

     * The default constructor.
     */
    public RecipientInfo() {
  super(4);

  ASN1Sequence seq;

  /* Global structure and Version */
  version_ = new ASN1Integer(0);
  add(version_);

  /* Issuer and serial number */
  issuer_ = new Name();
  serial_ = new ASN1Integer();

  seq = new ASN1Sequence(2);
  seq.add(issuer_);
  seq.add(serial_);
  add(seq);

  /* Key Encryption Algorithm Identifier */
  cAlg_ = new AlgorithmIdentifier();
  add(cAlg_);
View Full Code Here

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

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

     *                ASN1SequenceOf containing the policyQualifiers
     */
    public void addPolicyInformation(ASN1ObjectIdentifier policyIdentifier,
      ASN1SequenceOf policyQualifiers) throws Exception {

  ASN1Sequence _policyInformation = new ASN1Sequence();
  _policyInformation.add(policyIdentifier);

  if (policyQualifiers == null) {
      ASN1SequenceOf _policyQualifiers = new ASN1SequenceOf(
        ASN1Sequence.class);
      _policyQualifiers.setOptional(true);
      _policyInformation.add(_policyQualifiers);
  } else {
      policyQualifiers.setOptional(false);
      _policyInformation.add(policyQualifiers);
  }
  certificatePoliciesSyntax.add(_policyInformation);

  setValue(certificatePoliciesSyntax);
    }
View Full Code Here

     *                a URI pointing to the Trust Center's CPS
     */
    public void addPolicyInformationCPS(ASN1ObjectIdentifier policyIdentifier,
      ASN1IA5String locationOfCPS) throws Exception {

  ASN1Sequence _policyInformation = new ASN1Sequence(2);
  _policyInformation.add(policyIdentifier);

  ASN1Sequence _policyQualifier = new ASN1Sequence(2);
  _policyQualifier.add(ID_QT_CPS.clone());
  _policyQualifier.add(locationOfCPS);
  _policyQualifier.setOptional(false);

  ASN1SequenceOf _policyQualifiers = new ASN1SequenceOf(
    ASN1Sequence.class);
  _policyQualifiers.add(_policyQualifier);
  _policyInformation.add(_policyQualifiers);
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!>";
View Full Code Here

    /**
     * constructor that builds the ASN.1 structure
     */
    public X509Crl() {

  CertificateList = new ASN1Sequence(3);
  TBSCertList = new ASN1Sequence(7);

  version = new ASN1Integer(1);
  /**/// BUGFIX: optional feld must be false if respective parameter is
  // set
  /**/
 
View Full Code Here

    /**
     * constructor that builds the ASN.1 structure
     */
    public X509Crl(int i) {

  CertificateList = new ASN1Sequence(3);
  TBSCertList = new ASN1Sequence(6);

  version = new ASN1Integer(1);
  /**/// BUGFIX: optional feld must be false if respective parameter is
  // set
  /**/
 
View Full Code Here

TOP

Related Classes of codec.asn1.ASN1Sequence

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.