mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8225181: KeyStore should have a getAttributes method
Reviewed-by: mullan
This commit is contained in:
parent
38f525e96e
commit
a729a70c01
6 changed files with 169 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -236,6 +236,28 @@ abstract class DomainKeyStore extends KeyStoreSpi {
|
|||
return date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<KeyStore.Entry.Attribute> engineGetAttributes(String alias) {
|
||||
|
||||
AbstractMap.SimpleEntry<String, Collection<KeyStore>> pair =
|
||||
getKeystoresForReading(alias);
|
||||
Set<KeyStore.Entry.Attribute> result = Collections.emptySet();
|
||||
|
||||
try {
|
||||
String entryAlias = pair.getKey();
|
||||
for (KeyStore keystore : pair.getValue()) {
|
||||
result = keystore.getAttributes(entryAlias);
|
||||
if (result != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (KeyStoreException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns the given private key to the given alias, protecting
|
||||
* it with the given password as defined in PKCS8.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue