Package de.tuclausthal.informatik.winf.mobileagents.security

Examples of de.tuclausthal.informatik.winf.mobileagents.security.CryptographicException


      return p;
    }
    catch (IOException e)
    {
      throw new CryptographicException("Could not run gpg!");
    }
  }
View Full Code Here


      // gpg error?
      int exitCode = p.waitFor();
      if (exitCode != 0)
      {
        throw new CryptographicException(
          "GPG exited abormally. Status code" + exitCode);
      }

      StringBuffer line = new StringBuffer("");
      StringBuffer input = new StringBuffer("");
      String gpgMarker = "[GNUPG:]";
      while (in.ready())
      {
        char c = (char)in.read();
        line.append(c);
        if (c == '\n')
        {
          String l = line.toString();
          if (!l.startsWith(gpgMarker))
          {
            // GPG Marker is somewhere in
            // there, we have to truncate
            int pos = l.indexOf(gpgMarker);
            if (pos > 0)
            {
              l = l.substring(0, pos);
            }

            input.append(l);
          }
          line = new StringBuffer("");
        }
      }

      // UTF-8 works for ascii amored and
      // is default output format for gpg
      return input.toString().getBytes("UTF-8");
    }
    catch (IOException e)
    {
      throw new CryptographicException(e.getMessage());
    }
    catch (InterruptedException e)
    {
      throw new CryptographicException(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of de.tuclausthal.informatik.winf.mobileagents.security.CryptographicException

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.