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


Java Identity.getPublicKey方法代码示例

本文整理汇总了Java中java.security.Identity.getPublicKey方法的典型用法代码示例。如果您正苦于以下问题:Java Identity.getPublicKey方法的具体用法?Java Identity.getPublicKey怎么用?Java Identity.getPublicKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.security.Identity的用法示例。


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

示例1: addIdentity

import java.security.Identity; //导入方法依赖的package包/类
/**
 * @see java.security.IdentityScope#addIdentity(java.security.Identity)
 */
public synchronized void addIdentity(Identity identity) throws KeyManagementException {
    if (identity == null) {
        throw new NullPointerException("identity == null");
    }

    String name = identity.getName();
    if (names.containsKey(name)) {
        throw new KeyManagementException("name '" + name + "' is already used");
    }

    PublicKey key = identity.getPublicKey();
    if (key != null && keys.containsKey(key)) {
        throw new KeyManagementException("key '" + key + "' is already used");
    }

    names.put(name, identity);
    if (key != null) {
        keys.put(key, identity);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:24,代码来源:SystemScope.java

示例2: addIdentity

import java.security.Identity; //导入方法依赖的package包/类
/**
 * @see java.security.IdentityScope#addIdentity(java.security.Identity)
 */
public synchronized void addIdentity(Identity identity)
        throws KeyManagementException {
    if (identity == null) {
        throw new NullPointerException(Messages.getString("security.92")); //$NON-NLS-1$
    }

    String name = identity.getName();
    if (names.containsKey(name)) {
        throw new KeyManagementException(Messages.getString("security.93", name)); //$NON-NLS-1$
    }

    PublicKey key = identity.getPublicKey();
    if (key != null && keys.containsKey(key)) {
        throw new KeyManagementException(Messages.getString("security.94", key)); //$NON-NLS-1$
    }

    names.put(name, identity);
    if (key != null) {
        keys.put(key, identity);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:SystemScope.java

示例3: addIdentity

import java.security.Identity; //导入方法依赖的package包/类
/**
 * @see IdentityScope#addIdentity(Identity)
 */
public synchronized void addIdentity(Identity identity)
        throws KeyManagementException {
    if (identity == null) {
        throw new NullPointerException(Messages.getString("security.92")); //$NON-NLS-1$
    }

    String name = identity.getName();
    if (names.containsKey(name)) {
        throw new KeyManagementException(Messages.getString("security.93", name)); //$NON-NLS-1$
    }

    PublicKey key = identity.getPublicKey();
    if (key != null && keys.containsKey(key)) {
        throw new KeyManagementException(Messages.getString("security.94", key)); //$NON-NLS-1$
    }

    names.put(name, identity);
    if (key != null) {
        keys.put(key, identity);
    }
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:25,代码来源:SystemScope.java

示例4: removeIdentity

import java.security.Identity; //导入方法依赖的package包/类
/**
 * @see java.security.IdentityScope#removeIdentity(java.security.Identity)
 */
public synchronized void removeIdentity(Identity identity)
        throws KeyManagementException {

    //Exception caught = null;
    if (identity == null) {
        throw new NullPointerException("identity == null");
    }

    String name = identity.getName();
    if (name == null) {
        throw new NullPointerException("name == null");
    }

    boolean contains = names.containsKey(name);
    names.remove(name);

    PublicKey key = identity.getPublicKey();

    if (key != null) {
        contains = contains || keys.containsKey(key);
        keys.remove(key);
    }

    if (!contains) {
        throw new KeyManagementException("identity not found");
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:31,代码来源:SystemScope.java

示例5: getIdentity

import java.security.Identity; //导入方法依赖的package包/类
public Identity getIdentity(PublicKey pk) {
    Enumeration<Identity> en = identities();
    while (en.hasMoreElements()) {
        Identity current = (Identity) en.nextElement();
        if (current.getPublicKey() == pk)
            return current;
    }
    return null;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:10,代码来源:IdentityScope2Test.java

示例6: removeIdentity

import java.security.Identity; //导入方法依赖的package包/类
/**
 * @see java.security.IdentityScope#removeIdentity(java.security.Identity)
 */
public synchronized void removeIdentity(Identity identity)
        throws KeyManagementException {

    //Exception caught = null;
    if (identity == null) {
        throw new NullPointerException(Messages.getString("security.92")); //$NON-NLS-1$
    }

    String name = identity.getName();
    if (name == null) {
        throw new NullPointerException(Messages.getString("security.95")); //$NON-NLS-1$
    }

    boolean contains = names.containsKey(name);
    names.remove(name);

    PublicKey key = identity.getPublicKey();
    
    if (key != null) {
        contains = contains || keys.containsKey(key);
        keys.remove(key);
    }
    
    if (!contains) {
        throw new KeyManagementException(Messages.getString("security.96")); //$NON-NLS-1$
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:31,代码来源:SystemScope.java

示例7: getIdentity

import java.security.Identity; //导入方法依赖的package包/类
public Identity getIdentity(PublicKey pk) {
	Enumeration en = identities();
	while (en.hasMoreElements()) {
		Identity current = (Identity) en.nextElement();
		if (current.getPublicKey() == pk)
			return current;
	}
	return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:IdentityScope2Test.java

示例8: removeIdentity

import java.security.Identity; //导入方法依赖的package包/类
/**
 * @see IdentityScope#removeIdentity(Identity)
 */
public synchronized void removeIdentity(Identity identity)
        throws KeyManagementException {

    //Exception caught = null;
    if (identity == null) {
        throw new NullPointerException(Messages.getString("security.92")); //$NON-NLS-1$
    }

    String name = identity.getName();
    if (name == null) {
        throw new NullPointerException(Messages.getString("security.95")); //$NON-NLS-1$
    }

    boolean contains = names.containsKey(name);
    names.remove(name);

    PublicKey key = identity.getPublicKey();
    
    if (key != null) {
        contains = contains || keys.containsKey(key);
        keys.remove(key);
    }
    
    if (!contains) {
        throw new KeyManagementException(Messages.getString("security.96")); //$NON-NLS-1$
    }
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:31,代码来源:SystemScope.java


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