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


Java MessageProp类代码示例

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


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

示例1: unwrap

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
public byte[] unwrap(byte[] t, final boolean privacy)
        throws Exception {
    return doAs(new Action() {
        @Override
        public byte[] run(Context me, byte[] input) throws Exception {
            System.out.printf("unwrap %s privacy from %s: ", privacy?"with":"without", me.name);
            MessageProp p1 = new MessageProp(0, privacy);
            byte[] bytes;
            if (usingStream) {
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                me.x.unwrap(new ByteArrayInputStream(input), os, p1);
                bytes = os.toByteArray();
            } else {
                bytes = me.x.unwrap(input, 0, input.length, p1);
            }
            System.out.println(printProp(p1));
            return bytes;
        }
    }, t);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:Context.java

示例2: verifyMic

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
public void verifyMic(byte[] t, final byte[] msg) throws Exception {
    doAs(new Action() {
        @Override
        public byte[] run(Context me, byte[] input) throws Exception {
            MessageProp p1 = new MessageProp(0, true);
            System.out.printf("verifyMic from %s: ", me.name);
            if (usingStream) {
                me.x.verifyMIC(new ByteArrayInputStream(input),
                        new ByteArrayInputStream(msg), p1);
            } else {
                me.x.verifyMIC(input, 0, input.length,
                        msg, 0, msg.length,
                        p1);
            }
            System.out.println(printProp(p1));
            return null;
        }
    }, t);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:Context.java

示例3: getMIC

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
public byte[] getMIC(byte[] message, int s, int l){
  try{
    MessageProp prop =  new MessageProp(0, true);
    return context.getMIC(message, s, l, prop);
  }
  catch(GSSException ex){
    return null;
  }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:10,代码来源:GSSContextKrb5.java

示例4: printProp

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
/**
 * Returns a string description of a MessageProp object
 * @param prop the object
 * @return the description
 */
static public String printProp(MessageProp prop) {
    StringBuffer sb = new StringBuffer();
    sb.append("MessagePop: ");
    sb.append("QOP="+ prop.getQOP() + ", ");
    sb.append(prop.getPrivacy()?"privacy, ":"");
    sb.append(prop.isDuplicateToken()?"dup, ":"");
    sb.append(prop.isGapToken()?"gap, ":"");
    sb.append(prop.isOldToken()?"old, ":"");
    sb.append(prop.isUnseqToken()?"unseq, ":"");
    if (prop.getMinorStatus() != 0) {
        sb.append(prop.getMinorString()+ "(" + prop.getMinorStatus()+")");
    }
    return sb.toString();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:Context.java

示例5: calculateMIC

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @throws CIFSException
 *
 * @see jcifs.smb.SSPContext#calculateMIC(byte[])
 */
@Override
public byte[] calculateMIC ( byte[] data ) throws CIFSException {
    try {
        return this.gssContext.getMIC(data, 0, data.length, new MessageProp(false));
    }
    catch ( GSSException e ) {
        throw new CIFSException("Failed to calculate MIC", e);
    }
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:17,代码来源:Kerb5Context.java

示例6: verifyMIC

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see jcifs.smb.SSPContext#verifyMIC(byte[], byte[])
 */
@Override
public void verifyMIC ( byte[] data, byte[] mic ) throws CIFSException {
    try {
        this.gssContext.verifyMIC(mic, 0, mic.length, data, 0, data.length, new MessageProp(false));
    }
    catch ( GSSException e ) {
        throw new CIFSException("Failed to verify MIC", e);
    }
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:15,代码来源:Kerb5Context.java

示例7: encryptInternal

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
@Override
protected byte[] encryptInternal(final byte[] bytes) throws EncryptionCodecException {
    LOGGER.trace("encryptInternal() called...");

    try {
        LOGGER.debug("Encrypting content with context.wrap()...");
        return context.wrap(bytes, 0, bytes.length, new MessageProp(0, true));
    } catch (final GSSException gsse) {
        throw new EncryptionCodecException("Unable to encrypt the outgoing ACI data.", gsse);
    }
}
 
开发者ID:hpe-idol,项目名称:java-aci-api-ng,代码行数:12,代码来源:GssEncryptionCodec.java

示例8: decryptInternal

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
@Override
protected byte[] decryptInternal(final byte[] bytes) throws EncryptionCodecException {
    LOGGER.trace("decryptInternal() called...");

    try {
        LOGGER.debug("Decrypting content with context.unwrap()...");
        return context.unwrap(bytes, 0, bytes.length, new MessageProp(0, true));
    } catch (final GSSException gsse) {
        throw new EncryptionCodecException("Unable to decrypt the incoming ACI data.", gsse);
    }
}
 
开发者ID:hpe-idol,项目名称:java-aci-api-ng,代码行数:12,代码来源:GssEncryptionCodec.java

示例9: testEncryptInternal

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
@Test
public void testEncryptInternal() throws GSSException, EncryptionCodecException {
    final GSSContext gssContext = when(spy(GSSContext.class).wrap((byte[]) any(), anyInt(), anyInt(), any(MessageProp.class))).thenReturn("This is a test result...".getBytes()).getMock();
    final GssEncryptionCodec codec = new GssEncryptionCodec(gssContext);

    final byte[] result = codec.encryptInternal("This is a test...".getBytes());
    assertThat(new String(result), is(equalTo("This is a test result...")));

    verify(gssContext).wrap((byte[]) any(), anyInt(), anyInt(), any(MessageProp.class));
    verifyNoMoreInteractions(gssContext);
}
 
开发者ID:hpe-idol,项目名称:java-aci-api-ng,代码行数:12,代码来源:GssEncryptionCodecTest.java

示例10: testEncryptInternalException

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
@Test(expected = EncryptionCodecException.class)
@SuppressWarnings("unchecked")
public void testEncryptInternalException() throws GSSException, EncryptionCodecException {
    final GssEncryptionCodec codec = new GssEncryptionCodec(
            when(spy(GSSContext.class).wrap((byte[]) any(), anyInt(), anyInt(), any(MessageProp.class))).thenThrow(GSSException.class).<GSSContext>getMock()
    );

    codec.encryptInternal("This is a test...".getBytes());
    fail("Should've thrown a GSSException...");
}
 
开发者ID:hpe-idol,项目名称:java-aci-api-ng,代码行数:11,代码来源:GssEncryptionCodecTest.java

示例11: testDecryptInternal

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
@Test
public void testDecryptInternal() throws GSSException, EncryptionCodecException {
    final GSSContext gssContext = when(spy(GSSContext.class).unwrap((byte[]) any(), anyInt(), anyInt(), any(MessageProp.class))).thenReturn("This is a test...".getBytes()).getMock();
    final GssEncryptionCodec codec = new GssEncryptionCodec(gssContext);

    final byte[] result = codec.decryptInternal("This is a test result...".getBytes());
    assertThat(new String(result), is(equalTo("This is a test...")));

    verify(gssContext).unwrap((byte[]) any(), anyInt(), anyInt(), any(MessageProp.class));
    verifyNoMoreInteractions(gssContext);
}
 
开发者ID:hpe-idol,项目名称:java-aci-api-ng,代码行数:12,代码来源:GssEncryptionCodecTest.java

示例12: testDecryptInternalException

import org.ietf.jgss.MessageProp; //导入依赖的package包/类
@Test(expected = EncryptionCodecException.class)
@SuppressWarnings("unchecked")
public void testDecryptInternalException() throws GSSException, EncryptionCodecException {
    final GssEncryptionCodec codec = new GssEncryptionCodec(
            when(spy(GSSContext.class).unwrap((byte[]) any(), anyInt(), anyInt(), any(MessageProp.class))).thenThrow(GSSException.class).<GSSContext>getMock()
    );

    codec.decryptInternal("This is a test result...".getBytes());
    fail("Should've thrown a GSSException...");
}
 
开发者ID:hpe-idol,项目名称:java-aci-api-ng,代码行数:11,代码来源:GssEncryptionCodecTest.java


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