[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Google
  Web www.spinics.net

Re: [GNU Crypto] Using gnu-crypto-discuss to send emails via authorized SMTP servers



lør, 24.01.2004 kl. 06.27 skrev Casey Marshall:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> >>>>> "Øyvind" == Øyvind Harboe <oyvind.harboe@xxxxxxxxx> writes:
> 
> Øyvind> The array contains {"LOGIN"}
> 
> There you go; GNU Crypto doesn't implement this.
> 
> I'm pretty sure that this is trivial to implement, so I may have a
> crack at it sometime soon.

Note that this is already implemented in the file below, it is just
commented out. Works fine on my rocket.


http://savannah.gnu.org/cgi-bin/viewcvs/classpath/inetlib/source/gnu/inet/smtp/SMTPConnection.java?rev=HEAD&content-type=text/vnd.viewcvs-markup



 /**
   * LOGIN authentication mechanism.
   * If this returns true, EHLO should be re-issued.
   **/
  public boolean authLogin(String username, String password)
    throws IOException
  {
    send("AUTH LOGIN");
    if (getResponse()==334)
    {
      String US_ASCII = "US-ASCII";
      byte[] bytes = username.getBytes(US_ASCII);
      String encoded = new String(BASE64.encode(bytes), US_ASCII);
      send(encoded);
      if (getResponse()==334)
      {
        bytes = password.getBytes(US_ASCII);
        encoded = new String(BASE64.encode(bytes), US_ASCII);
        send(encoded);
        if (getResponse()==235)
          return true;
      }
    }
    return false;
  }

  /**
   * PLAIN authentication mechanism.
   **/
  public boolean authPlain(String username, String password)
    throws IOException
  {
    String plain = new StringBuffer(username)
      .append('\u0000')
      .append(username)
      .append('\u0000')
      .append(password)
      .toString();
    String US_ASCII = "US-ASCII";
    byte[] bytes = plain.getBytes(US_ASCII);
    String encoded = new String(BASE64.encode(bytes), US_ASCII);
    String command = new StringBuffer("AUTH PLAIN ")
      .append(encoded)
      .toString();
    send(command);
    return (getResponse()==235);
  }







_______________________________________________
gnu-crypto-discuss mailing list
gnu-crypto-discuss@xxxxxxxxxx
http://mail.nongnu.org/mailman/listinfo/gnu-crypto-discuss


[Home]     [Gnu Classpath]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]     [Red Hat 9 Bible]     [Fedora Bible]     [Red Hat 9]     [Network Security Reading]

  Powered by Linux