本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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");
}
}
示例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;
}
示例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$
}
}
示例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;
}
示例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$
}
}