当前位置: 首页>>代码示例>>Java>>正文


Java Encdec.enc_uint32le方法代码示例

本文整理汇总了Java中jcifs.util.Encdec.enc_uint32le方法的典型用法代码示例。如果您正苦于以下问题:Java Encdec.enc_uint32le方法的具体用法?Java Encdec.enc_uint32le怎么用?Java Encdec.enc_uint32le使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jcifs.util.Encdec的用法示例。


在下文中一共展示了Encdec.enc_uint32le方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: enc_ndr_string

import jcifs.util.Encdec; //导入方法依赖的package包/类
public void enc_ndr_string(String s) {
    align(4);
    int i = index;
    int len = s.length();
    Encdec.enc_uint32le(len + 1, buf, i); i += 4;
    Encdec.enc_uint32le(0, buf, i); i += 4;
    Encdec.enc_uint32le(len + 1, buf, i); i += 4;
    try {
        System.arraycopy(s.getBytes("UTF-16LE"), 0, buf, i, len * 2);
    } catch( UnsupportedEncodingException uee ) {
    }
    i += len * 2;
    buf[i++] = (byte)'\0';
    buf[i++] = (byte)'\0';
    advance(i - index);
}
 
开发者ID:codelibs,项目名称:jcifs,代码行数:17,代码来源:NdrBuffer.java

示例2: getNTLMv2Response

import jcifs.util.Encdec; //导入方法依赖的package包/类
/**
 * 
 * @param responseKeyNT
 * @param serverChallenge
 * @param clientChallenge
 * @param nanos1601
 * @param avPairs
 * @return the calculated response
 */
public static byte[] getNTLMv2Response ( byte[] responseKeyNT, byte[] serverChallenge, byte[] clientChallenge, long nanos1601, byte[] avPairs ) {
    int avPairsLength = avPairs != null ? avPairs.length : 0;
    byte[] temp = new byte[28 + avPairsLength + 4];

    Encdec.enc_uint32le(0x00000101, temp, 0); // Header
    Encdec.enc_uint32le(0x00000000, temp, 4); // Reserved
    Encdec.enc_uint64le(nanos1601, temp, 8);
    System.arraycopy(clientChallenge, 0, temp, 16, 8);
    Encdec.enc_uint32le(0x00000000, temp, 24); // Unknown
    if ( avPairs != null )
        System.arraycopy(avPairs, 0, temp, 28, avPairsLength);
    Encdec.enc_uint32le(0x00000000, temp, 28 + avPairsLength); // mystery bytes!

    return NtlmUtil.computeResponse(responseKeyNT, serverChallenge, temp, 0, temp.length);
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:25,代码来源:NtlmUtil.java

示例3: enc_ndr_string

import jcifs.util.Encdec; //导入方法依赖的package包/类
public void enc_ndr_string ( String s ) {
    align(4);
    int i = this.index;
    int len = s.length();
    Encdec.enc_uint32le(len + 1, this.buf, i);
    i += 4;
    Encdec.enc_uint32le(0, this.buf, i);
    i += 4;
    Encdec.enc_uint32le(len + 1, this.buf, i);
    i += 4;
    System.arraycopy(Strings.getUNIBytes(s), 0, this.buf, i, len * 2);
    i += len * 2;
    this.buf[ i++ ] = (byte) '\0';
    this.buf[ i++ ] = (byte) '\0';
    advance(i - this.index);
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:17,代码来源:NdrBuffer.java

示例4: decryptRC4

import jcifs.util.Encdec; //导入方法依赖的package包/类
/**
 * @param data
 * @param key
 * @return
 * @throws GeneralSecurityException
 * @throws NoSuchAlgorithmException
 * @throws NoSuchPaddingException
 * @throws InvalidKeyException
 * @throws IllegalBlockSizeException
 * @throws BadPaddingException
 */
private static byte[] decryptRC4 ( byte[] data, Key key ) throws GeneralSecurityException, NoSuchAlgorithmException, NoSuchPaddingException,
        InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
    Cipher cipher;
    byte[] decrypt;
    byte[] code = new byte[4];
    Encdec.enc_uint32le(2, code, 0);
    byte[] codeHmac = getHmac(code, key.getEncoded());

    byte[] dataChecksum = new byte[KerberosConstants.CHECKSUM_SIZE];
    System.arraycopy(data, 0, dataChecksum, 0, KerberosConstants.CHECKSUM_SIZE);

    byte[] dataHmac = getHmac(dataChecksum, codeHmac);
    SecretKeySpec dataKey = new SecretKeySpec(dataHmac, KerberosConstants.RC4_ALGORITHM);

    cipher = Cipher.getInstance(KerberosConstants.RC4_ALGORITHM);
    cipher.init(Cipher.DECRYPT_MODE, dataKey);

    int plainDataLength = data.length - KerberosConstants.CHECKSUM_SIZE;
    byte[] plainData = cipher.doFinal(data, KerberosConstants.CHECKSUM_SIZE, plainDataLength);

    byte[] plainDataChecksum = getHmac(plainData, codeHmac);
    if ( plainDataChecksum.length >= KerberosConstants.CHECKSUM_SIZE )
        for ( int i = 0; i < KerberosConstants.CHECKSUM_SIZE; i++ )
            if ( plainDataChecksum[ i ] != data[ i ] )
                throw new GeneralSecurityException("Checksum failed while decrypting.");

    int decryptLength = plainData.length - KerberosConstants.CONFOUNDER_SIZE;
    decrypt = new byte[decryptLength];
    System.arraycopy(plainData, KerberosConstants.CONFOUNDER_SIZE, decrypt, 0, decryptLength);
    return decrypt;
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:43,代码来源:KerberosEncData.java

示例5: enc_ndr_long

import jcifs.util.Encdec; //导入方法依赖的package包/类
public void enc_ndr_long(int l) {
    align(4);
    Encdec.enc_uint32le(l, buf, index);
    advance(4);
}
 
开发者ID:codelibs,项目名称:jcifs,代码行数:6,代码来源:NdrBuffer.java

示例6: enc_ndr_long

import jcifs.util.Encdec; //导入方法依赖的package包/类
public void enc_ndr_long ( int l ) {
    align(4);
    Encdec.enc_uint32le(l, this.buf, this.index);
    advance(4);
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:6,代码来源:NdrBuffer.java


注:本文中的jcifs.util.Encdec.enc_uint32le方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。