You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Ruth Cao (JIRA)" <ji...@apache.org> on 2006/12/31 10:21:21 UTC
[jira] Created: (HARMONY-2931) [classlib][security]
KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception
improperly
[classlib][security] KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception improperly
-----------------------------------------------------------------------------------------------------
Key: HARMONY-2931
URL: http://issues.apache.org/jira/browse/HARMONY-2931
Project: Harmony
Issue Type: Bug
Components: Classlib
Reporter: Ruth Cao
Attachments: Harmony-2931.diff
I mocked a simple KeyStoreSpi and KeyStore.LoadStoreParameter as following:
class MyKeyStoreSpi extends KeyStoreSpi {
public Key engineGetKey(String alias, char[] password)
throws NoSuchAlgorithmException, UnrecoverableKeyException {
return null;
}
public Certificate[] engineGetCertificateChain(String alias) {
return null;
}
public Certificate engineGetCertificate(String alias) {
return null;
}
public Date engineGetCreationDate(String alias) {
return new Date(0);
}
public void engineSetKeyEntry(String alias, Key key, char[] password,
Certificate[] chain) throws KeyStoreException {
throw new KeyStoreException(
"engineSetKeyEntry is not supported in myKeyStoreSpi");
}
public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
throws KeyStoreException {
throw new KeyStoreException(
"engineSetKeyEntry is not supported in myKeyStoreSpi");
}
public void engineSetCertificateEntry(String alias, Certificate cert)
throws KeyStoreException {
throw new KeyStoreException(
"engineSetCertificateEntry is not supported in myKeyStoreSpi");
}
public void engineDeleteEntry(String alias) throws KeyStoreException {
throw new KeyStoreException(
"engineDeleteEntry is not supported in myKeyStoreSpi");
}
public Enumeration engineAliases() {
return null;
}
public boolean engineContainsAlias(String alias) {
return false;
}
public int engineSize() {
return 0;
}
public boolean engineIsKeyEntry(String alias) {
return false;
}
public boolean engineIsCertificateEntry(String alias) {
return false;
}
public String engineGetCertificateAlias(Certificate cert) {
return "";
}
public void engineStore(OutputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException {
if (!(stream instanceof ByteArrayOutputStream)) {
throw new IOException("Incorrect stream");
}
if (((ByteArrayOutputStream) stream).size() == 0) {
throw new IOException("Incorrect stream size ");
}
}
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException {
throw new IOException();
}
}
class MyLoadStoreParams implements KeyStore.LoadStoreParameter {
KeyStore.ProtectionParameter protPar;
public MyLoadStoreParams() {
}
public MyLoadStoreParams(KeyStore.ProtectionParameter p) {
if (p == null) {
throw new NullPointerException("null parameter");
}
this.protPar = p;
}
public KeyStore.ProtectionParameter getProtectionParameter() {
return protPar;
}
}
Run the test below:
public class KeyStoreSpiTest {
public static void main(String[] args) throws Exception {
KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(new KeyStore.PasswordProtection(new char[0]));
KeyStoreSpi spi = new MyKeyStoreSpi();
spi.engineLoad(lParam);
}
}
Harmony throws IllegalArgumentException which does not follow spec. IMO, it should simply throws IOException to indicate there is an I/O problem.
Finally , thanks for reading so far :-)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Assigned: (HARMONY-2931) [classlib][security]
KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception
improperly
Posted by "Stepan Mishura (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2931?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stepan Mishura reassigned HARMONY-2931:
---------------------------------------
Assignee: Stepan Mishura
> [classlib][security] KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception improperly
> -----------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2931
> URL: https://issues.apache.org/jira/browse/HARMONY-2931
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Ruth Cao
> Assigned To: Stepan Mishura
> Attachments: Harmony-2931.diff
>
>
> I mocked a simple KeyStoreSpi and KeyStore.LoadStoreParameter as following:
> class MyKeyStoreSpi extends KeyStoreSpi {
> public Key engineGetKey(String alias, char[] password)
> throws NoSuchAlgorithmException, UnrecoverableKeyException {
> return null;
> }
> public Certificate[] engineGetCertificateChain(String alias) {
> return null;
> }
> public Certificate engineGetCertificate(String alias) {
> return null;
> }
> public Date engineGetCreationDate(String alias) {
> return new Date(0);
> }
> public void engineSetKeyEntry(String alias, Key key, char[] password,
> Certificate[] chain) throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetCertificateEntry(String alias, Certificate cert)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetCertificateEntry is not supported in myKeyStoreSpi");
> }
> public void engineDeleteEntry(String alias) throws KeyStoreException {
> throw new KeyStoreException(
> "engineDeleteEntry is not supported in myKeyStoreSpi");
> }
> public Enumeration engineAliases() {
> return null;
> }
> public boolean engineContainsAlias(String alias) {
> return false;
> }
> public int engineSize() {
> return 0;
> }
> public boolean engineIsKeyEntry(String alias) {
> return false;
> }
> public boolean engineIsCertificateEntry(String alias) {
> return false;
> }
> public String engineGetCertificateAlias(Certificate cert) {
> return "";
> }
> public void engineStore(OutputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> if (!(stream instanceof ByteArrayOutputStream)) {
> throw new IOException("Incorrect stream");
> }
> if (((ByteArrayOutputStream) stream).size() == 0) {
> throw new IOException("Incorrect stream size ");
> }
> }
> public void engineLoad(InputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> throw new IOException();
> }
> }
> class MyLoadStoreParams implements KeyStore.LoadStoreParameter {
> KeyStore.ProtectionParameter protPar;
> public MyLoadStoreParams() {
> }
> public MyLoadStoreParams(KeyStore.ProtectionParameter p) {
> if (p == null) {
> throw new NullPointerException("null parameter");
> }
> this.protPar = p;
> }
> public KeyStore.ProtectionParameter getProtectionParameter() {
> return protPar;
> }
> }
> Run the test below:
> public class KeyStoreSpiTest {
> public static void main(String[] args) throws Exception {
> KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(new KeyStore.PasswordProtection(new char[0]));
> KeyStoreSpi spi = new MyKeyStoreSpi();
> spi.engineLoad(lParam);
> }
> }
> Harmony throws IllegalArgumentException which does not follow spec. IMO, it should simply throws IOException to indicate there is an I/O problem.
> Finally , thanks for reading so far :-)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (HARMONY-2931) [classlib][security]
KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception
improperly
Posted by "Ruth Cao (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-2931?page=all ]
Ruth Cao updated HARMONY-2931:
------------------------------
Attachment: Harmony-2931.diff
Would somebody pls try it?
> [classlib][security] KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception improperly
> -----------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2931
> URL: http://issues.apache.org/jira/browse/HARMONY-2931
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Ruth Cao
> Attachments: Harmony-2931.diff
>
>
> I mocked a simple KeyStoreSpi and KeyStore.LoadStoreParameter as following:
> class MyKeyStoreSpi extends KeyStoreSpi {
> public Key engineGetKey(String alias, char[] password)
> throws NoSuchAlgorithmException, UnrecoverableKeyException {
> return null;
> }
> public Certificate[] engineGetCertificateChain(String alias) {
> return null;
> }
> public Certificate engineGetCertificate(String alias) {
> return null;
> }
> public Date engineGetCreationDate(String alias) {
> return new Date(0);
> }
> public void engineSetKeyEntry(String alias, Key key, char[] password,
> Certificate[] chain) throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetCertificateEntry(String alias, Certificate cert)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetCertificateEntry is not supported in myKeyStoreSpi");
> }
> public void engineDeleteEntry(String alias) throws KeyStoreException {
> throw new KeyStoreException(
> "engineDeleteEntry is not supported in myKeyStoreSpi");
> }
> public Enumeration engineAliases() {
> return null;
> }
> public boolean engineContainsAlias(String alias) {
> return false;
> }
> public int engineSize() {
> return 0;
> }
> public boolean engineIsKeyEntry(String alias) {
> return false;
> }
> public boolean engineIsCertificateEntry(String alias) {
> return false;
> }
> public String engineGetCertificateAlias(Certificate cert) {
> return "";
> }
> public void engineStore(OutputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> if (!(stream instanceof ByteArrayOutputStream)) {
> throw new IOException("Incorrect stream");
> }
> if (((ByteArrayOutputStream) stream).size() == 0) {
> throw new IOException("Incorrect stream size ");
> }
> }
> public void engineLoad(InputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> throw new IOException();
> }
> }
> class MyLoadStoreParams implements KeyStore.LoadStoreParameter {
> KeyStore.ProtectionParameter protPar;
> public MyLoadStoreParams() {
> }
> public MyLoadStoreParams(KeyStore.ProtectionParameter p) {
> if (p == null) {
> throw new NullPointerException("null parameter");
> }
> this.protPar = p;
> }
> public KeyStore.ProtectionParameter getProtectionParameter() {
> return protPar;
> }
> }
> Run the test below:
> public class KeyStoreSpiTest {
> public static void main(String[] args) throws Exception {
> KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(new KeyStore.PasswordProtection(new char[0]));
> KeyStoreSpi spi = new MyKeyStoreSpi();
> spi.engineLoad(lParam);
> }
> }
> Harmony throws IllegalArgumentException which does not follow spec. IMO, it should simply throws IOException to indicate there is an I/O problem.
> Finally , thanks for reading so far :-)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Closed: (HARMONY-2931) [classlib][security]
KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception
improperly
Posted by "Stepan Mishura (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2931?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stepan Mishura closed HARMONY-2931.
-----------------------------------
Verified by Ruth.
> [classlib][security] KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception improperly
> -----------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2931
> URL: https://issues.apache.org/jira/browse/HARMONY-2931
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Ruth Cao
> Assigned To: Stepan Mishura
> Attachments: Harmony-2931.diff
>
>
> I mocked a simple KeyStoreSpi and KeyStore.LoadStoreParameter as following:
> class MyKeyStoreSpi extends KeyStoreSpi {
> public Key engineGetKey(String alias, char[] password)
> throws NoSuchAlgorithmException, UnrecoverableKeyException {
> return null;
> }
> public Certificate[] engineGetCertificateChain(String alias) {
> return null;
> }
> public Certificate engineGetCertificate(String alias) {
> return null;
> }
> public Date engineGetCreationDate(String alias) {
> return new Date(0);
> }
> public void engineSetKeyEntry(String alias, Key key, char[] password,
> Certificate[] chain) throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetCertificateEntry(String alias, Certificate cert)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetCertificateEntry is not supported in myKeyStoreSpi");
> }
> public void engineDeleteEntry(String alias) throws KeyStoreException {
> throw new KeyStoreException(
> "engineDeleteEntry is not supported in myKeyStoreSpi");
> }
> public Enumeration engineAliases() {
> return null;
> }
> public boolean engineContainsAlias(String alias) {
> return false;
> }
> public int engineSize() {
> return 0;
> }
> public boolean engineIsKeyEntry(String alias) {
> return false;
> }
> public boolean engineIsCertificateEntry(String alias) {
> return false;
> }
> public String engineGetCertificateAlias(Certificate cert) {
> return "";
> }
> public void engineStore(OutputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> if (!(stream instanceof ByteArrayOutputStream)) {
> throw new IOException("Incorrect stream");
> }
> if (((ByteArrayOutputStream) stream).size() == 0) {
> throw new IOException("Incorrect stream size ");
> }
> }
> public void engineLoad(InputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> throw new IOException();
> }
> }
> class MyLoadStoreParams implements KeyStore.LoadStoreParameter {
> KeyStore.ProtectionParameter protPar;
> public MyLoadStoreParams() {
> }
> public MyLoadStoreParams(KeyStore.ProtectionParameter p) {
> if (p == null) {
> throw new NullPointerException("null parameter");
> }
> this.protPar = p;
> }
> public KeyStore.ProtectionParameter getProtectionParameter() {
> return protPar;
> }
> }
> Run the test below:
> public class KeyStoreSpiTest {
> public static void main(String[] args) throws Exception {
> KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(new KeyStore.PasswordProtection(new char[0]));
> KeyStoreSpi spi = new MyKeyStoreSpi();
> spi.engineLoad(lParam);
> }
> }
> Harmony throws IllegalArgumentException which does not follow spec. IMO, it should simply throws IOException to indicate there is an I/O problem.
> Finally , thanks for reading so far :-)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (HARMONY-2931) [classlib][security]
KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception
improperly
Posted by "Stepan Mishura (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2931?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stepan Mishura resolved HARMONY-2931.
-------------------------------------
Resolution: Fixed
Thanks Ruth - the patch was applied to SECURITY module at r498927.
Please check that the patch was applied as you expected.
> [classlib][security] KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception improperly
> -----------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2931
> URL: https://issues.apache.org/jira/browse/HARMONY-2931
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Ruth Cao
> Assigned To: Stepan Mishura
> Attachments: Harmony-2931.diff
>
>
> I mocked a simple KeyStoreSpi and KeyStore.LoadStoreParameter as following:
> class MyKeyStoreSpi extends KeyStoreSpi {
> public Key engineGetKey(String alias, char[] password)
> throws NoSuchAlgorithmException, UnrecoverableKeyException {
> return null;
> }
> public Certificate[] engineGetCertificateChain(String alias) {
> return null;
> }
> public Certificate engineGetCertificate(String alias) {
> return null;
> }
> public Date engineGetCreationDate(String alias) {
> return new Date(0);
> }
> public void engineSetKeyEntry(String alias, Key key, char[] password,
> Certificate[] chain) throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetCertificateEntry(String alias, Certificate cert)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetCertificateEntry is not supported in myKeyStoreSpi");
> }
> public void engineDeleteEntry(String alias) throws KeyStoreException {
> throw new KeyStoreException(
> "engineDeleteEntry is not supported in myKeyStoreSpi");
> }
> public Enumeration engineAliases() {
> return null;
> }
> public boolean engineContainsAlias(String alias) {
> return false;
> }
> public int engineSize() {
> return 0;
> }
> public boolean engineIsKeyEntry(String alias) {
> return false;
> }
> public boolean engineIsCertificateEntry(String alias) {
> return false;
> }
> public String engineGetCertificateAlias(Certificate cert) {
> return "";
> }
> public void engineStore(OutputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> if (!(stream instanceof ByteArrayOutputStream)) {
> throw new IOException("Incorrect stream");
> }
> if (((ByteArrayOutputStream) stream).size() == 0) {
> throw new IOException("Incorrect stream size ");
> }
> }
> public void engineLoad(InputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> throw new IOException();
> }
> }
> class MyLoadStoreParams implements KeyStore.LoadStoreParameter {
> KeyStore.ProtectionParameter protPar;
> public MyLoadStoreParams() {
> }
> public MyLoadStoreParams(KeyStore.ProtectionParameter p) {
> if (p == null) {
> throw new NullPointerException("null parameter");
> }
> this.protPar = p;
> }
> public KeyStore.ProtectionParameter getProtectionParameter() {
> return protPar;
> }
> }
> Run the test below:
> public class KeyStoreSpiTest {
> public static void main(String[] args) throws Exception {
> KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(new KeyStore.PasswordProtection(new char[0]));
> KeyStoreSpi spi = new MyKeyStoreSpi();
> spi.engineLoad(lParam);
> }
> }
> Harmony throws IllegalArgumentException which does not follow spec. IMO, it should simply throws IOException to indicate there is an I/O problem.
> Finally , thanks for reading so far :-)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HARMONY-2931) [classlib][security]
KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception
improperly
Posted by "Ruth Cao (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466651 ]
Ruth Cao commented on HARMONY-2931:
-----------------------------------
verified at r498927. Thanks Stepan.
> [classlib][security] KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception improperly
> -----------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2931
> URL: https://issues.apache.org/jira/browse/HARMONY-2931
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Ruth Cao
> Assigned To: Stepan Mishura
> Attachments: Harmony-2931.diff
>
>
> I mocked a simple KeyStoreSpi and KeyStore.LoadStoreParameter as following:
> class MyKeyStoreSpi extends KeyStoreSpi {
> public Key engineGetKey(String alias, char[] password)
> throws NoSuchAlgorithmException, UnrecoverableKeyException {
> return null;
> }
> public Certificate[] engineGetCertificateChain(String alias) {
> return null;
> }
> public Certificate engineGetCertificate(String alias) {
> return null;
> }
> public Date engineGetCreationDate(String alias) {
> return new Date(0);
> }
> public void engineSetKeyEntry(String alias, Key key, char[] password,
> Certificate[] chain) throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetCertificateEntry(String alias, Certificate cert)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetCertificateEntry is not supported in myKeyStoreSpi");
> }
> public void engineDeleteEntry(String alias) throws KeyStoreException {
> throw new KeyStoreException(
> "engineDeleteEntry is not supported in myKeyStoreSpi");
> }
> public Enumeration engineAliases() {
> return null;
> }
> public boolean engineContainsAlias(String alias) {
> return false;
> }
> public int engineSize() {
> return 0;
> }
> public boolean engineIsKeyEntry(String alias) {
> return false;
> }
> public boolean engineIsCertificateEntry(String alias) {
> return false;
> }
> public String engineGetCertificateAlias(Certificate cert) {
> return "";
> }
> public void engineStore(OutputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> if (!(stream instanceof ByteArrayOutputStream)) {
> throw new IOException("Incorrect stream");
> }
> if (((ByteArrayOutputStream) stream).size() == 0) {
> throw new IOException("Incorrect stream size ");
> }
> }
> public void engineLoad(InputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> throw new IOException();
> }
> }
> class MyLoadStoreParams implements KeyStore.LoadStoreParameter {
> KeyStore.ProtectionParameter protPar;
> public MyLoadStoreParams() {
> }
> public MyLoadStoreParams(KeyStore.ProtectionParameter p) {
> if (p == null) {
> throw new NullPointerException("null parameter");
> }
> this.protPar = p;
> }
> public KeyStore.ProtectionParameter getProtectionParameter() {
> return protPar;
> }
> }
> Run the test below:
> public class KeyStoreSpiTest {
> public static void main(String[] args) throws Exception {
> KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(new KeyStore.PasswordProtection(new char[0]));
> KeyStoreSpi spi = new MyKeyStoreSpi();
> spi.engineLoad(lParam);
> }
> }
> Harmony throws IllegalArgumentException which does not follow spec. IMO, it should simply throws IOException to indicate there is an I/O problem.
> Finally , thanks for reading so far :-)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HARMONY-2931) [classlib][security]
KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception
improperly
Posted by "Ruth Cao (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466620 ]
Ruth Cao commented on HARMONY-2931:
-----------------------------------
Stepan,
May you pls have a look at this issue? Thanks a lot.
> [classlib][security] KeyStoreSpi.engineLoad(KeyStore.LoadStoreParameter) catches exception improperly
> -----------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2931
> URL: https://issues.apache.org/jira/browse/HARMONY-2931
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Ruth Cao
> Assigned To: Stepan Mishura
> Attachments: Harmony-2931.diff
>
>
> I mocked a simple KeyStoreSpi and KeyStore.LoadStoreParameter as following:
> class MyKeyStoreSpi extends KeyStoreSpi {
> public Key engineGetKey(String alias, char[] password)
> throws NoSuchAlgorithmException, UnrecoverableKeyException {
> return null;
> }
> public Certificate[] engineGetCertificateChain(String alias) {
> return null;
> }
> public Certificate engineGetCertificate(String alias) {
> return null;
> }
> public Date engineGetCreationDate(String alias) {
> return new Date(0);
> }
> public void engineSetKeyEntry(String alias, Key key, char[] password,
> Certificate[] chain) throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetKeyEntry is not supported in myKeyStoreSpi");
> }
> public void engineSetCertificateEntry(String alias, Certificate cert)
> throws KeyStoreException {
> throw new KeyStoreException(
> "engineSetCertificateEntry is not supported in myKeyStoreSpi");
> }
> public void engineDeleteEntry(String alias) throws KeyStoreException {
> throw new KeyStoreException(
> "engineDeleteEntry is not supported in myKeyStoreSpi");
> }
> public Enumeration engineAliases() {
> return null;
> }
> public boolean engineContainsAlias(String alias) {
> return false;
> }
> public int engineSize() {
> return 0;
> }
> public boolean engineIsKeyEntry(String alias) {
> return false;
> }
> public boolean engineIsCertificateEntry(String alias) {
> return false;
> }
> public String engineGetCertificateAlias(Certificate cert) {
> return "";
> }
> public void engineStore(OutputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> if (!(stream instanceof ByteArrayOutputStream)) {
> throw new IOException("Incorrect stream");
> }
> if (((ByteArrayOutputStream) stream).size() == 0) {
> throw new IOException("Incorrect stream size ");
> }
> }
> public void engineLoad(InputStream stream, char[] password)
> throws IOException, NoSuchAlgorithmException, CertificateException {
> throw new IOException();
> }
> }
> class MyLoadStoreParams implements KeyStore.LoadStoreParameter {
> KeyStore.ProtectionParameter protPar;
> public MyLoadStoreParams() {
> }
> public MyLoadStoreParams(KeyStore.ProtectionParameter p) {
> if (p == null) {
> throw new NullPointerException("null parameter");
> }
> this.protPar = p;
> }
> public KeyStore.ProtectionParameter getProtectionParameter() {
> return protPar;
> }
> }
> Run the test below:
> public class KeyStoreSpiTest {
> public static void main(String[] args) throws Exception {
> KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(new KeyStore.PasswordProtection(new char[0]));
> KeyStoreSpi spi = new MyKeyStoreSpi();
> spi.engineLoad(lParam);
> }
> }
> Harmony throws IllegalArgumentException which does not follow spec. IMO, it should simply throws IOException to indicate there is an I/O problem.
> Finally , thanks for reading so far :-)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.