Package com.serotonin.m2m2.vmstat

Examples of com.serotonin.m2m2.vmstat.VMStatPointLocatorVO$Attributes


    public Verifier(Signable sigdat, SignerInfo info, X509Certificate cert)
      throws GeneralSecurityException {
  AlgorithmParameterSpec spec;
  ASN1ObjectIdentifier oid;
  ASN1OctetString octets;
  Attributes attributes;
  Attribute attribute;
  String sigalg;
  String mdalg;

  /*
   * Either a certificate or a SignerInfo is needed. We might do without
   * one of'em but not without both. The SignedData is need in every case.
   */
  if (info == null && cert == null) {
      throw new IllegalArgumentException(
        "Need either a SignerInfo or a certificate!");
  }
  if (sigdat == null) {
      throw new NullPointerException("Need a SignedData!");
  }
  target_ = sigdat;

  /*
   * If the SignerInfo is null then we try to get it from the SignedData.
   */
  if (info == null) {
      info = target_.getSignerInfo(cert);

      if (info == null) {
    throw new NoSuchSignerException("No signer info found for: "
      + cert.getIssuerDN().getName() + ", "
      + cert.getSerialNumber());
      }
  }
  /*
   * If we have a SignerInfo but no certificate the we try and see if we
   * can get it from the SignedData.
   */
  else if (cert == null) {
      cert = target_.getCertificate(info.getIssuerDN(), info
        .getSerialNumber());

      if (cert == null) {
    throw new CertificateException("No certificate available for: "
      + info.getIssuerDN().getName() + ", "
      + info.getSerialNumber());
      }
  }
  /*
   * We have both a SignerInfo and a certificate, now let's see if they
   * have matching issuer and serial number.
   */
  else {
      if (!info.equivIssuerAndSerialNumber(cert)) {
    throw new IllegalArgumentException(
      "SignerInfo and certificate don't match!");
      }
  }
  /*
   * At this point we should have both a SignerInfo and a matching
   * certificate.
   */
  info_ = info;
  cert_ = cert;
  sigalg = info_.getAlgorithm();

  /*
   * We now check for a simple one-step verification or a two-step
   * verification. One-step occurs only in the degenerate case that the
   * content type of the SignedData instance is DATA and there are no
   * authenticated attributes in it.
   *
   * Otherwise we have to check painfully for the various details on
   * required attributes.
   */
  attributes = info_.authenticatedAttributes();
  oid = target_.getContentType();

  if (attributes.size() > 0 || !oid.equals(DATA)) {
      twostep_ = true;

      attribute = info_.authenticatedAttributes().getAttribute(
        CONTENT_TYPE);

View Full Code Here


  /* Digest Algorithm Identifier */
  dAlg_ = new AlgorithmIdentifier();
  add(dAlg_);

  /* Authenticated Attributes */
  auth_ = new Attributes();
  add(new ASN1TaggedType(0, auth_, false, true));

  /* Digest Encryption Algorithm Identifier */
  cAlg_ = new AlgorithmIdentifier();
  add(cAlg_);

  /* Encrypted Digest */
  edig_ = new ASN1OctetString();
  add(edig_);

  /* Unauthenticated Attributes */
  attr_ = new Attributes();
  add(new ASN1TaggedType(1, attr_, false, true));
    }
View Full Code Here

  /* Digest Algorithm Identifier */
  dAlg_ = new AlgorithmIdentifier();
  add(dAlg_);

  /* Authenticated Attributes */
  auth_ = new Attributes(registry);
  add(new ASN1TaggedType(0, auth_, false, true));

  /* Digest Encryption Algorithm Identifier */
  cAlg_ = new AlgorithmIdentifier();
  add(cAlg_);

  /* Encrypted Digest */
  edig_ = new ASN1OctetString();
  add(edig_);

  /* Unauthenticated Attributes */
  attr_ = new Attributes(registry);
  add(new ASN1TaggedType(1, attr_, false, true));
    }
View Full Code Here

  }
  /* Digest Algorithm Identifier */
  add(dAlg_);

  /* Authenticated Attributes */
  auth_ = new Attributes();
  add(new ASN1TaggedType(0, auth_, false, true));

  /* Digest Encryption Algorithm Identifier */
  add(cAlg_);

  /* Encrypted Digest */
  edig_ = new ASN1OctetString();
  add(edig_);

  /* Unauthenticated Attributes */
  attr_ = new Attributes();
  add(new ASN1TaggedType(1, attr_, false, true));

  algorithm_ = algorithm;
    }
View Full Code Here

  }
  /* Digest Algorithm Identifier */
  add(dAlg_);

  /* Authenticated Attributes */
  auth_ = new Attributes();
  add(new ASN1TaggedType(0, auth_, false, true));

  /* Digest Encryption Algorithm Identifier */
  add(cAlg_);

  /* Encrypted Digest */
  edig_ = new ASN1OctetString();
  add(edig_);

  /* Unauthenticated Attributes */
  attr_ = new Attributes();
  add(new ASN1TaggedType(1, attr_, false, true));

  algorithm_ = algorithm;
    }
View Full Code Here

  /* Digest Algorithm Identifier */
  add(dAlg_);

  /* Authenticated Attributes */
  auth_ = new Attributes();
  add(new ASN1TaggedType(0, auth_, false, true));

  /* Digest Encryption Algorithm Identifier */
  add(cAlg_);

  /* Encrypted Digest */
  edig_ = new ASN1OctetString();
  add(edig_);

  /* Unauthenticated Attributes */
  attr_ = new Attributes();
  add(new ASN1TaggedType(1, attr_, false, true));

  algorithm_ = algorithm;
  if (params != null) {
      try {
View Full Code Here

  /* Digest Algorithm Identifier */
  add(dAlg_);

  /* Authenticated Attributes */
  auth_ = new Attributes();
  add(new ASN1TaggedType(0, auth_, false, true));

  /* Digest Encryption Algorithm Identifier */
  add(cAlg_);

  /* Encrypted Digest */
  edig_ = new ASN1OctetString();
  add(edig_);

  /* Unauthenticated Attributes */
  attr_ = new Attributes();
  add(new ASN1TaggedType(1, attr_, false, true));

  algorithm_ = algorithm;
  if (params != null) {
      try {
View Full Code Here

     */
    public Signer(Signable sigdat, SignerInfo info, PrivateKey key)
      throws GeneralSecurityException {
  AlgorithmParameterSpec spec;
  ASN1ObjectIdentifier oid;
  Attributes attributes;
  Attribute attribute;
  String sigalg;
  String mdalg;

  /*
   * We can't do without both a SignerInfo and a private key.
   */
  if (sigdat == null || info == null || key == null) {
      throw new NullPointerException(
        "Need a Signable, SignerInfo and PrivateKey!");
  }
  info_ = info;
  target_ = sigdat;
  sigalg = info_.getAlgorithm();

  /*
   * Here comes the tough part. We have to check the authenticated
   * attributes. In the degenerated case of no authenticated attributes
   * and a content type of Data in the SignedData we do one-step signing.
   * In all other cases we have to use two steps and we have to add and/or
   * check attributes.
   */
  attributes = info_.authenticatedAttributes();
  oid = target_.getContentType();

  // CHANGED BY CV
  // if (attributes.size() > 0 || !oid.equals(DATA))
  if (attributes.size() > 0) {
      twostep_ = true;

      attribute = info_.authenticatedAttributes().getAttribute(
        CONTENT_TYPE);

      /*
       * If there is no content type attribute then we have to add one. If
       * there is one then we have to make sure that there is no mismatch.
       *
       * The code could correct and replace attributes with a wrong type,
       * but I guess it's better to throw an exception because something
       * with the application's code is probably wrong.
       */
      if (attribute == null) {
    attribute = new Attribute((ASN1ObjectIdentifier) CONTENT_TYPE
      .clone(), (ASN1ObjectIdentifier) oid.clone());

    attributes.add(attribute);
      } else if (attribute.valueCount() < 1) {
    throw new InvalidAttributeException(
      "Content type attribute has no value!");
      } else if (!attribute.valueAt(0).equals(oid)) {
    throw new InvalidAttributeException(
View Full Code Here

        SerialDataSourceVO ds = (SerialDataSourceVO) Common.getUser().getEditDataSource();
        if(ds.getId() == -1) {
          pr.addContextualMessage("testString", "serial.test.needsSave");
          return pr;
        }
        DataPointDao dpd = new DataPointDao();
        List<DataPointVO> points = dpd.getDataPoints(ds.getId(), null);
        if(ds.getUseTerminator()) {
          if(msg.indexOf(ds.getMessageTerminator()) != -1) {
            msg = msg.substring(0, msg.indexOf(ds.getMessageTerminator())+1);
            Pattern p = Pattern.compile(ds.getMessageRegex());
            Matcher m = p.matcher(msg);
View Full Code Here

            int fromMonth, int fromDay, int fromHour, int fromMinute, boolean toNone, int toYear, int toMonth,
            int toDay, int toHour, int toMinute, boolean schedule, int schedulePeriod, int runDelayMinutes,
            String scheduleCron, boolean email, boolean includeData, boolean zipData,
            List<RecipientListEntryBean> recipients) {

        ProcessResult response = new ProcessResult();

        // Basic validation
        validateData(response, name, points, dateRangeType, relativeDateType, previousPeriodCount, pastPeriodCount);

        if (schedule) {
            if (schedulePeriod == ReportVO.SCHEDULE_CRON) {
                // Check the cron pattern.
                try {
                    new CronTimerTrigger(scheduleCron);
                }
                catch (Exception e) {
                    response.addContextualMessage("scheduleCron", "reports.validate.cron", e.getMessage());
                }
            }
            else {
                if (runDelayMinutes < 0)
                    response.addContextualMessage("runDelayMinutes", "reports.validate.lessThan0");
                else if (runDelayMinutes > 59)
                    response.addContextualMessage("runDelayMinutes", "reports.validate.greaterThan59");
            }
        }

        if (schedule && email && recipients.isEmpty())
            response.addContextualMessage("recipients", "reports.validate.needRecip");

        if (response.getHasMessages())
            return response;

        User user = Common.getUser();
        ReportDao reportDao = new ReportDao();
        ReportVO report;
        if (id == Common.NEW_ID) {
            report = new ReportVO();
            report.setUserId(user.getId());
        }
        else
            report = reportDao.getReport(id);
       
        ReportCommon.ensureReportPermission(user, report);

        // Update the new values.
        report.setXid(xid);
        report.setName(name);
        report.setPoints(points);
        report.setTemplate(template);
        report.setIncludeEvents(includeEvents);
        report.setIncludeUserComments(includeUserComments);
        report.setDateRangeType(dateRangeType);
        report.setRelativeDateType(relativeDateType);
        report.setPreviousPeriodCount(previousPeriodCount);
        report.setPreviousPeriodType(previousPeriodType);
        report.setPastPeriodCount(pastPeriodCount);
        report.setPastPeriodType(pastPeriodType);
        report.setFromNone(fromNone);
        report.setFromYear(fromYear);
        report.setFromMonth(fromMonth);
        report.setFromDay(fromDay);
        report.setFromHour(fromHour);
        report.setFromMinute(fromMinute);
        report.setToNone(toNone);
        report.setToYear(toYear);
        report.setToMonth(toMonth);
        report.setToDay(toDay);
        report.setToHour(toHour);
        report.setToMinute(toMinute);
        report.setSchedule(schedule);
        report.setSchedulePeriod(schedulePeriod);
        report.setRunDelayMinutes(runDelayMinutes);
        report.setScheduleCron(scheduleCron);
        report.setEmail(email);
        report.setIncludeData(includeData);
        report.setZipData(zipData);
        report.setRecipients(recipients);

        // Save the report
        reportDao.saveReport(report);

        // Conditionally schedule the report.
        ReportJob.scheduleReportJob(report);

        // Send back the report id in case this was new.
        response.addData("reportId", report.getId());
        response.addData("report", report);
        return response;
    }
View Full Code Here

TOP

Related Classes of com.serotonin.m2m2.vmstat.VMStatPointLocatorVO$Attributes

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.