• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Confounder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中sun.security.krb5.Confounder的典型用法代码示例。如果您正苦于以下问题:Java Confounder类的具体用法?Java Confounder怎么用?Java Confounder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Confounder类属于sun.security.krb5包,在下文中一共展示了Confounder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: randInit

import sun.security.krb5.Confounder; //导入依赖的package包/类
public synchronized void randInit() {
    /*
     * Sequence numbers fall in the range 0 through 2^32 - 1 and wrap
     * to zero following the value 2^32 - 1.
     * Previous implementations used signed sequence numbers.
     * Workaround implementation incompatibilities by not generating
     * initial sequence numbers greater than 2^30, as done
     * in MIT distribution.
     */
    // get the random confounder
    byte[] data = Confounder.bytes(4);
    data[0] = (byte)(data[0] & 0x3f);
    int result = ((data[3] & 0xff) |
                    ((data[2] & 0xff) << 8) |
                    ((data[1] & 0xff) << 16) |
                    ((data[0] & 0xff) << 24));
    if (result == 0) {
       result = 1;
    }
    lastSeqNumber = result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:LocalSeqNumber.java


示例2: WrapToken

import sun.security.krb5.Confounder; //导入依赖的package包/类
public WrapToken(Krb5Context context, MessageProp prop,
                 byte[] dataBytes, int dataOffset, int dataLen)
    throws GSSException {

    super(Krb5Token.WRAP_ID, context);

    confounder = Confounder.bytes(CONFOUNDER_SIZE);

    padding = getPadding(dataLen);
    dataSize = confounder.length + dataLen + padding.length;
    this.dataBytes = dataBytes;
    this.dataOffset = dataOffset;
    this.dataLen = dataLen;

    /*
      debug("\nWrapToken cons: data to wrap is [" +
      getHexBytes(confounder) + " " +
      getHexBytes(dataBytes, dataOffset, dataLen) + " " +
      // padding is never null for Wrap
      getHexBytes(padding) + "]\n");
     */

    genSignAndSeqNumber(prop,
                        confounder,
                        dataBytes, dataOffset, dataLen,
                        padding);

    /*
     * If the application decides to ask for privacy when the context
     * did not negotiate for it, do not provide it. The peer might not
     * have support for it. The app will realize this with a call to
     * pop.getPrivacy() after wrap().
     */
    if (!context.getConfState())
        prop.setPrivacy(false);

    privacy = prop.getPrivacy();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:WrapToken.java


示例3: calculateKeyedChecksum

import sun.security.krb5.Confounder; //导入依赖的package包/类
/**
 * Calculates keyed checksum.
 * @param data the data used to generate the checksum.
 * @param size length of the data.
 * @param key the key used to encrypt the checksum.
 * @return keyed checksum.
 *
 * @modified by Yanni Zhang, 12/08/99.
 */
public byte[] calculateKeyedChecksum(byte[] data, int size, byte[] key,
    int usage) throws KrbCryptoException {
    //prepend confounder
    byte[] new_data = new byte[size + confounderSize()];
    byte[] conf = Confounder.bytes(confounderSize());
    System.arraycopy(conf, 0, new_data, 0, confounderSize());
    System.arraycopy(data, 0, new_data, confounderSize(), size);

    //calculate md5 cksum
    byte[] mdc_cksum = calculateChecksum(new_data, new_data.length);
    byte[] cksum = new byte[cksumSize()];
    System.arraycopy(conf, 0, cksum, 0, confounderSize());
    System.arraycopy(mdc_cksum, 0, cksum, confounderSize(),
                     cksumSize() - confounderSize());

    //compute modified key
    byte[] new_key = new byte[keySize()];
    System.arraycopy(key, 0, new_key, 0, key.length);
    for (int i = 0; i < new_key.length; i++)
    new_key[i] = (byte)(new_key[i] ^ 0xf0);
    //check for weak keys
    try {
        if (DESKeySpec.isWeak(new_key, 0)) {
            new_key[7] = (byte)(new_key[7] ^ 0xF0);
        }
    } catch (InvalidKeyException ex) {
        // swallow, since it should never happen
    }
    byte[] ivec = new byte[new_key.length];

    //des-cbc encrypt
    byte[] enc_cksum = new byte[cksum.length];
    Des.cbc_encrypt(cksum, enc_cksum, new_key, ivec, true);
    return enc_cksum;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:RsaMd5DesCksumType.java


示例4: WrapToken_v2

import sun.security.krb5.Confounder; //导入依赖的package包/类
/**
 * Writes a WrapToken_v2 object
 */
public WrapToken_v2(Krb5Context context, MessageProp prop,
                 byte[] dataBytes, int dataOffset, int dataLen)
        throws GSSException {

    super(Krb5Token.WRAP_ID_v2, context);

    confounder = Confounder.bytes(CONFOUNDER_SIZE);

    // debug("\nWrapToken cons: data to wrap is [" +
    // getHexBytes(confounder) + " " +
    // getHexBytes(dataBytes, dataOffset, dataLen) + "]\n");

    genSignAndSeqNumber(prop, dataBytes, dataOffset, dataLen);

    /*
     * If the application decides to ask for privacy when the context
     * did not negotiate for it, do not provide it. The peer might not
     * have support for it. The app will realize this with a call to
     * pop.getPrivacy() after wrap().
     */
    if (!context.getConfState())
        prop.setPrivacy(false);

    privacy = prop.getPrivacy();

    if (!privacy) {
        // Wrap Tokens (without confidentiality) =
        // { 16 byte token_header | plaintext | 12-byte HMAC }
        // where HMAC is on { plaintext | token_header }

        tokenData = new byte[dataLen + checksum.length];
        System.arraycopy(dataBytes, dataOffset, tokenData, 0, dataLen);
        System.arraycopy(checksum, 0, tokenData, dataLen, checksum.length);
    } else {
        // Wrap Tokens (with confidentiality) =
        // { 16 byte token_header |
        // Encrypt(16-byte confounder | plaintext | token_header) |
        // 12-byte HMAC }

        tokenData = cipherHelper.encryptData(this, confounder, getTokenHeader(),
            dataBytes, dataOffset, dataLen, getKeyUsage());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:47,代码来源:WrapToken_v2.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SocialConfigurer类代码示例发布时间:2022-05-21
下一篇:
Java Config类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap