Package org.ietf.jgss

Examples of org.ietf.jgss.MessageProp


    }
  }

  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


                byte[] msgbytes = msgbuf.getCompactData();
                byte[] inmic = buffer.getBytes();

                try {
                    context.verifyMIC(inmic, 0, inmic.length, msgbytes, 0, msgbytes.length, new MessageProp(false));
                    log.debug("MIC verified");
                    return Boolean.TRUE;
                } catch (GSSException e) {
                    log.info("GSS verification error: {}", e.toString());
                    return Boolean.FALSE;
View Full Code Here

                byte[] msgbytes = msgbuf.getCompactData();
                byte[] inmic = buffer.getBytes();

                try {
                    context.verifyMIC(inmic, 0, inmic.length, msgbytes, 0, msgbytes.length, new MessageProp(false));
                    log.debug("MIC verified");
                    return Boolean.TRUE;
                } catch (GSSException e) {
                    log.info("GSS verification error: {}", e.toString());
                    return Boolean.FALSE;
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

   
    /**
     * 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

     
      byte [] msgbytes = msgbuf.getCompactData();
      byte [] inmic    = buffer.getBytes();

      try {
        ctxt.verifyMIC(inmic, 0, inmic.length, msgbytes, 0, msgbytes.length, new MessageProp(false));
        log.debug("MIC verified");
        return Boolean.TRUE;
      } catch (GSSException e) {
        log.info("GSS verification error: {}", e.toString());
        return Boolean.FALSE;
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.