Package org.apache.harmony.security.x509

Examples of org.apache.harmony.security.x509.SubjectPublicKeyInfo


  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

     * all functionality will be tested.
     * @return
     * @throws java.lang.Exception
     */
    protected void setUp() throws java.lang.Exception {
        AlgorithmIdentifier signature =
            new AlgorithmIdentifier(algOID, algParams);
        Name issuer = new Name(issuerName);
        Name subject = new Name(subjectName);
        Validity validity =
            new Validity(new Date(notBefore), new Date(notAfter));

View Full Code Here

            signatureValue[20]++;
        } else {
            signatureValue = signatureValueBytes;
        }
       
        Certificate cert =
            new Certificate(tbsCertificate, signature, signatureValue);

        certEncoding = cert.getEncoded();

        cert = (Certificate) Certificate.ASN1.decode(certEncoding);
        certificate = new X509CertImpl(cert);
    }
View Full Code Here

            String[] policies = new String[] {
                "0.0.0.0.0.0",
                "1.1.1.1.1.1",
                "2.2.2.2.2.2"
            };
            CertificatePolicies certificatePolicies =
                                            new CertificatePolicies();
            for (int i=0; i<policies.length; i++) {
                PolicyInformation policyInformation =
                                        new PolicyInformation(policies[i]);
                certificatePolicies.addPolicyInformation(policyInformation);
            }

            byte[] encoding = certificatePolicies.getEncoded();
            List policyInformations = ((CertificatePolicies)
                    CertificatePolicies.ASN1.decode(encoding))
                    .getPolicyInformations();
            Iterator it = policyInformations.iterator();
            ((PolicyInformation) it.next()).getPolicyIdentifier();
View Full Code Here

            GeneralName san1 = new GeneralName(1, "rfc@822.Name");
            GeneralName san2 = new GeneralName(2, "dNSName");
            GeneralName san3 = new GeneralName(new ORAddress());
            GeneralName san4 = new GeneralName(new Name("O=Organization"));
            GeneralName san5 =
                new GeneralName(new EDIPartyName("assigner", "party"));
            GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
            GeneralName san7 = new GeneralName(new byte[] {1, 1, 1, 1});
            GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");

            GeneralNames sans_1 = new GeneralNames();
View Full Code Here

            GeneralName san1 = new GeneralName(1, "rfc@822.Name");
            GeneralName san2 = new GeneralName(2, "dNSName");
            GeneralName san3 = new GeneralName(new ORAddress());
            GeneralName san4 = new GeneralName(new Name("O=Organization"));
            GeneralName san5 =
                new GeneralName(new EDIPartyName("assigner", "party"));
            GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
            GeneralName san7 = new GeneralName(7, "1.1.1.1");
            GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");

            GeneralNames sans_1 = new GeneralNames();
View Full Code Here

        boolean[] issuerUniqueID  = new boolean[]
                    {true, false, true, false, true, false, true, false};
        boolean[] subjectUniqueID = new boolean[]
                    {false, true, false, true, false, true, false, true};

        Extension extension = new Extension("2.5.29.17",
                                            true, subjectAltNames.getEncoded());
        Extensions extensions = new Extensions();
        extensions.addExtension(extension);
      
        TBSCertificate tbsCertificate = new TBSCertificate(version,
View Full Code Here

TOP

Related Classes of org.apache.harmony.security.x509.SubjectPublicKeyInfo

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.