## org.beepcore.beep.profile.sasl.otp
Class SASLOTPProfile

    java.lang.Object
      org.beepcore.beep.core.TuningProfile
          org.beepcore.beep.profile.sasl.SASLProfile
              org.beepcore.beep.profile.sasl.otp.SASLOTPProfile

All Implemented Interfaces:
  org.beepcore.beep.profile.Profile, org.beepcore.beep.core.StartChannelListener

public class SASLOTPProfile
extends SASLProfile
implements org.beepcore.beep.core.StartChannelListener, org.beepcore.beep.profile.Profile

This class implements the OTP (One-Time-Password) SASL mechanism as an extension of the base SASL profile.

Field Summary
`static java.lang.String` `ERR_INVALID_ID`
`static java.lang.String` `ERR_PARSING_DB`
`static java.lang.String` `ERR_REJECTED`
`static java.lang.String` `EXT`
`static java.lang.String` `HEX`
`static java.lang.String` `HEX_INIT`
`static java.lang.String` `MECHANISM`
`static java.lang.String` `OTP_DB_FILENAME`
`static java.lang.String` `SASL_OTP`
`static java.lang.String` `SPACE`
`static java.lang.String` `URI`
`static java.lang.String` `WORD`
`static java.lang.String` `WORD_INIT`

Fields inherited from class org.beepcore.beep.profile.sasl.SASLProfile
`COMPLETE, ENCODING_BASE64, ENCODING_DEFAULT, ENCODING_NONE, LOCALIZE_DEFAULT, SASL, SASL_STATUS_ABORT, SASL_STATUS_COMPLETE, SASL_STATUS_CONTINUE, SASL_STATUS_NONE, sessionTable`

Constructor Summary
`SASLOTPProfile()`

Method Summary
`boolean` `advertiseProfile(org.beepcore.beep.core.Session session)`
`static org.beepcore.beep.core.Session` `AuthenticateSASLOTP(org.beepcore.beep.core.Session session, java.lang.String authorizeId, java.lang.String authenticateId, java.lang.String pwd)` Method AuthenticateSASLOTP starts SASL OTP Authentication between two peers.
`static org.beepcore.beep.core.Session` `AuthenticateSASLOTPPiggybacked(org.beepcore.beep.core.Session session, java.lang.String authorizeId, java.lang.String authenticateId, java.lang.String pwd)`
`static org.beepcore.beep.core.Session` `AuthenticateSASLOTPWithInit(org.beepcore.beep.core.Session session, java.lang.String authorizeId, java.lang.String authenticateId, java.lang.String pwd, java.lang.String newAlgorithm, java.lang.String newHash, java.lang.String newSeed, java.lang.String newSequence)`
`void` `closeChannel(org.beepcore.beep.core.Channel channel)`
`static java.lang.String` `convertBytesToHex(byte[] hash)`
`protected long` `convertBytesToLong(byte[] hash)`
`static byte[]` `convertHexToBytes(java.lang.String hash)`
`static long` `convertHexToLong(java.lang.String hash)`
`static byte[]` `convertLongToBytes(long l)`
`protected void` `failListenerAuthentication(org.beepcore.beep.core.Session session, java.lang.String authenticator)`
`protected void` `finishInitiatorAuthentication(org.beepcore.beep.core.SessionCredential cred, org.beepcore.beep.core.Session s)` Method finishInitiatorAuthentication basically says 'we've authenticated successfully' and calls the tuningprofile method (exposed by SASLProfile's extension of the core class TuningProfile) which sets the local credential.
`protected void` `finishListenerAuthentication(org.beepcore.beep.core.SessionCredential cred, org.beepcore.beep.core.Session s)` Method finishListenerAuthentication basically says 'some peer has authenticated successfully' and calls the tuningprofile method (exposed by SASLProfile's extension of the core class TuningProfile) which sets the peer credential.
`org.beepcore.beep.core.StartChannelListener` `getStartChannelListener()`
`org.beepcore.beep.core.StartChannelListener` `init(java.lang.String uri, org.beepcore.beep.profile.ProfileConfiguration config)` Method init is used to construct various static data used in the SASL OTP profile.
`void` `startChannel(org.beepcore.beep.core.Channel channel, java.lang.String encoding, java.lang.String data)`
`protected boolean` `validateIdentity(java.lang.String authenticateId, org.beepcore.beep.profile.sasl.otp.OTPAuthenticator a)`

Methods inherited from class org.beepcore.beep.profile.sasl.SASLProfile
`clearCredential, failListenerAuthentication`

Methods inherited from class org.beepcore.beep.core.TuningProfile
`abort, begin, begin, complete, disableIO, enableIO, reset, sendProfile, setLocalCredential, setPeerCredential, startChannel`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### URI

    public static final java.lang.String URI

See Also:
  Constant Field Values

### EXT

    public static final java.lang.String EXT

See Also:
  Constant Field Values

### HEX

    public static final java.lang.String HEX

See Also:
  Constant Field Values

### SPACE

    public static final java.lang.String SPACE

See Also:
  Constant Field Values

### WORD

    public static final java.lang.String WORD

See Also:
  Constant Field Values

### HEX_INIT

    public static final java.lang.String HEX_INIT

See Also:
  Constant Field Values

### OTP_DB_FILENAME

    public static final java.lang.String OTP_DB_FILENAME

See Also:
  Constant Field Values

### SASL_OTP

    public static final java.lang.String SASL_OTP

See Also:
  Constant Field Values

### WORD_INIT

    public static final java.lang.String WORD_INIT

See Also:
  Constant Field Values

### MECHANISM

    public static final java.lang.String MECHANISM

See Also:
  Constant Field Values

### ERR_PARSING_DB

    public static final java.lang.String ERR_PARSING_DB

See Also:
  Constant Field Values

### ERR_REJECTED

    public static final java.lang.String ERR_REJECTED

See Also:
  Constant Field Values

### ERR_INVALID_ID

    public static final java.lang.String ERR_INVALID_ID

See Also:
  Constant Field Values

Constructor Detail

### SASLOTPProfile

    public SASLOTPProfile()

Method Detail

### init

    public org.beepcore.beep.core.StartChannelListener init(java.lang.String uri,
                                                            org.beepcore.beep.profile.ProfileConfiguration config)
                                                     throws org.beepcore.beep.core.BEEPException

  Method init is used to construct various static data used in the SASL OTP profile.

  Specified by:
    `init` in interface `org.beepcore.beep.profile.Profile`
  Throws:
    `org.beepcore.beep.core.BEEPException`

### startChannel

    public void startChannel(org.beepcore.beep.core.Channel channel,
                             java.lang.String encoding,
                             java.lang.String data)
                      throws org.beepcore.beep.core.StartChannelException

  Specified by:
    `startChannel` in interface `org.beepcore.beep.core.StartChannelListener`
  Throws:
    `org.beepcore.beep.core.StartChannelException`

### advertiseProfile

    public boolean advertiseProfile(org.beepcore.beep.core.Session session)

  Specified by:
    `advertiseProfile` in interface `org.beepcore.beep.core.StartChannelListener`

### validateIdentity

    protected boolean validateIdentity(java.lang.String authenticateId,
                                       org.beepcore.beep.profile.sasl.otp.OTPAuthenticator a)
                                throws SASLException

  Throws:
    `SASLException`

### closeChannel

    public void closeChannel(org.beepcore.beep.core.Channel channel)
                      throws org.beepcore.beep.core.CloseChannelException

  Specified by:
    `closeChannel` in interface `org.beepcore.beep.core.StartChannelListener`
  Throws:
    `org.beepcore.beep.core.CloseChannelException`

### getStartChannelListener

    public org.beepcore.beep.core.StartChannelListener getStartChannelListener()

### finishInitiatorAuthentication

    protected void finishInitiatorAuthentication(org.beepcore.beep.core.SessionCredential cred,
                                                 org.beepcore.beep.core.Session s)

  Description copied from class: `SASLProfile`
  Method finishInitiatorAuthentication basically says 'we've authenticated successfully' and calls the tuningprofile method (exposed by SASLProfile's extension of the core class TuningProfile) which sets the local credential. The session has two credentials, one in each direction, so it's necessary to differentiate between local credentials and credentials associated with the peer in a given session.

  Overrides:
    `finishInitiatorAuthentication` in class `SASLProfile`

### finishListenerAuthentication

    protected void finishListenerAuthentication(org.beepcore.beep.core.SessionCredential cred,
                                                org.beepcore.beep.core.Session s)
                                         throws SASLException

  Description copied from class: `SASLProfile`
  Method finishListenerAuthentication basically says 'some peer has authenticated successfully' and calls the tuningprofile method (exposed by SASLProfile's extension of the core class TuningProfile) which sets the peer credential. The session has two credentials, one in each direction, so it's necessary to differentiate between local credentials and credentials associated with the peer in a given session.

  Overrides:
    `finishListenerAuthentication` in class `SASLProfile`
  Throws:
    `SASLException`

### failListenerAuthentication

    protected void failListenerAuthentication(org.beepcore.beep.core.Session session,
                                              java.lang.String authenticator)

### AuthenticateSASLOTP

    public static org.beepcore.beep.core.Session AuthenticateSASLOTP(org.beepcore.beep.core.Session session,
                                                                     java.lang.String authorizeId,
                                                                     java.lang.String authenticateId,
                                                                     java.lang.String pwd)
                                                              throws SASLException

  Method AuthenticateSASLOTP starts SASL OTP Authentication between two peers. This is the NON-Piggybacking version (it doesn't send the initial identity information on the startChannelRequest). If you want to do that (I recommend it, then use the NEXT one).

  Parameters:
    `session` - Session is the session the user is authenticating on, in other words, represents the peer we want to authenticate to.
    `authorizeId` - The identity this peer wants to be authorized to act as.
    `authenticateId` - The identity this peer will authenticate as
    `pwd` - The passphrase to authenticate with (it isn't stored or kept around very long at all, it's only used in computation).
  Throws:
    `SASLException` - if any issue is encountered (usually rejection by the other peer).

### AuthenticateSASLOTPPiggybacked

    public static org.beepcore.beep.core.Session AuthenticateSASLOTPPiggybacked(org.beepcore.beep.core.Session session,
                                                                                java.lang.String authorizeId,
                                                                                java.lang.String authenticateId,
                                                                                java.lang.String pwd)
                                                                         throws SASLException

  Throws:
    `SASLException`

### AuthenticateSASLOTPWithInit

    public static org.beepcore.beep.core.Session AuthenticateSASLOTPWithInit(org.beepcore.beep.core.Session session,
                                                                             java.lang.String authorizeId,
                                                                             java.lang.String authenticateId,
                                                                             java.lang.String pwd,
                                                                             java.lang.String newAlgorithm,
                                                                             java.lang.String newHash,
                                                                             java.lang.String newSeed,
                                                                             java.lang.String newSequence)
                                                                      throws SASLException

  Throws:
    `SASLException`

### convertLongToBytes

    public static byte[] convertLongToBytes(long l)

### convertBytesToLong

    protected long convertBytesToLong(byte[] hash)

### convertHexToLong

    public static long convertHexToLong(java.lang.String hash)
                                 throws SASLException

  Throws:
    `SASLException`

### convertBytesToHex

    public static java.lang.String convertBytesToHex(byte[] hash)

### convertHexToBytes

    public static byte[] convertHexToBytes(java.lang.String hash)
                                    throws SASLException

  Throws:
    `SASLException`

Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.