1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.security.ntlm.msrpc;
16  
17  import jcifs.dcerpc.ndr.NdrBuffer;
18  import jcifs.dcerpc.ndr.NdrObject;
19  
20  /**
21   * <a href="NetlogonAuthenticator.java.html"><b><i>View Source</i></b></a>
22   *
23   * @author Marcellus Tavares
24   */
25  public class NetlogonAuthenticator extends NdrObject {
26  
27      public NetlogonAuthenticator() {
28          _credential = new byte[8];
29      }
30  
31      public NetlogonAuthenticator(byte[] credential, int timestamp) {
32          _credential = credential;
33          _timestamp = timestamp;
34      }
35  
36      public void decode(NdrBuffer ndrBuffer) {
37          ndrBuffer.align(4);
38  
39          int index = ndrBuffer.index;
40  
41          ndrBuffer.advance(8);
42  
43          _timestamp = ndrBuffer.dec_ndr_long();
44  
45          ndrBuffer = ndrBuffer.derive(index);
46  
47          for (int i = 0; i < 8; i++) {
48              _credential[i] = (byte) ndrBuffer.dec_ndr_small();
49          }
50      }
51      public void encode(NdrBuffer ndrBuffer) {
52          ndrBuffer.align(4);
53  
54          int index = ndrBuffer.index;
55  
56          ndrBuffer.advance(8);
57  
58          ndrBuffer.enc_ndr_long(_timestamp);
59  
60          ndrBuffer = ndrBuffer.derive(index);
61  
62          for (int i = 0; i < 8; i++) {
63              ndrBuffer.enc_ndr_small(_credential[i]);
64          }
65      }
66  
67      private byte[] _credential;
68      private int _timestamp;
69  
70  }