Package javax.security.auth.x500

Examples of javax.security.auth.x500.X500PrivateCredential


        if (subject != null) {
           Set set = subject.getPrivateCredentials(X500PrivateCredential.class);
           if (set != null) {
              Iterator it = set.iterator();
              while (it.hasNext()) {
                 X500PrivateCredential cred = (X500PrivateCredential)it.next();
                 X509Certificate cert = cred.getCertificate();
                 if (matchesThumbPrint(keyIdMatch, cert))
                    return cert;
              }
           }
        }
View Full Code Here


                if (subject != null) {
                    Set set = subject.getPrivateCredentials(X500PrivateCredential.class);
                    if (set != null) {
                        Iterator it = set.iterator();
                        while (it.hasNext()) {
                            X500PrivateCredential cred = (X500PrivateCredential)it.next();
                            if (cred.getAlias().equals(actualAlias))
                                return cred.getCertificate();
                        }
                    }
                }
               
                PrivateKeyCallback.Request request = new PrivateKeyCallback.AliasRequest(actualAlias);
View Full Code Here

        if (subject != null) {
            Set set = subject.getPrivateCredentials(X500PrivateCredential.class);
          if (set != null) {
               Iterator it = set.iterator();
            while (it.hasNext()) {
                  X500PrivateCredential cred = (X500PrivateCredential)it.next();
                  X509Certificate cert = cred.getCertificate();
                   if (cert.getPublicKey().equals(publicKey))
                    return cert;
              }
           }
      }
View Full Code Here

           if (subject != null) {
              Set set = subject.getPrivateCredentials(X500PrivateCredential.class);
              if (set != null) {
                 Iterator it = set.iterator();
                 while (it.hasNext()) {
                    X500PrivateCredential cred = (X500PrivateCredential)it.next();
                    if (matchesThumbPrint(Base64.decode(keyIdentifier),
                                             cred.getCertificate()))
                       return cred.getPrivateKey();
                 }
              }
           }

           PrivateKeyCallback.Request request =
View Full Code Here

            Key privateKey = keyStore.getKey(keyStoreAlias, privateKeyPassword);
            if (null == privateKey || !(privateKey instanceof PrivateKey)) {
                //auth.67=Cannot find private key for {0}
                throw new FailedLoginException(Messages.getString("auth.67", keyStoreAlias)); //$NON-NLS-1$
               }
            privateCredential = new X500PrivateCredential(firstCertificate,
                    (PrivateKey) privateKey, keyStoreAlias);

        } catch (Exception e) {
            if (e instanceof LoginException) {
                throw (LoginException) e;
View Full Code Here

            Key privateKey = keyStore.getKey(keyStoreAlias, privateKeyPassword);
            if (null == privateKey || !(privateKey instanceof PrivateKey)) {
                throw new FailedLoginException("Cannot find private key for "
                        + keyStoreAlias);
            }
            privateCredential = new X500PrivateCredential(firstCertificate,
                    (PrivateKey) privateKey, keyStoreAlias);

        } catch (Exception e) {
            if (e instanceof LoginException) {
                throw (LoginException) e;
View Full Code Here

  synchronized (credentialCache) {
      if (sslSessionContext.getSession(session.getId()) != null) {
    Object val = credentialCache.get(
        getKeyAlgorithm(session.getCipherSuite()));
    if (val instanceof X500PrivateCredential) {
        X500PrivateCredential cred = (X500PrivateCredential) val;
        if (!cred.isDestroyed()) {
      return cred.getCertificate();
        }
    }
      }
      return null;
  }
View Full Code Here

    throw new SecurityException(
        "No credential cached for key type");
      } else if (val instanceof String) {
    throw new SecurityException((String) val);
      }
      X500PrivateCredential cred = (X500PrivateCredential) val;
      if (cred.isDestroyed()) {
    throw new SecurityException(
        "Private credentials are destroyed");
      } else if (subjectIsReadOnly
           && session.equals(sessionCache.get())
           && System.currentTimeMillis() < credentialsValidUntil)
View Full Code Here

  }
  if (System.currentTimeMillis() > validUntil) {
      throw new SecurityException("Certificates no longer valid");
  }
  String peer = getPeerPrincipalName(clientSubject);
  X500PrivateCredential pc =
      getPrivateCredential(cert, peer, permissionAction);
  if (pc == null) {
      throw new SecurityException("Missing private credentials");
  } else if (!equalPrivateCredentials(cred, pc)) {
      throw new SecurityException("Wrong private credential");
View Full Code Here

    getAuthPermission(cert, peer, permissionAction));
  }

  if (subjectIsReadOnly) {
      for (int i = readOnlyPrivateCredentials.length; --i >= 0; ) {
    X500PrivateCredential xpc = readOnlyPrivateCredentials[i];
    if (cert.equals(xpc.getCertificate())) {
        return xpc;
    }
      }
      return null;
  }
View Full Code Here

TOP

Related Classes of javax.security.auth.x500.X500PrivateCredential

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.