Package com.jetbrains.heroku.ui

Examples of com.jetbrains.heroku.ui.HerokuToolWindow$ContentInfo


     * @param safe
     *                the SafeContents to be added to the AuthenticatedSafe
     */
    public void addSafeContents(SafeContents safe) throws IOException,
      ASN1Exception {
  ContentInfo cinfo = makeData(safe);
  add(cinfo);
    }
View Full Code Here


     *                the PBE algorithm to be used
     */
    public void addSafeContents(SafeContents safe, char[] passwd,
      String algorithm) throws IOException, ASN1Exception,
      GeneralSecurityException {
  ContentInfo cinfo = makeEncryptedData(safe, passwd, algorithm);
  add(cinfo);
    }
View Full Code Here

     */
    public void addSafeContents(SafeContents safe, SecretKey key,
      String algorithm, AlgorithmParameters params,
      java.security.cert.X509Certificate[] cert) throws IOException,
      ASN1Exception, BadNameException, GeneralSecurityException {
  ContentInfo cinfo = makeEnvelopedData(safe, key, algorithm, params,
    cert);
  add(cinfo);
    }
View Full Code Here

     */
    public int[] getProtectionMode() {
  int[] proMode;
  proMode = new int[this.size()];
  for (int i = 0; i < this.size(); i++) {
      ContentInfo cinfo = (ContentInfo) this.get(i);
      if (cinfo.getContent() instanceof Data) {
    proMode[i] = NO_PROTECTION;
      } else if (cinfo.getContent() instanceof EncryptedData) {
    proMode[i] = PASSWORD_PROTECTION;
      } else if (cinfo.getContent() instanceof EnvelopedData) {
    proMode[i] = PUBLIC_KEY_PROTECTION;
      } else {
    throw new IllegalStateException("Illegal protection mode: "
      + proMode[i]);
      }
View Full Code Here

     */
    public SafeContents getSafeContents(int i) throws IOException,
      ASN1Exception {
  byte[] encodedData;
  ByteArrayInputStream bais;
  ContentInfo cinfo = (ContentInfo) this.get(i);
  if (cinfo.getContent() instanceof Data) {
      encodedData = ((Data) cinfo.getContent()).getByteArray();
  } else {
      System.out
        .println("This bag is either password or public-key protected.");
      return null;
  }
View Full Code Here

    public SafeContents getSafeContents(int i, java.security.PrivateKey key,
      java.security.cert.X509Certificate cert) throws IOException,
      ASN1Exception, GeneralSecurityException, NoSuchElementException {
  ByteArrayInputStream bais;

  ContentInfo cinfo = (ContentInfo) this.get(i);
  EnvelopedData envData = null;
  if (cinfo.getContent() instanceof EnvelopedData) {
      envData = (EnvelopedData) cinfo.getContent();
  } else {
      System.out
        .println("This bag is password protected or not protected at all.");
      return null;
  }
View Full Code Here

  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  DEREncoder encoder = new DEREncoder(baos);
  safe.encode(encoder);
  data = new Data(baos.toByteArray());
  baos.close();
  ContentInfo cInfo = new ContentInfo(data);
  return cInfo;
    }
View Full Code Here

  // make an EncryptedData and put it in a ContentInfo
  EncryptedData ecd = new EncryptedData(algorithm, pbekey, params);
  ecd.setData(bais);
  bais.close();

  ContentInfo cinfo = new ContentInfo();
  cinfo.setContent(new codec.asn1.ASN1ObjectIdentifier(
    "1.2.840.113549.1.7.6"), ecd);
  return cinfo;
    }
View Full Code Here

  bais.close();
  for (int i = 0; i < cert.length; i++) {
      edata.addRecipient(cert[i]);
  }

  ContentInfo cinfo = new ContentInfo(edata);
  return cinfo;
    }
View Full Code Here

            if (encodingsArr[0].equals(encoding)) {
                // generate the object from PkiPath encoded form
                return (X509CertPathImpl) ASN1.decode(in);
            } else {
                // generate the object from PKCS #7 encoded form
                ContentInfo ci = (ContentInfo) ContentInfo.ASN1.decode(in);
                SignedData sd = ci.getSignedData();
                if (sd == null) {
                    throw new CertificateException(
                        Messages.getString("security.160")); //$NON-NLS-1$
                }
                List certs = sd.getCertificates();
                if (certs == null) {
                    // empty chain of certificates
                    certs = new ArrayList();
                }
                List result = new ArrayList();
                for (int i=0; i<certs.size(); i++) {
                    result.add(new X509CertImpl((Certificate) certs.get(i)));
                }
                return new X509CertPathImpl(result, PKCS7, ci.getEncoded());
            }
        } catch (IOException e) {
            throw new CertificateException(Messages.getString("security.15E", //$NON-NLS-1$
                    e.getMessage()));
        }
View Full Code Here

TOP

Related Classes of com.jetbrains.heroku.ui.HerokuToolWindow$ContentInfo

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.