Package rdpclient.ntlmssp.asn1

Examples of rdpclient.ntlmssp.asn1.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

        // SPKAC = SEQ {PKAC, SIGN-ALG, SIGN}
        // Get PKAC and obtain PK and C
        DERSequence pkacSeq = (DERSequence)spkacSeq.getObjectAt(0);
        DERObject pk = (DERObject)pkacSeq.getObjectAt(0);
        DERObject ch = (DERObject)pkacSeq.getObjectAt(1);
        SubjectPublicKeyInfo pkInfo = new SubjectPublicKeyInfo((DERSequence)pk);
        PublicKey pubKey =  getPublicKeyObject(pkInfo);

        // Get SIGN-ALG
        DERSequence signAlg = (DERSequence) spkacSeq.getObjectAt(1);
        DERObject alg0 = (DERObject)signAlg.getObjectAt(0);
View Full Code Here

        ByteArrayInputStream    bIn = new ByteArrayInputStream(bytes);
        ASN1InputStream         dIn = new ASN1InputStream(bIn);

        try
        {
            this.reqInfo = new CertificationRequestInfo(subject, new SubjectPublicKeyInfo((ASN1Sequence)dIn.readObject()), attributes);
        }
        catch (IOException e)
        {
            throw new IllegalArgumentException("can't encode public key");
        }
View Full Code Here

    public PublicKey getPublicKey(
        String  provider)
        throws NoSuchAlgorithmException, NoSuchProviderException,
                InvalidKeyException
    {
        SubjectPublicKeyInfo    subjectPKInfo = reqInfo.getSubjectPublicKeyInfo();

        try
        {
            X509EncodedKeySpec      xspec = new X509EncodedKeySpec(new DERBitString(subjectPKInfo).getBytes());
            AlgorithmIdentifier     keyAlg = subjectPKInfo.getAlgorithmId ();
            try {

                if (provider == null) {
                    return KeyFactory.getInstance(keyAlg.getObjectId().getId ()).generatePublic(xspec);
                }
View Full Code Here

    public void setPublicKey(
        PublicKey       key)
    {
        try
        {
            tbsGen.setSubjectPublicKeyInfo(new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream(
                                new ByteArrayInputStream(key.getEncoded())).readObject()));
        }
        catch (Exception e)
        {
            throw new IllegalArgumentException("unable to process key - " + e.toString());
View Full Code Here

    public byte[] getEncoded()
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);
        SubjectPublicKeyInfo    info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG()).getDERObject()), new DERInteger(y));

        try
        {
            dOut.writeObject(info);
            dOut.close();
View Full Code Here

        Name issuer = new Name(issuerName);
        Name subject = new Name(subjectName);
        Validity validity =
            new Validity(new Date(notBefore), new Date(notAfter));

        SubjectPublicKeyInfo subjectPublicKeyInfo = (SubjectPublicKeyInfo)
            SubjectPublicKeyInfo.ASN1.decode(publicKey.getEncoded());
        keyEncoding = subjectPublicKeyInfo.getEncoded();

        Extensions exts = new Extensions(Arrays.asList(extensions));
      
        TBSCertificate tbsCertificate =
            new TBSCertificate(version, serialNumber,
View Full Code Here

TOP

Related Classes of rdpclient.ntlmssp.asn1.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.