Tabnine Logo
ApRep
Code IndexAdd Tabnine to your IDE (free)

How to use
ApRep
in
org.apache.kerby.kerberos.kerb.type.ap

Best Java code snippets using org.apache.kerby.kerberos.kerb.type.ap.ApRep (Showing top 11 results out of 315)

origin: org.apache.kerby/kerb-core

/**
 * @return The encrypted part 
 */
public EncryptedData getEncryptedEncPart() {
  return getFieldAs(ApRepField.ENC_PART, EncryptedData.class);
}
origin: com.redhat.red.build/kojiji

public static ApRep readRep( byte[] buf, EncryptionKey key, long allowableClockSkew, ApReq apReq, InetAddress initiator )
    throws KrbException
{
  ApRep apRep = KrbCodec.decode( buf, ApRep.class );
  if ( apRep.getPvno() != KrbConstant.KRB_V5 )
  {
    throw new KrbException( KrbErrorCode.KRB_AP_ERR_BADVERSION );
  }
  if ( !apRep.getMsgType().equals( KrbMessageType.AP_REP ) )
  {
    throw new KrbException( KrbErrorCode.KRB_AP_ERR_MSG_TYPE );
  }
  try {
    ApRequest.validate( key, apReq, initiator, allowableClockSkew * 1000 );
  } catch (KrbException e) {
    // XXX: The checksum verification fails, but we can continue, so just log the error
    logger.debug("Ap Request validation error: code={}, message={}", e.getKrbErrorCode(), e.getMessage(), e );
  }
  EncAPRepPart encRepPart = EncryptionUtil.unseal( apRep.getEncryptedEncPart(), key, KeyUsage.AP_REP_ENCPART, EncAPRepPart.class );
  apRep.setEncRepPart( encRepPart );
  ApRequest.unsealAuthenticator( key, apReq );
  EncAPRepPart encAPRepPart = apRep.getEncRepPart();
  Authenticator authenticator = apReq.getAuthenticator();
  if ( !encAPRepPart.getCtime().equals( authenticator.getCtime() ) || encAPRepPart.getCusec() != authenticator.getCusec() )
  {
    throw new KrbException( KrbErrorCode.KRB_AP_ERR_MODIFIED );
  }
  return apRep;
}
origin: org.apache.kerby/kerb-common

private ApRep makeApRep() throws KrbException {
  ApRep apRep = new ApRep();
  EncAPRepPart encAPRepPart = new EncAPRepPart();
  Authenticator auth = apReq.getAuthenticator();
  // This field contains the current time on the client's host.
  encAPRepPart.setCtime(auth.getCtime());
  // This field contains the microsecond part of the client's timestamp.
  encAPRepPart.setCusec(auth.getCusec());
  encAPRepPart.setSubkey(auth.getSubKey());
  encAPRepPart.setSeqNumber(0);
  apRep.setEncRepPart(encAPRepPart);
  EncryptedData encPart = EncryptionUtil.seal(encAPRepPart, auth.getSubKey(), KeyUsage.AP_REP_ENCPART);
  apRep.setEncryptedEncPart(encPart);
  return apRep;
}
origin: apache/directory-kerby

  apRep = new ApRep();
  apRep.decode(token);
} catch (IOException e) {
  throw new GSSException(GSSException.FAILURE, -1, "Invalid ApRep " + e.getMessage());
EncryptionKey key = apRep.getEncRepPart().getSubkey();
if (key != null) {
  setSessionKey(key, ACCEPTOR_SUBKEY);
int seqNum = apRep.getEncRepPart().getSeqNumber();
setPeerSequenceNumber(seqNum == -1 ? 0 : seqNum);
origin: apache/directory-kerby

  /**
   * Validation for KRB_AP_REP message
   * @param encKey key used to encrypt encrypted part of KRB_AP_REP message
   * @param apRep KRB_AP_REP message received
   * @param apReqSent the KRB_AP_REQ message that caused the KRB_AP_REP message from server
   * @throws KrbException
   */
  public static void validate(EncryptionKey encKey, ApRep apRep, ApReq apReqSent) throws KrbException {
    EncAPRepPart encPart = EncryptionUtil.unseal(apRep.getEncryptedEncPart(),
        encKey, KeyUsage.AP_REP_ENCPART, EncAPRepPart.class);
    apRep.setEncRepPart(encPart);
    if (apReqSent != null) {
      Authenticator auth = apReqSent.getAuthenticator();
      if (!encPart.getCtime().equals(auth.getCtime())
          || encPart.getCusec() != auth.getCusec()) {
        throw new KrbException(KrbErrorCode.KRB_AP_ERR_MUT_FAIL);
      }
    }
  }
}
origin: apache/directory-kerby

ApResponse apResponse = new ApResponse(apReq, encryptedKey);
ApRep apRep = apResponse.getApRep();
assertThat(apRep.getPvno()).isEqualTo(5);
assertThat(apRep.getMsgType()).isEqualTo(KrbMessageType.AP_REP);
origin: apache/directory-kerby

ByteBuffer outBuffer = ByteBuffer.allocate(apRep.encodingLength() + 2);
outBuffer.put(MSG_AP_REP);
apRep.encode(outBuffer);
outBuffer.flip();
ret = outBuffer.array();
origin: com.redhat.red.build/kojiji

if ( sessionInfoPriv.getEncPart().getSeqNumber() != apRep.getEncRepPart().getSeqNumber() )
origin: apache/directory-kerby

private ApRep makeApRep() throws KrbException {
  ApRep apRep = new ApRep();
  EncAPRepPart encAPRepPart = new EncAPRepPart();
  Authenticator auth = apReq.getAuthenticator();
  // This field contains the current time on the client's host.
  encAPRepPart.setCtime(auth.getCtime());
  // This field contains the microsecond part of the client's timestamp.
  encAPRepPart.setCusec(auth.getCusec());
  encAPRepPart.setSubkey(auth.getSubKey());
  encAPRepPart.setSeqNumber(0);
  apRep.setEncRepPart(encAPRepPart);
  EncryptedData encPart = EncryptionUtil.seal(encAPRepPart, auth.getSubKey(), KeyUsage.AP_REP_ENCPART);
  apRep.setEncryptedEncPart(encPart);
  return apRep;
}
origin: org.apache.kerby/kerb-common

  /**
   * Validation for KRB_AP_REP message
   * @param encKey key used to encrypt encrypted part of KRB_AP_REP message
   * @param apRep KRB_AP_REP message received
   * @param apReqSent the KRB_AP_REQ message that caused the KRB_AP_REP message from server
   * @throws KrbException
   */
  public static void validate(EncryptionKey encKey, ApRep apRep, ApReq apReqSent) throws KrbException {
    EncAPRepPart encPart = EncryptionUtil.unseal(apRep.getEncryptedEncPart(),
        encKey, KeyUsage.AP_REP_ENCPART, EncAPRepPart.class);
    apRep.setEncRepPart(encPart);
    if (apReqSent != null) {
      Authenticator auth = apReqSent.getAuthenticator();
      if (!encPart.getCtime().equals(auth.getCtime())
          || encPart.getCusec() != auth.getCusec()) {
        throw new KrbException(KrbErrorCode.KRB_AP_ERR_MUT_FAIL);
      }
    }
  }
}
origin: apache/directory-kerby

/**
 * @return The encrypted part 
 */
public EncryptedData getEncryptedEncPart() {
  return getFieldAs(ApRepField.ENC_PART, EncryptedData.class);
}
org.apache.kerby.kerberos.kerb.type.apApRep

Javadoc

The AP-REP message, as defined in RFC 4120 :
 
AP-REP          ::= [APPLICATION 15] SEQUENCE { 
pvno            [0] INTEGER (5), 
msg-type        [1] INTEGER (15), 
enc-part        [2] EncryptedData -- EncAPRepPart 
} 

Most used methods

  • <init>
    Creates an instance of ApRep
  • getEncRepPart
  • getEncryptedEncPart
  • getMsgType
  • getPvno
  • setEncRepPart
    Set the decrypted EncRepPart into the message
  • decode
  • encode
  • encodingLength
  • getFieldAs
  • setEncryptedEncPart
    Set the encrypted part into the message
  • setFieldAs
  • setEncryptedEncPart,
  • setFieldAs

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Reference (javax.naming)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now