Ejemplo n.º 1
0
  protected String getValidationEncryptedXml(Context context, String s) {
    XmlSerializer serializer = Xml.newSerializer();
    StringWriter writer = new StringWriter();
    try {
      serializer.setOutput(writer);
      serializer.startDocument("UTF-8", true);
      serializer.startTag("", "encryptedValidation");
      // serializer.attribute("", "regNum", getRegNum());

      String encryptedText = RegistrationUtil.getEncryptedStringAsBase64(context, s);
      serializer.text(RegistrationUtil.getEncryptedStringAsBase64(context, s));

      serializer.endTag("", "encryptedValidation");
      serializer.endDocument();
      // return writer.toString();
      return encryptedText;
    } catch (Exception e) {
      Log.e(TAG, e.toString());
      return null;
    }
  }
Ejemplo n.º 2
0
  protected String getEnrolmentEncryptedXml(SIP5060ProvisioningRequest req) {
    XmlSerializer serializer = Xml.newSerializer();
    StringWriter writer = new StringWriter();
    try {
      serializer.setOutput(writer);
      serializer.startDocument("UTF-8", true);
      serializer.startTag("", "encryptedEnrolment");
      // serializer.attribute("", "regNum", getRegNum());

      String fullBody = getEnrolmentBodyXml(req);

      String encryptedBody = RegistrationUtil.getEncryptedStringAsBase64(this, fullBody);
      serializer.text(encryptedBody);

      serializer.endTag("", "encryptedEnrolment");
      serializer.endDocument();
      // return writer.toString();
      return encryptedBody;
    } catch (Exception e) {
      Log.e(TAG, e.toString());
      return null;
    }
  }