src/main/java/org/tinyradius/packet/AccessRequest.java
protected void encodeRequestAttributes(String sharedSecret) {
        if (password == null || password.length() == 0) {
            return;
        }
        // ok for proxied packets whose CHAP password is already encrypted
        //throw new RuntimeException("no password set");

        if (getAuthProtocol().equals(AUTH_PAP)) {
            byte[] pass = encodePapPassword(RadiusUtil.getUtf8Bytes(this.password), RadiusUtil.getUtf8Bytes(sharedSecret));
            removeAttributes(USER_PASSWORD);
            addAttribute(new RadiusAttribute(USER_PASSWORD, pass));
        }
        else if (getAuthProtocol().equals(AUTH_CHAP)) {
            byte[] challenge = createChapChallenge();
            byte[] pass = encodeChapPassword(password, challenge);
            removeAttributes(CHAP_PASSWORD);
            removeAttributes(CHAP_CHALLENGE);
            addAttribute(new RadiusAttribute(CHAP_PASSWORD, pass));
            addAttribute(new RadiusAttribute(CHAP_CHALLENGE, challenge));
        }
    }
/**
     * Sets and encrypts the User-Password attribute.
     *
     * @see org.tinyradius.packet.RadiusPacket#encodeRequestAttributes(java.lang.String)
     */
Sets and encrypts the User-Password attribute.


Sets and encrypts the User - Password attribute .
protected void encodeRequestAttributes(String sharedSecret) {
        if (password == null || password.length() == 0) {
            return;
        }
        if (getAuthProtocol().equals(AUTH_PAP)) {
            byte[] pass = encodePapPassword(RadiusUtil.getUtf8Bytes(this.password), RadiusUtil.getUtf8Bytes(sharedSecret));
            removeAttributes(USER_PASSWORD);
            addAttribute(new RadiusAttribute(USER_PASSWORD, pass));
        }
        else if (getAuthProtocol().equals(AUTH_CHAP)) {
            byte[] challenge = createChapChallenge();
            byte[] pass = encodeChapPassword(password, challenge);
            removeAttributes(CHAP_PASSWORD);
            removeAttributes(CHAP_CHALLENGE);
            addAttribute(new RadiusAttribute(CHAP_PASSWORD, pass));
            addAttribute(new RadiusAttribute(CHAP_CHALLENGE, challenge));
        }
    }
protected void encodeRequestAttributes ( String sharedSecret ) { if ( password == null || password . length ( ) == 0 ) { return ; } if ( getAuthProtocol ( ) . equals ( AUTH_PAP ) ) { byte [ ] pass = encodePapPassword ( RadiusUtil . getUtf8Bytes ( this . password ) , RadiusUtil . getUtf8Bytes ( sharedSecret ) ) ; removeAttributes ( USER_PASSWORD ) ; addAttribute ( new RadiusAttribute ( USER_PASSWORD , pass ) ) ; } else if ( getAuthProtocol ( ) . equals ( AUTH_CHAP ) ) { byte [ ] challenge = createChapChallenge ( ) ; byte [ ] pass = encodeChapPassword ( password , challenge ) ; removeAttributes ( CHAP_PASSWORD ) ; removeAttributes ( CHAP_CHALLENGE ) ; addAttribute ( new RadiusAttribute ( CHAP_PASSWORD , pass ) ) ; addAttribute ( new RadiusAttribute ( CHAP_CHALLENGE , challenge ) ) ; } }
Sets and encrypts the User-Password attribute.
Sets and encrypts the User - Password attribute .
// ok for proxied packets whose CHAP password is already encrypted
 //throw new RuntimeException("no password set");
