当前位置: 首页>>代码示例>>Java>>正文


Java DestroyFailedException类代码示例

本文整理汇总了Java中javax.security.auth.DestroyFailedException的典型用法代码示例。如果您正苦于以下问题:Java DestroyFailedException类的具体用法?Java DestroyFailedException怎么用?Java DestroyFailedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DestroyFailedException类属于javax.security.auth包,在下文中一共展示了DestroyFailedException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: destroy

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
/**
 * Destroys the ticket and destroys any sensitive information stored in
 * it.
 */
public void destroy() throws DestroyFailedException {
    if (!destroyed) {
        Arrays.fill(asn1Encoding, (byte) 0);
        client = null;
        server = null;
        sessionKey.destroy();
        flags = null;
        authTime = null;
        startTime = null;
        endTime = null;
        renewTill = null;
        clientAddresses = null;
        destroyed = true;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:KerberosTicket.java

示例2: testNoKeyDestruction

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
private static void testNoKeyDestruction(Destroyable key)
    throws Exception {
    String klass = key.getClass().getName();

    if (key.isDestroyed()) {
        throw new Exception("error: a " + klass +
            " key has been unexpectedly destroyed");
    }
    try {
        key.destroy();
    } catch (DestroyFailedException dfe) {
        // not an error

        if (key.isDestroyed()) {
            throw new Exception("error: a " + klass +
                " key has been unexpectedly destroyed");
        }
        System.out.println(klass + " keys are not destroyable");
        return;
    }
    throw new Exception("error: key may been unexpectedly destroyed");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:KeyDestructionTest.java

示例3: resetMechanism

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
protected void resetMechanism() throws SaslException
{
  try
    {
      password.destroy();
    }
  catch (DestroyFailedException dfe)
    {
      SaslException se = new SaslException("resetMechanism()");
      se.initCause(dfe);
      throw se;
    }
  password = null;
  M1 = null;
  K = null;
  cIV = null;
  sIV = null;
  inMac = outMac = null;
  inCipher = outCipher = null;
  sid = null;
  ttl = 0;
  cn = null;
  sn = null;
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:SRPClient.java

示例4: populateSubjectWithTGT

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
private void populateSubjectWithTGT(Subject subject, Map<String, String> credentials) {
    KerberosTicket tgt = getTGT(credentials);
    if (tgt != null) {
        Set<Object> creds = subject.getPrivateCredentials();
        synchronized (creds) {
            Iterator<Object> iterator = creds.iterator();
            while (iterator.hasNext()) {
                Object o = iterator.next();
                if (o instanceof KerberosTicket) {
                    KerberosTicket t = (KerberosTicket) o;
                    iterator.remove();
                    try {
                        t.destroy();
                    } catch (DestroyFailedException e) {
                        LOG.warn("Failed to destory ticket ", e);
                    }
                }
            }
            creds.add(tgt);
        }
        subject.getPrincipals().add(tgt.getClient());
        kerbTicket.set(tgt);
    } else {
        LOG.info("No TGT found in credentials");
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:27,代码来源:AutoTGT.java

示例5: destroy

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
public void destroy() throws DestroyFailedException
{
	if (this.children != null)
	{
		for (Destroyable destroyable : this.children)
		{
			if (destroyable.isDestroyed()) continue;
			
			if (destroyable instanceof DestroyableChild)
				((DestroyableChild)destroyable).unlink();
			
			destroyable.destroy();
		}
		
		this.children = null;
	}
	super.destroy();
}
 
开发者ID:CardContact,项目名称:opensc-java,代码行数:19,代码来源:DestroyableHolder.java

示例6: close

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
/**
 * Closes the session of a successful call to {@link #open(LoadStoreParameter)}
 * and log any error, that might occur.
 */
public void close()
{
    if (this.slot != null)
    {
        try
        {
            this.slot.destroy();
        } catch (DestroyFailedException e)
        {
            log.warn("Cannot destroy slot:",e);
        }
    }        
    
    this.slot = null;
    this.session = null;
    this.protectionParameter = null;
    this.cb = null;
    this.eventHandler = null;
}
 
开发者ID:CardContact,项目名称:opensc-java,代码行数:24,代码来源:PKCS11SessionStore.java

示例7: fixKerberosTicketOrder

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
private void fixKerberosTicketOrder() {
  Set<Object> creds = getSubject().getPrivateCredentials();
  synchronized (creds) {
    for (Iterator<Object> iter = creds.iterator(); iter.hasNext();) {
      Object cred = iter.next();
      if (cred instanceof KerberosTicket) {
        KerberosTicket ticket = (KerberosTicket) cred;
        if (!ticket.getServer().getName().startsWith("krbtgt")) {
          LOG.warn("The first kerberos ticket is not TGT"
              + "(the server principal is {}), remove and destroy it.",
              ticket.getServer());
          iter.remove();
          try {
            ticket.destroy();
          } catch (DestroyFailedException e) {
            LOG.warn("destroy ticket failed", e);
          }
        } else {
          return;
        }
      }
    }
  }
  LOG.warn("Warning, no kerberos ticket found while attempting to renew" +
      " ticket");
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:UserGroupInformation.java

示例8: testGetPassword

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
/**
 * Test for <code>KeyStore.PasswordProtection(char[] password)</code> constructor
 * and the following methods 
 * <code>getPassword()<code>
 * <code>destroy()<code>
 * <code>isDestroyed()<code>
 * Assertions: constructor created new PasswordProtection object
 * getPassword() returns password or throws IllegalArgumentException
 * if PasswordProtection is destroyed
 */
public void testGetPassword() throws DestroyFailedException {
    char [] pass = {'a', 'b', 'c'};
    KeyStore.PasswordProtection ksPWP = new KeyStore.PasswordProtection(pass);
    char [] rPass = ksPWP.getPassword();
    assertFalse("PasswordProtection Should not be destroyed", ksPWP.isDestroyed());        
    assertEquals("Incorrect password length", pass.length, rPass.length);
    for (int i = 0; i < pass.length; i++) {
        assertEquals("Incorrect password (item: ".concat(Integer.toString(i))
                .concat(")"), pass[i], rPass[i]);
    }
    ksPWP.destroy();
    assertTrue("PasswordProtection must be destroyed", ksPWP.isDestroyed());
    try {
        ksPWP.getPassword();
        fail("IllegalStateException must be thrown because PasswordProtection is destroyed");
    } catch (IllegalStateException e) {
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:29,代码来源:KSPasswordProtectionTest.java

示例9: logout

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
public boolean logout() throws LoginException {

        subject.getPrincipals().remove(client);
        subject.getPrivateCredentials().remove(krbTicket);
        
        try {
            krbTicket.destroy();
        } catch (DestroyFailedException e) {
            throw new LoginException();
        }

        client = null;
        krbTicket = null;

        return true;
    }
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:Krb5LoginModule.java

示例10: destroy

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
public void destroy() throws DestroyFailedException {
    if (destroyed) {
        return;
    }
    Arrays.fill(this.asn1Encoding, (byte) 0);
    this.client = null;
    this.server = null;
    this.sessionKey.destroy();
    this.flags = null;
    this.authTime = null;
    this.startTime = null;
    this.endTime = null;
    this.renewTill = null;
    this.clientAddresses = null;
    destroyed = true;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:KerberosTicket.java

示例11: test_equals

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
/**
 * @tests javax.security.auth.kerberos.KerberosKey#equals(java.lang.Object)
 */
public void test_equals() {
    KerberosKey kerberosKey1 = new KerberosKey(principal, keyBytes, 1, 123);
    KerberosKey kerberosKey2 = new KerberosKey(principal, keyBytes, 1, 123);
    KerberosKey kerberosKey3 = new KerberosKey(principal, new byte[] { 1,
            3, 4, 5 }, 1, 123);
    assertEquals("kerberosKey1 and kerberosKey2 should be equivalent ",
            kerberosKey1, kerberosKey2);
    assertFalse("kerberosKey1 and kerberosKey3 sholudn't be equivalent ",
            kerberosKey1.equals(kerberosKey3));
    try {
        kerberosKey2.destroy();
    } catch (DestroyFailedException e) {
        fail("kerberosKey2 destroy failed");
    }
    assertFalse("Destroyed kerberosKey sholudn't be equivalent ",
            kerberosKey1.equals(kerberosKey2));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:KerberosKeyTest.java

示例12: destroy

import javax.security.auth.DestroyFailedException; //导入依赖的package包/类
/**
 * Attempts to destroy an object's data
 *
 * @param object Object to destroy
 */
public static void destroy(Object object) {
    if (object instanceof byte[]) {
        zero((byte[]) object);
    } else if (object instanceof char[]) {
        zero((char[]) object);
    } else if (object instanceof Destroyable) {
        ((Destroyable) object).destroy();
    } else if (object instanceof javax.security.auth.Destroyable && !((javax.security.auth.Destroyable) object).isDestroyed()) {
        try {
            ((javax.security.auth.Destroyable) object).destroy();
        } catch (DestroyFailedException e) {
            // JCE keys generally fail even then they pretend to be destroyable so don't log other those will spam
        }
    }
}
 
开发者ID:Kloudtek,项目名称:kryptotek-core,代码行数:21,代码来源:CryptoUtils.java


注:本文中的javax.security.auth.DestroyFailedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。