Package sun.security.krb5

Examples of sun.security.krb5.Credentials


  private EncryptionKey decryptTicket(Ticket ticket, Subject svrSub)
      throws Exception {

    // Get the private key that matches the encryption type of the ticket.
    EncryptionKey key = getPrivateKey(svrSub, ticket.encPart.getEType());
    // Decrypt the service ticket and get the cleartext bytes.
    byte[] ticketBytes = ticket.encPart.decrypt(key, KeyUsage.KU_TICKET);
    if (ticketBytes.length <= 0) {
      throw new Exception("Key is empty.");
    }
View Full Code Here


  // Get the private server key.
  private EncryptionKey getPrivateKey(Subject sub, int keyType)
      throws Exception {
    KerberosKey key = getKrbKey(sub, keyType);
    return new EncryptionKey(key.getEncoded(), key.getKeyType(),
        new Integer(keyType));
  }
View Full Code Here

                   char[] password,
                   String algorithm) {

        try {
            PrincipalName princ = new PrincipalName(principal.getName());
            EncryptionKey key =
                new EncryptionKey(password, princ.getSalt(), algorithm);
            this.keyBytes = key.getBytes();
            this.keyType = key.getEType();
        } catch (KrbException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }
View Full Code Here

        if (destroyed) {
           throw new IOException("This key is no longer valid");
        }

        try {
           ois.writeObject((new EncryptionKey(keyType, keyBytes)).asn1Encode());
        } catch (Asn1Exception ae) {
           throw new IOException(ae.getMessage());
        }
    }
View Full Code Here

    }

    private void readObject(ObjectInputStream ois)
                throws IOException, ClassNotFoundException {
        try {
            EncryptionKey encKey = new EncryptionKey(new
                                     DerValue((byte[])ois.readObject()));
            keyType = encKey.getEType();
            keyBytes = encKey.getBytes();
        } catch (Asn1Exception ae) {
            throw new IOException(ae.getMessage());
        }
    }
View Full Code Here

       char[] password,
       String algorithm) {

  try {
      PrincipalName princ = new PrincipalName(principal.getName());
      EncryptionKey key =
    new EncryptionKey(password, princ.getSalt(), algorithm);
      this.keyBytes = key.getBytes();
      this.keyType = key.getEType();
  } catch (KrbException e) {
      throw new IllegalArgumentException(e.getMessage());
  }
    }
View Full Code Here

  if (destroyed) {
     throw new IOException("This key is no longer valid");
  }

  try {
     ois.writeObject((new EncryptionKey(keyType, keyBytes)).asn1Encode());
  } catch (Asn1Exception ae) {
     throw new IOException(ae.getMessage());
  }
    }
View Full Code Here

    }

    private void readObject(ObjectInputStream ois)
    throws IOException, ClassNotFoundException {
  try {
      EncryptionKey encKey = new EncryptionKey(new
             DerValue((byte[])ois.readObject()));
      keyType = encKey.getEType();
      keyBytes = encKey.getBytes();
  } catch (Asn1Exception ae) {
      throw new IOException(ae.getMessage());
  }
    }
View Full Code Here

                   char[] password,
                   String algorithm) {

        try {
            PrincipalName princ = new PrincipalName(principal.getName());
            EncryptionKey key =
                new EncryptionKey(password, princ.getSalt(), algorithm);
            this.keyBytes = key.getBytes();
            this.keyType = key.getEType();
        } catch (KrbException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }
View Full Code Here

        if (destroyed) {
           throw new IOException("This key is no longer valid");
        }

        try {
           ois.writeObject((new EncryptionKey(keyType, keyBytes)).asn1Encode());
        } catch (Asn1Exception ae) {
           throw new IOException(ae.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of sun.security.krb5.Credentials

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.