Package org.ietf.jgss

Examples of org.ietf.jgss.MessageProp


                    startupLatch.release();
                }
            } else {
                ByteBuffer buffer = packet.getBuffer();

                byte[] token = context.unwrap(buffer.array(), buffer.position(), buffer.remaining(), new MessageProp(0, true));
                UpPacket message = new UpPacket();
                message.setBuffer((ByteBuffer) ByteBuffer.allocate(token.length).put(token).flip());

                MetadataSupport.setSubject(message, clientSubject);
View Full Code Here


            for (Iterator iter = packet.getBuffers().iterator(); iter.hasNext();) {
                buffer.put((ByteBuffer) iter.next());
            }
            buffer.flip();

            byte[] token = context.wrap(buffer.array(), buffer.position(), buffer.remaining(), new MessageProp(0, true));
            PlainDownPacket reply = new PlainDownPacket();
            reply.setBuffers(Collections.singletonList(ByteBuffer.allocate(token.length).put(token).flip()));
            getDownProtocol().sendDown(reply);
        } catch (GSSException e) {
            throw new ProtocolException(e);
View Full Code Here

                    log.trace("RELEASED " + startupLatch);
                }
            } else {
                ByteBuffer buffer = packet.getBuffer();

                byte[] token = context.unwrap(buffer.array(), buffer.position(), buffer.remaining(), new MessageProp(0, true));
                UpPacket message = new UpPacket();
                message.setBuffer((ByteBuffer) ByteBuffer.allocate(token.length).put(token).flip());
                getUpProtocol().sendUp(message);
            }
        } catch (GSSException e) {
View Full Code Here

            for (Iterator iter = packet.getBuffers().iterator(); iter.hasNext();) {
                buffer.put((ByteBuffer) iter.next());
            }
            buffer.flip();

            byte[] token = context.wrap(buffer.array(), buffer.position(), buffer.remaining(), new MessageProp(0, true));
            PlainDownPacket reply = new PlainDownPacket();
            reply.setBuffers(Collections.singletonList(ByteBuffer.allocate(token.length).put(token).flip()));
            getDownProtocol().sendDown(reply);
        } catch (GSSException e) {
            throw new ProtocolException(e);
View Full Code Here

    }
  }

  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;
    }
View Full Code Here

   *        sent out
   * @param len number of bytes to be sent out
   * @throws IOException if problems encountered
   */
  void write(byte[] buf, int offset, int len) throws IOException {
      MessageProp prop;
      if (doEncryption) {
    prop = new MessageProp(PRIVACY_QOP, true);
      } else { // 2 means "integrity using DES MAC of MD5 of plaintext"
    prop = new MessageProp(INTEGRITY_QOP, false);
      }
      byte[] token = null;
      try {
    try {
        synchronized (gssContext) {
      token = gssContext.wrap(buf, offset, len, prop);
        }
    } catch (GSSException ge) {
        IOException ioe = new IOException(
      "Failed to wrap buf into GSS token.");
        ioe.initCause(ge);
        throw ioe;
    }

    if (doEncryption != prop.getPrivacy()) {
        throw new IOException(
      "Returned token encryption property is: " +
      prop.getPrivacy() + ",\nwhile connection " +
      "encryption requirement is: " + doEncryption);
    }
     
    if (connectionLogger.isLoggable(Level.FINEST)) {
        connectionLogger.log(
View Full Code Here

   * @return byte array of the unwrapped GSS token
   * @throws IOException if problems encountered
   */
  byte[] read() throws IOException {
      try {
    MessageProp prop = new MessageProp(0, false);
    byte[] token = new byte[dis.readInt()];
    dis.readFully(token);
   
    byte[] bytes;
    try {
        synchronized (gssContext) {
      bytes = gssContext.unwrap(
          token, 0, token.length, prop);
        }
    } catch (GSSException e) {
        IOException ioe = new IOException(
      "Failed to unwrap a GSS token of length " +
      token.length);
        ioe.initCause(e);
        throw ioe;
    }
   
    /* this state of the connection can changed by
       every incoming token */
    doEncryption = prop.getPrivacy();
   
    if (connectionLogger.isLoggable(Level.FINEST)) {
        connectionLogger.log(
      Level.FINEST,  "received a " + token.length +
      " bytes token (" + (doEncryption ? "" : "not ") +
View Full Code Here

   
    /**
     * Unwrap a key
     */
    public byte[] unwrapKey(byte[] secret) throws WSSecurityException {
        MessageProp mProp = new MessageProp(0, true);
        try {
            return secContext.unwrap(secret, 0, secret.length, mProp);
        } catch (GSSException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Error in cleaning up a GSS context", e);
View Full Code Here

   
    /**
     * Wrap a key
     */
    public byte[] wrapKey(byte[] secret) throws WSSecurityException {
        MessageProp mProp = new MessageProp(0, true);
        try {
            return secContext.wrap(secret, 0, secret.length, mProp);
        } catch (GSSException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Error in cleaning up a GSS context", e);
View Full Code Here

    }
  }

  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;
    }
View Full Code Here

TOP

Related Classes of org.ietf.jgss.MessageProp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.