示例#1
0
 /*     */ public KrbApReq(
     Credentials paramCredentials,
     boolean paramBoolean1,
     boolean paramBoolean2,
     boolean paramBoolean3,
     Checksum paramChecksum)
     /*     */ throws Asn1Exception, KrbCryptoException, KrbException, IOException
       /*     */ {
   /* 104 */ APOptions localAPOptions = paramBoolean1 ? new APOptions(2) : new APOptions();
   /*     */
   /* 107 */ if (DEBUG) {
     /* 108 */ System.out.println(">>> KrbApReq: APOptions are " + localAPOptions);
     /*     */ }
   /* 110 */ EncryptionKey localEncryptionKey =
       paramBoolean2 ? new EncryptionKey(paramCredentials.getSessionKey()) : null;
   /*     */
   /* 114 */ LocalSeqNumber localLocalSeqNumber = new LocalSeqNumber();
   /*     */
   /* 116 */ init(
       localAPOptions,
       paramCredentials,
       paramChecksum,
       localEncryptionKey,
       localLocalSeqNumber,
       null,
       11);
   /*     */ }
  static Krb5InitCredential getInstance(Krb5NameElement name, Credentials delegatedCred)
      throws GSSException {

    EncryptionKey sessionKey = delegatedCred.getSessionKey();

    /*
     * all of the following data is optional in a KRB-CRED
     * messages. This check for each field.
     */

    PrincipalName cPrinc = delegatedCred.getClient();
    PrincipalName sPrinc = delegatedCred.getServer();

    KerberosPrincipal client = null;
    KerberosPrincipal server = null;

    Krb5NameElement credName = null;

    if (cPrinc != null) {
      String fullName = cPrinc.getName();
      credName = Krb5NameElement.getInstance(fullName, Krb5MechFactory.NT_GSS_KRB5_PRINCIPAL);
      client = new KerberosPrincipal(fullName);
    }

    // XXX Compare name to credName

    if (sPrinc != null) {
      server = new KerberosPrincipal(sPrinc.getName(), KerberosPrincipal.KRB_NT_SRV_INST);
    }

    return new Krb5InitCredential(
        credName,
        delegatedCred,
        delegatedCred.getEncoded(),
        client,
        server,
        sessionKey.getBytes(),
        sessionKey.getEType(),
        delegatedCred.getFlags(),
        delegatedCred.getAuthTime(),
        delegatedCred.getStartTime(),
        delegatedCred.getEndTime(),
        delegatedCred.getRenewTill(),
        delegatedCred.getClientAddresses());
  }