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


Java GSSExceptionImpl类代码示例

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


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

示例1: getNameElement

import sun.security.jgss.GSSExceptionImpl; //导入依赖的package包/类
public GSSNameSpi getNameElement(String nameStr, Oid nameType)
    throws GSSException {
    try {
        byte[] nameBytes =
            (nameStr == null ? null : nameStr.getBytes("UTF-8"));
        return new GSSNameElement(nameBytes, nameType, cStub);
    } catch (UnsupportedEncodingException uee) {
        // Shouldn't happen
        throw new GSSExceptionImpl(GSSException.FAILURE, uee);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:NativeGSSFactory.java

示例2: retrieveToken

import sun.security.jgss.GSSExceptionImpl; //导入依赖的package包/类
private byte[] retrieveToken(InputStream is, int mechTokenLen)
    throws GSSException {
    try {
        byte[] result = null;
        if (mechTokenLen != -1) {
            // Need to add back the GSS header for a complete GSS token
            SunNativeProvider.debug("Precomputed mechToken length: " +
                                     mechTokenLen);
            GSSHeader gssHeader = new GSSHeader
                (new ObjectIdentifier(cStub.getMech().toString()),
                 mechTokenLen);
            ByteArrayOutputStream baos = new ByteArrayOutputStream(600);

            byte[] mechToken = new byte[mechTokenLen];
            int len = is.read(mechToken);
            assert(mechTokenLen == len);
            gssHeader.encode(baos);
            baos.write(mechToken);
            result = baos.toByteArray();
        } else {
            // Must be unparsed GSS token or SPNEGO's NegTokenTarg token
            assert(mechTokenLen == -1);
            DerValue dv = new DerValue(is);
            result = dv.toByteArray();
        }
        SunNativeProvider.debug("Complete Token length: " +
                                result.length);
        return result;
    } catch (IOException ioe) {
        throw new GSSExceptionImpl(GSSException.FAILURE, ioe);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:NativeGSSContext.java

示例3: wrap

import sun.security.jgss.GSSExceptionImpl; //导入依赖的package包/类
public void wrap(byte inBuf[], int offset, int len,
                 OutputStream os, MessageProp msgProp)
    throws GSSException {
    try {
    byte[] result = wrap(inBuf, offset, len, msgProp);
    os.write(result);
    } catch (IOException ioe) {
        throw new GSSExceptionImpl(GSSException.FAILURE, ioe);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:NativeGSSContext.java

示例4: unwrap

import sun.security.jgss.GSSExceptionImpl; //导入依赖的package包/类
public void unwrap(InputStream inStream, OutputStream outStream,
                   MessageProp msgProp) throws GSSException {
    try {
        byte[] wrapped = new byte[inStream.available()];
        int wLength = inStream.read(wrapped);
        byte[] data = unwrap(wrapped, 0, wLength, msgProp);
        outStream.write(data);
        outStream.flush();
    } catch (IOException ioe) {
        throw new GSSExceptionImpl(GSSException.FAILURE, ioe);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:NativeGSSContext.java

示例5: getMIC

import sun.security.jgss.GSSExceptionImpl; //导入依赖的package包/类
public void getMIC(InputStream inStream, OutputStream outStream,
                   MessageProp msgProp) throws GSSException {
    try {
        int length = 0;
        byte[] msg = new byte[inStream.available()];
        length = inStream.read(msg);

        byte[] msgToken = getMIC(msg, 0, length, msgProp);
        if ((msgToken != null) && msgToken.length != 0) {
            outStream.write(msgToken);
        }
    } catch (IOException ioe) {
        throw new GSSExceptionImpl(GSSException.FAILURE, ioe);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:NativeGSSContext.java

示例6: verifyMIC

import sun.security.jgss.GSSExceptionImpl; //导入依赖的package包/类
public void verifyMIC(InputStream tokStream, InputStream msgStream,
                      MessageProp msgProp) throws GSSException {
    try {
        byte[] msg = new byte[msgStream.available()];
        int mLength = msgStream.read(msg);
        byte[] tok = new byte[tokStream.available()];
        int tLength = tokStream.read(tok);
        verifyMIC(tok, 0, tLength, msg, 0, mLength, msgProp);
    } catch (IOException ioe) {
        throw new GSSExceptionImpl(GSSException.FAILURE, ioe);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:NativeGSSContext.java

示例7: wrap

import sun.security.jgss.GSSExceptionImpl; //导入依赖的package包/类
public void wrap(byte[] inBuf, int offset, int len,
                 OutputStream os, MessageProp msgProp)
    throws GSSException {
    try {
    byte[] result = wrap(inBuf, offset, len, msgProp);
    os.write(result);
    } catch (IOException ioe) {
        throw new GSSExceptionImpl(GSSException.FAILURE, ioe);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:NativeGSSContext.java

示例8: export

import sun.security.jgss.GSSExceptionImpl; //导入依赖的package包/类
public byte[] export() throws GSSException {
    byte[] nameVal = cStub.exportName(pName);

    // Need to strip off the mech Oid portion of the exported
    // bytes since GSSNameImpl class will subsequently add it.
    int pos = 0;
    if ((nameVal[pos++] != 0x04) ||
        (nameVal[pos++] != 0x01))
        throw new GSSException(GSSException.BAD_NAME);

    int mechOidLen  = (((0xFF & nameVal[pos++]) << 8) |
                       (0xFF & nameVal[pos++]));
    ObjectIdentifier temp = null;
    try {
        DerInputStream din = new DerInputStream(nameVal, pos,
                                                mechOidLen);
        temp = new ObjectIdentifier(din);
    } catch (IOException e) {
        throw new GSSExceptionImpl(GSSException.BAD_NAME, e);
    }
    Oid mech2 = new Oid(temp.toString());
    assert(mech2.equals(getMechanism()));
    pos += mechOidLen;
    int mechPortionLen = (((0xFF & nameVal[pos++]) << 24) |
                          ((0xFF & nameVal[pos++]) << 16) |
                          ((0xFF & nameVal[pos++]) << 8) |
                          (0xFF & nameVal[pos++]));
    if (mechPortionLen < 0) {
        throw new GSSException(GSSException.BAD_NAME);
    }
    byte[] mechPortion = new byte[mechPortionLen];
    System.arraycopy(nameVal, pos, mechPortion, 0, mechPortionLen);
    return mechPortion;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:35,代码来源:GSSNameElement.java


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