From Alan.Bateman at oracle.com Sat Jan 2 07:40:44 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 2 Jan 2016 07:40:44 +0000 Subject: RFR: JDK-8134577 - Eliminate or standardize a replacement for sun.net.spi.nameservice.NameServiceDescriptor In-Reply-To: <56853BED.2070007@oracle.com> References: <562D6679.9090509@oracle.com> <5644C26B.2030007@oracle.com> <5645DB41.8000704@oracle.com> <56853BED.2070007@oracle.com> Message-ID: <56877EFC.2000505@oracle.com> On 31/12/2015 14:30, Mark Sheppard wrote: > Hi > please oblige and review the current version of the fix for > https://bugs.openjdk.java.net/browse/JDK-8134577 > > at > http://cr.openjdk.java.net/~msheppar/8134577/webrev.05/ > > which is based on feedback from the second review. I looked through the latest webrev and I think this is starting to look good. Having the hosts file be the same format (albeit a subset) as /etc/hosts is a big improvement on previous iterations. InetAddress.nameServices is still a List but the List will always have one element, should this be changed to InetAddress.nameService (singular)? I think it would be cleaner if NameService were changed to an interface with two implementations, say PlatformNameService and HostsFileNameService. That way you could eliminate the useLocalHostsFileLookup and hostsFileName fields from InetAddress and HostsFileNameService could encapsulate the parsing of the hosts file rather than NameService trying to support both ways. The property name jdk.net.hosts.file is good but if set to a file that doesn't exist then the current patch falls back to use the platform name service. I assume this is not the original intention. The Scanner is created without specifying a charset, is this deliberate because the platform /etc/hosts is in platform encoding? For tests then it might be better to use UTF-8 because these hosts file will be used on several different platforms. Is there any reason to use legacy StringTokenizer in createAddressByteArray? In other areas of the patch then it using Scanner or String.split so it seems inconsistent to see legacy StringTokenizer in use too. You mentioned in the mail about # supported as a comment when the first character. It doesn't seem to be much effort to just drop everything after the # so that it is more consistent with the platform hosts file. UHE is thrown in a few places without any exception message. For the hosts file then it would be useful to include some message to make configuration issues easier to diagnose. The comment in NameService has a historical reference to the JNDI DNS provider, I assume that is not needed. I also looked through the test changes. Several tests set test.src and not clear that this is needed. I assume that what you really want is: String testSrc = System.getProperty("test.src", "."); addMappingToHostsFile is added to a number of tests. It would be good if this could use try-with-resources to avoid leaving a file open then the write fails (say a test machine with a full file system). sun/security/x509/URICertStore/ExtensionsWithLDAP.java has been added to the exclude list with JDK-8134577 as the issue number. Is there is a different issue number for this? Are all of the tests in test/sun/net/InetAddress/nameservice still needed? Some of these tests, as least in the 'dns' directory, are tests for the JNDI DNS provider and maybe they should be deleted. The update to KDC means that any test using this library will need to run in othervm mode. That may be true already but we should check. Related to this is that setting the system property in the main method might be fragile in that it's possible for code to execute before the main method that triggers the initialization of InetAddress. Something to keep in mind as we might have to re-visit these tests again. -Alan -------------- next part -------------- An HTML attachment was scrubbed... URL: From weijun.wang at oracle.com Sat Jan 2 09:41:09 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Sat, 2 Jan 2016 17:41:09 +0800 Subject: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs In-Reply-To: References: <367c763e-d25e-4f12-a80c-c79611f67dc0@default> <565C31EA.4050709@oracle.com> <0bea66aa-c1ab-486c-88f1-1791719c2c54@default> <56661315.2070701@oracle.com> <3d12ebbb-f4f0-4cea-b319-a67b1d742896@default> <566753FD.5020106@oracle.com> <5667708F.9000706@oracle.com> <62346504-1078-4ccd-9188-29dcd288f269@default> <62fab1cf-13f9-4e7b-bec1-ad59a2a6ebbc@default> <35522719-0284-4FFB-89F0-E987CA61657B@oracle.com> Message-ID: <8C0A593F-C56B-4790-8483-E9DF7F9442E3@oracle.com> Looks better. One question: the bug description mentions *signed* JARs. Will it be covered? Thanks Max > On Dec 22, 2015, at 2:17 PM, Sibabrata Sahoo wrote: > > Hi Max/Mandy, > > Here is the updated webrev: http://cr.openjdk.java.net/~asmotrak/siba/8130360/webrev.05/ > > I tried to address all the comments bellow. The major change includes abstracting the common behavior to ModularTest.java and extend the rest by each specific test. i.e. SecurityProviderModularTest and JaasModularClientTest. > > Thanks, > Siba > > -----Original Message----- > From: Wang Weijun > Sent: Monday, December 21, 2015 7:20 AM > To: Sibabrata Sahoo > Cc: Mandy Chung; Valerie Peng; jigsaw-dev at openjdk.java.net; security-dev at openjdk.java.net > Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs > > Tests are good. Several comments: > > 1. Try run something like "hg mv -A" to let Mercurial knows that you are renaming files (SecurityUtils.java and those in login/modules/src) instead of removing some old and creating some new. The current webrev does not show this. > > 2. It's not a good practice extending a class just to use its static fields/methods. Instead, make the util class final. > > public class JaasModularClientTest extends SecurityUtils > public class SecurityProviderModularTest extends SecurityUtils > > In fact, if you do find similarities between SecurityProviderModularTest and JaasModularClientTest, try abstract them into a ModularTest class. > > 3. Please add enough comments to SecurityUtils since it will be reused. For example, move the descriptions of EXPLICIT, AUTO and UNNAMED from test @summary to definition of enum MODULE_TYPE. > > Thanks > Max > > >> On Dec 20, 2015, at 2:10 PM, Sibabrata Sahoo wrote: >> >> Hi Mandy/Max, >> >> Here is the updated webrev with very minor change over previous: >> http://cr.openjdk.java.net/~asmotrak/siba/8130360/webrev.04/ >> >> Thanks >> Siba >> >> -----Original Message----- >> From: Sibabrata Sahoo >> Sent: Sunday, December 20, 2015 1:34 AM >> To: Mandy Chung; Weijun Wang >> Cc: Valerie Peng; jigsaw-dev at openjdk.java.net; >> security-dev at openjdk.java.net >> Subject: RE: [9] RFR:8130360: Add tests to verify 3rd party security >> providers if they are in signed/unsigned modular JARs >> >> Hi Mandy/Max, >> >> Please review the updated webrev: >> http://cr.openjdk.java.net/~asmotrak/siba/8130360/webrev.03/ >> >> "3rd party security providers" Test change includes: >> - Test are converted to use TestNG framework. >> - java/security/modules/JigsawSecurityUtils.java, renamed to "SecurityUtils.java". Proper care required while pushing the change because "JigsawSecurityUtils.java" is an existing file in JAKE repository. >> - Common reusable operations moved to "SecurityUtils.java" >> - All the following comments associated. >> >> >> Based on the recent comments, I also did some changes to the "JAAS Modular test" because both test are very similar to each other. The change includes: >> - Flat folder structure. It places the Test as well as all its dependency in a single folder. i.e. "javax/security/auth/login/modules". That also means "javax/security/auth/login/modules/src/" and all its subfolders need to be removed. >> - Test converted to use TestNG framework. >> >> Thanks, >> Siba >> >> -----Original Message----- >> From: Mandy Chung >> Sent: Wednesday, December 09, 2015 11:55 PM >> To: Sibabrata Sahoo >> Cc: Valerie Peng; jigsaw-dev at openjdk.java.net; >> security-dev at openjdk.java.net >> Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security >> providers if they are in signed/unsigned modular JARs >> >> Some high-level comment: >> 1. I suggest to rename JigsawSecurityUtils.java to SecurityUtils.java. The Jigsaw prefix is not needed. >> 2. SecurityProviderModularTest does the setup and launch the test with a set of different settings. I suggest to convert it to TestNG and you can reference the existing test/jdk/jigsaw tests which are a driver test that does the compilation and setup with @BeforeTest and @Test for each run test together with @DataProvider. [1] is a simple test for you to get started. >> >> Some comments on JigsawSecurityUtils.java: >> 71 Arrays.asList(options).stream().forEach(o -> command.append(SPACE + o)); >> >> this can be replaced with >> Arrays.stream(options).collect(Collectors.joining(SPACE)); >> >> 111 System.out.println(String.format( >> >> You can do: System.out.format(?.) instead; >> >> Mandy >> [1] >> http://hg.openjdk.java.net/jigsaw/jake/jdk/file/c1d583efa466/test/jdk/ >> jigsaw/reflect/Proxy/ProxyTest.java >> >>> On Dec 9, 2015, at 10:02 AM, Sibabrata Sahoo wrote: >>> >>> Hi Valerie, >>> >>> Here is the updated webrev: >>> http://cr.openjdk.java.net/~ntv/siba/webrev.00/ >>> >>> Changes applied as per previous comments. >>> - File names are modified and do not include the term JCE. >>> - Source folder structure is flat now and all belongs to "java/security/Provider" folder. >>> - Sign jar functionality removed. >>> >>> Thanks, >>> Siba >>> >>> -----Original Message----- >>> From: Valerie Peng >>> Sent: Wednesday, December 09, 2015 5:37 AM >>> To: Sibabrata Sahoo >>> Cc: jigsaw-dev at openjdk.java.net; security-dev at openjdk.java.net; Alan >>> Bateman >>> Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security >>> providers if they are in signed/unsigned modular JARs >>> >>> Hi Siba, >>> >>> Here are some nits: >>> >>> I think it's somewhat misleading to use the term JCE here as what you are testing here is just security provider loading. JCE is more about security providers supporting export-controlled services/algorithms. >>> Since your provider is just an empty one, I don't think u need to sign it (again, it's only for JCE providers). >>> You can remove a lot of code as a result. >>> Also, your directory seems a bit deep, e.g. >>> modules/src/jceprovidermodule/provider/TestJCEProvider.java vs modules/src/jceclientmodule/provider/TestJCEProvider.java. Can all of these files be under the same directory instead of spreading over several level of subdirectories? The file names are different enough to tell which is which. Other regression tests for provider loading functionality are under test/java/security/Provider. Easier to find this way. >>> >>> Can you please make the appropriate changes, e.g. don't use the term JCE, get rid of the signing, and simplify the directory structure if possible? >>> >>> Thanks, >>> Valerie >>> >>> On 12/8/2015 2:04 PM, Valerie Peng wrote: >>>> Right, that'd be my expectation as well. Sounds like everything works. >>>> I will change to look at your latest webrev. >>>> Valerie >>>> >>>> On 12/8/2015 6:09 AM, Sibabrata Sahoo wrote: >>>>> Hi Valerie, >>>>> >>>>> Here is the updated webrev: >>>>> http://cr.openjdk.java.net/~ralexander/8130360/webrev.00/ >>>>> >>>>> Now the modular behavior for the test works as per expectation >>>>> through JAKE build with the following condition. >>>>> If the provider jar is available under ModulePath then the >>>>> "java.security" file should have the provider configuration entry >>>>> as ProviderName while in case of ClassPath the entry should hold >>>>> the full class name. >>>>> >>>>> Thanks, >>>>> Siba >>>>> >>>>> -----Original Message----- >>>>> From: Valerie Peng >>>>> Sent: Tuesday, December 08, 2015 4:46 AM >>>>> To: Sibabrata Sahoo >>>>> Cc: Alan Bateman; security-dev at openjdk.java.net; >>>>> jigsaw-dev at openjdk.java.net >>>>> Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party >>>>> security providers if they are in signed/unsigned modular JARs >>>>> >>>>> Siba, >>>>> >>>>> I have just started to review this webrev and not done yet. >>>>> As for your question, the java.security file in OpenJDK9 still uses >>>>> the provider class names instead of provider names. Are you talking >>>>> about the java.security file in Jigsaw? Which build (OpenJDK or >>>>> Jigsaw) have you tested against. I am pretty sure that I tested the >>>>> 3rd party provider on classpath setting when I worked on the >>>>> 7191662 changes. >>>>> >>>>> Supposedly, if the jar files are available on class path, then you >>>>> should specify its full *class name* in the java.security file for >>>>> it to be instantiated. Otherwise, how would it find the class? Only >>>>> the classes discovered by ServiceLoader can be identified using the >>>>> provider name (which is different from the class name referred >>>>> above). So, in your scenario, that would be >>>>> "provider.TestJCEProvider" instead of "TEST". >>>>> >>>>> If you still run into problems, try enable the java security debug >>>>> flag and u should get a good idea why it isn't loaded. Let me know >>>>> if you still have questions. >>>>> >>>>> Thanks, >>>>> Valerie >>>>> >>>>> On 11/30/2015 6:47 AM, Sibabrata Sahoo wrote: >>>>>> I would like to know more about this. As far, I can see the >>>>>> "java.security" provider configuration available with JDK9, it >>>>>> holds provider names instead of provider class names. In that case >>>>>> how it resolve the fall back? >>>>>> >>>>>> Thanks, >>>>>> Siba >>>>>> >>>>>> -----Original Message----- >>>>>> From: Alan Bateman >>>>>> Sent: Monday, November 30, 2015 4:54 PM >>>>>> To: Sibabrata Sahoo; security-dev at openjdk.java.net; >>>>>> jigsaw-dev at openjdk.java.net >>>>>> Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party >>>>>> security providers if they are in signed/unsigned modular JARs >>>>>> >>>>>> On 30/11/2015 11:13, Sibabrata Sahoo wrote: >>>>>>> Here is the updated webrev: >>>>>>> http://cr.openjdk.java.net/~asmotrak/siba/8130360/webrev.02/ >>>>>>> >>>>>>> I have one question: >>>>>>> What should be the behavior when the older version of 3rd party >>>>>>> JCE provider jar file(without service descriptor >>>>>>> "META-INF/services/*"& working with<= JDK8) configured by >>>>>>> "java.security" file, will be place in CLASS_PATH, running >>>>>>> through >>>>>>> JDK9 and the client is using Security.getProvider() to look for >>>>>>> the provider? >>>>>>> >>>>>>> Currently the scenario fails to find the JCE provider. Is this >>>>>>> right behavior? If it is, then jdk9 is not backward compatible to >>>>>>> find the security provider provided through older jar files from >>>>>>> CLASS_PATH. >>>>>>> >>>>>> The JCE work in JDK 9 (via JDK-7191662) was meant to address this >>>>>> point by falling back and attempting to load the class name >>>>>> specified via the security.provider. properties in the >>>>>> java.security file. I'm sure Valerie can say more about this. >>>>>> >>>>>> -Alan >> > From sibabrata.sahoo at oracle.com Sun Jan 3 06:30:06 2016 From: sibabrata.sahoo at oracle.com (Sibabrata Sahoo) Date: Sat, 2 Jan 2016 22:30:06 -0800 (PST) Subject: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs In-Reply-To: <8C0A593F-C56B-4790-8483-E9DF7F9442E3@oracle.com> References: <367c763e-d25e-4f12-a80c-c79611f67dc0@default> <565C31EA.4050709@oracle.com> <0bea66aa-c1ab-486c-88f1-1791719c2c54@default> <56661315.2070701@oracle.com> <3d12ebbb-f4f0-4cea-b319-a67b1d742896@default> <566753FD.5020106@oracle.com> <5667708F.9000706@oracle.com> <62346504-1078-4ccd-9188-29dcd288f269@default> <62fab1cf-13f9-4e7b-bec1-ad59a2a6ebbc@default> <35522719-0284-4FFB-89F0-E987CA61657B@oracle.com> <8C0A593F-C56B-4790-8483-E9DF7F9442E3@oracle.com> Message-ID: <08c99338-0244-4492-a599-f298636c51f1@default> Hi Max, The test is for verifying 3rd party security provider in classpath/modulepath. I am using an empty provider to check, if the provider can be found during runtime when the bundle provided through classpath/modulepath with different modular type combination. As the provider is empty, I think this is unnecessary to sign the bundle. Even the same comment[1] was also provided by "Valerie" few days ago and the comment was addressed with this webrev, [1] I think it's somewhat misleading to use the term JCE here as what you are testing here is just security provider loading. JCE is more about security providers supporting export-controlled services/algorithms. Since your provider is just an empty one, I don't think u need to sign it (again, it's only for JCE providers). Thanks, Siba -----Original Message----- From: Wang Weijun Sent: Saturday, January 02, 2016 3:11 PM To: Sibabrata Sahoo Cc: Mandy Chung; Valerie Peng; jigsaw-dev at openjdk.java.net; OpenJDK Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs Looks better. One question: the bug description mentions *signed* JARs. Will it be covered? Thanks Max > On Dec 22, 2015, at 2:17 PM, Sibabrata Sahoo wrote: > > Hi Max/Mandy, > > Here is the updated webrev: > http://cr.openjdk.java.net/~asmotrak/siba/8130360/webrev.05/ > > I tried to address all the comments bellow. The major change includes abstracting the common behavior to ModularTest.java and extend the rest by each specific test. i.e. SecurityProviderModularTest and JaasModularClientTest. > > Thanks, > Siba > > -----Original Message----- > From: Wang Weijun > Sent: Monday, December 21, 2015 7:20 AM > To: Sibabrata Sahoo > Cc: Mandy Chung; Valerie Peng; jigsaw-dev at openjdk.java.net; > security-dev at openjdk.java.net > Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security > providers if they are in signed/unsigned modular JARs > > Tests are good. Several comments: > > 1. Try run something like "hg mv -A" to let Mercurial knows that you are renaming files (SecurityUtils.java and those in login/modules/src) instead of removing some old and creating some new. The current webrev does not show this. > > 2. It's not a good practice extending a class just to use its static fields/methods. Instead, make the util class final. > > public class JaasModularClientTest extends SecurityUtils > public class SecurityProviderModularTest extends SecurityUtils > > In fact, if you do find similarities between SecurityProviderModularTest and JaasModularClientTest, try abstract them into a ModularTest class. > > 3. Please add enough comments to SecurityUtils since it will be reused. For example, move the descriptions of EXPLICIT, AUTO and UNNAMED from test @summary to definition of enum MODULE_TYPE. > > Thanks > Max > > >> On Dec 20, 2015, at 2:10 PM, Sibabrata Sahoo wrote: >> >> Hi Mandy/Max, >> >> Here is the updated webrev with very minor change over previous: >> http://cr.openjdk.java.net/~asmotrak/siba/8130360/webrev.04/ >> >> Thanks >> Siba >> >> -----Original Message----- >> From: Sibabrata Sahoo >> Sent: Sunday, December 20, 2015 1:34 AM >> To: Mandy Chung; Weijun Wang >> Cc: Valerie Peng; jigsaw-dev at openjdk.java.net; >> security-dev at openjdk.java.net >> Subject: RE: [9] RFR:8130360: Add tests to verify 3rd party security >> providers if they are in signed/unsigned modular JARs >> >> Hi Mandy/Max, >> >> Please review the updated webrev: >> http://cr.openjdk.java.net/~asmotrak/siba/8130360/webrev.03/ >> >> "3rd party security providers" Test change includes: >> - Test are converted to use TestNG framework. >> - java/security/modules/JigsawSecurityUtils.java, renamed to "SecurityUtils.java". Proper care required while pushing the change because "JigsawSecurityUtils.java" is an existing file in JAKE repository. >> - Common reusable operations moved to "SecurityUtils.java" >> - All the following comments associated. >> >> >> Based on the recent comments, I also did some changes to the "JAAS Modular test" because both test are very similar to each other. The change includes: >> - Flat folder structure. It places the Test as well as all its dependency in a single folder. i.e. "javax/security/auth/login/modules". That also means "javax/security/auth/login/modules/src/" and all its subfolders need to be removed. >> - Test converted to use TestNG framework. >> >> Thanks, >> Siba >> >> -----Original Message----- >> From: Mandy Chung >> Sent: Wednesday, December 09, 2015 11:55 PM >> To: Sibabrata Sahoo >> Cc: Valerie Peng; jigsaw-dev at openjdk.java.net; >> security-dev at openjdk.java.net >> Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security >> providers if they are in signed/unsigned modular JARs >> >> Some high-level comment: >> 1. I suggest to rename JigsawSecurityUtils.java to SecurityUtils.java. The Jigsaw prefix is not needed. >> 2. SecurityProviderModularTest does the setup and launch the test with a set of different settings. I suggest to convert it to TestNG and you can reference the existing test/jdk/jigsaw tests which are a driver test that does the compilation and setup with @BeforeTest and @Test for each run test together with @DataProvider. [1] is a simple test for you to get started. >> >> Some comments on JigsawSecurityUtils.java: >> 71 Arrays.asList(options).stream().forEach(o -> command.append(SPACE + o)); >> >> this can be replaced with >> Arrays.stream(options).collect(Collectors.joining(SPACE)); >> >> 111 System.out.println(String.format( >> >> You can do: System.out.format(?.) instead; >> >> Mandy >> [1] >> http://hg.openjdk.java.net/jigsaw/jake/jdk/file/c1d583efa466/test/jdk >> / >> jigsaw/reflect/Proxy/ProxyTest.java >> >>> On Dec 9, 2015, at 10:02 AM, Sibabrata Sahoo wrote: >>> >>> Hi Valerie, >>> >>> Here is the updated webrev: >>> http://cr.openjdk.java.net/~ntv/siba/webrev.00/ >>> >>> Changes applied as per previous comments. >>> - File names are modified and do not include the term JCE. >>> - Source folder structure is flat now and all belongs to "java/security/Provider" folder. >>> - Sign jar functionality removed. >>> >>> Thanks, >>> Siba >>> >>> -----Original Message----- >>> From: Valerie Peng >>> Sent: Wednesday, December 09, 2015 5:37 AM >>> To: Sibabrata Sahoo >>> Cc: jigsaw-dev at openjdk.java.net; security-dev at openjdk.java.net; Alan >>> Bateman >>> Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security >>> providers if they are in signed/unsigned modular JARs >>> >>> Hi Siba, >>> >>> Here are some nits: >>> >>> I think it's somewhat misleading to use the term JCE here as what you are testing here is just security provider loading. JCE is more about security providers supporting export-controlled services/algorithms. >>> Since your provider is just an empty one, I don't think u need to sign it (again, it's only for JCE providers). >>> You can remove a lot of code as a result. >>> Also, your directory seems a bit deep, e.g. >>> modules/src/jceprovidermodule/provider/TestJCEProvider.java vs modules/src/jceclientmodule/provider/TestJCEProvider.java. Can all of these files be under the same directory instead of spreading over several level of subdirectories? The file names are different enough to tell which is which. Other regression tests for provider loading functionality are under test/java/security/Provider. Easier to find this way. >>> >>> Can you please make the appropriate changes, e.g. don't use the term JCE, get rid of the signing, and simplify the directory structure if possible? >>> >>> Thanks, >>> Valerie >>> >>> On 12/8/2015 2:04 PM, Valerie Peng wrote: >>>> Right, that'd be my expectation as well. Sounds like everything works. >>>> I will change to look at your latest webrev. >>>> Valerie >>>> >>>> On 12/8/2015 6:09 AM, Sibabrata Sahoo wrote: >>>>> Hi Valerie, >>>>> >>>>> Here is the updated webrev: >>>>> http://cr.openjdk.java.net/~ralexander/8130360/webrev.00/ >>>>> >>>>> Now the modular behavior for the test works as per expectation >>>>> through JAKE build with the following condition. >>>>> If the provider jar is available under ModulePath then the >>>>> "java.security" file should have the provider configuration entry >>>>> as ProviderName while in case of ClassPath the entry should hold >>>>> the full class name. >>>>> >>>>> Thanks, >>>>> Siba >>>>> >>>>> -----Original Message----- >>>>> From: Valerie Peng >>>>> Sent: Tuesday, December 08, 2015 4:46 AM >>>>> To: Sibabrata Sahoo >>>>> Cc: Alan Bateman; security-dev at openjdk.java.net; >>>>> jigsaw-dev at openjdk.java.net >>>>> Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party >>>>> security providers if they are in signed/unsigned modular JARs >>>>> >>>>> Siba, >>>>> >>>>> I have just started to review this webrev and not done yet. >>>>> As for your question, the java.security file in OpenJDK9 still >>>>> uses the provider class names instead of provider names. Are you >>>>> talking about the java.security file in Jigsaw? Which build >>>>> (OpenJDK or >>>>> Jigsaw) have you tested against. I am pretty sure that I tested >>>>> the 3rd party provider on classpath setting when I worked on the >>>>> 7191662 changes. >>>>> >>>>> Supposedly, if the jar files are available on class path, then you >>>>> should specify its full *class name* in the java.security file for >>>>> it to be instantiated. Otherwise, how would it find the class? >>>>> Only the classes discovered by ServiceLoader can be identified >>>>> using the provider name (which is different from the class name >>>>> referred above). So, in your scenario, that would be >>>>> "provider.TestJCEProvider" instead of "TEST". >>>>> >>>>> If you still run into problems, try enable the java security debug >>>>> flag and u should get a good idea why it isn't loaded. Let me >>>>> know if you still have questions. >>>>> >>>>> Thanks, >>>>> Valerie >>>>> >>>>> On 11/30/2015 6:47 AM, Sibabrata Sahoo wrote: >>>>>> I would like to know more about this. As far, I can see the >>>>>> "java.security" provider configuration available with JDK9, it >>>>>> holds provider names instead of provider class names. In that >>>>>> case how it resolve the fall back? >>>>>> >>>>>> Thanks, >>>>>> Siba >>>>>> >>>>>> -----Original Message----- >>>>>> From: Alan Bateman >>>>>> Sent: Monday, November 30, 2015 4:54 PM >>>>>> To: Sibabrata Sahoo; security-dev at openjdk.java.net; >>>>>> jigsaw-dev at openjdk.java.net >>>>>> Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party >>>>>> security providers if they are in signed/unsigned modular JARs >>>>>> >>>>>> On 30/11/2015 11:13, Sibabrata Sahoo wrote: >>>>>>> Here is the updated webrev: >>>>>>> http://cr.openjdk.java.net/~asmotrak/siba/8130360/webrev.02/ >>>>>>> >>>>>>> I have one question: >>>>>>> What should be the behavior when the older version of 3rd party >>>>>>> JCE provider jar file(without service descriptor >>>>>>> "META-INF/services/*"& working with<= JDK8) configured by >>>>>>> "java.security" file, will be place in CLASS_PATH, running >>>>>>> through >>>>>>> JDK9 and the client is using Security.getProvider() to look for >>>>>>> the provider? >>>>>>> >>>>>>> Currently the scenario fails to find the JCE provider. Is this >>>>>>> right behavior? If it is, then jdk9 is not backward compatible >>>>>>> to find the security provider provided through older jar files >>>>>>> from CLASS_PATH. >>>>>>> >>>>>> The JCE work in JDK 9 (via JDK-7191662) was meant to address this >>>>>> point by falling back and attempting to load the class name >>>>>> specified via the security.provider. properties in the >>>>>> java.security file. I'm sure Valerie can say more about this. >>>>>> >>>>>> -Alan >> > From weijun.wang at oracle.com Sun Jan 3 07:32:17 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Sun, 3 Jan 2016 15:32:17 +0800 Subject: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs In-Reply-To: <08c99338-0244-4492-a599-f298636c51f1@default> References: <367c763e-d25e-4f12-a80c-c79611f67dc0@default> <565C31EA.4050709@oracle.com> <0bea66aa-c1ab-486c-88f1-1791719c2c54@default> <56661315.2070701@oracle.com> <3d12ebbb-f4f0-4cea-b319-a67b1d742896@default> <566753FD.5020106@oracle.com> <5667708F.9000706@oracle.com> <62346504-1078-4ccd-9188-29dcd288f269@default> <62fab1cf-13f9-4e7b-bec1-ad59a2a6ebbc@default> <35522719-0284-4FFB-89F0-E987CA61657B@oracle.com> <8C0A593F-C56B-4790-8483-E9DF7F9442E3@oracle.com> <08c99338-0244-4492-a599-f298636c51f1@default> Message-ID: <0A2B94FD-7468-4169-A676-E55AF20CF5BB@oracle.com> Then you don't need to include the "signed/unsigned" words in the bug description. --Max > On Jan 3, 2016, at 2:30 PM, Sibabrata Sahoo wrote: > > Hi Max, > > The test is for verifying 3rd party security provider in classpath/modulepath. I am using an empty provider to check, if the provider can be found during runtime when the bundle provided through classpath/modulepath with different modular type combination. As the provider is empty, I think this is unnecessary to sign the bundle. > > Even the same comment[1] was also provided by "Valerie" few days ago and the comment was addressed with this webrev, > > [1] I think it's somewhat misleading to use the term JCE here as what you are testing here is just security provider loading. JCE is more about security providers supporting export-controlled services/algorithms. Since your provider is just an empty one, I don't think u need to sign it (again, it's only for JCE providers). > > Thanks, > Siba From sibabrata.sahoo at oracle.com Sun Jan 3 07:48:03 2016 From: sibabrata.sahoo at oracle.com (Sibabrata Sahoo) Date: Sat, 2 Jan 2016 23:48:03 -0800 (PST) Subject: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs In-Reply-To: <0A2B94FD-7468-4169-A676-E55AF20CF5BB@oracle.com> References: <367c763e-d25e-4f12-a80c-c79611f67dc0@default> <565C31EA.4050709@oracle.com> <0bea66aa-c1ab-486c-88f1-1791719c2c54@default> <56661315.2070701@oracle.com> <3d12ebbb-f4f0-4cea-b319-a67b1d742896@default> <566753FD.5020106@oracle.com> <5667708F.9000706@oracle.com> <62346504-1078-4ccd-9188-29dcd288f269@default> <62fab1cf-13f9-4e7b-bec1-ad59a2a6ebbc@default> <35522719-0284-4FFB-89F0-E987CA61657B@oracle.com> <8C0A593F-C56B-4790-8483-E9DF7F9442E3@oracle.com> <08c99338-0244-4492-a599-f298636c51f1@default> <0A2B94FD-7468-4169-A676-E55AF20CF5BB@oracle.com> Message-ID: <63548002-8f1e-4c64-a9c5-55df5d27fc7b@default> Updated the bug title and description. Thanks, Siba -----Original Message----- From: Wang Weijun Sent: Sunday, January 03, 2016 1:02 PM To: Sibabrata Sahoo Cc: Mandy Chung; Valerie Peng; jigsaw-dev at openjdk.java.net; OpenJDK Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs Then you don't need to include the "signed/unsigned" words in the bug description. --Max > On Jan 3, 2016, at 2:30 PM, Sibabrata Sahoo wrote: > > Hi Max, > > The test is for verifying 3rd party security provider in classpath/modulepath. I am using an empty provider to check, if the provider can be found during runtime when the bundle provided through classpath/modulepath with different modular type combination. As the provider is empty, I think this is unnecessary to sign the bundle. > > Even the same comment[1] was also provided by "Valerie" few days ago and the comment was addressed with this webrev, > > [1] I think it's somewhat misleading to use the term JCE here as what you are testing here is just security provider loading. JCE is more about security providers supporting export-controlled services/algorithms. Since your provider is just an empty one, I don't think u need to sign it (again, it's only for JCE providers). > > Thanks, > Siba From xuelei.fan at oracle.com Mon Jan 4 08:19:58 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Mon, 4 Jan 2016 16:19:58 +0800 Subject: RFR 8146377: test/sun/security/tools/jarsigner/concise_jarsigner.sh failing In-Reply-To: <6FD46EB9-0806-4CD6-AE33-5B875391A0F9@oracle.com> References: <6FD46EB9-0806-4CD6-AE33-5B875391A0F9@oracle.com> Message-ID: <568A2B2E.2000504@oracle.com> An interesting bug. Looks fine to me. Xuelei On 1/1/2016 1:26 AM, Wang Weijun wrote: > Hi > > Please review the fix of https://bugs.openjdk.java.net/browse/JDK-8146377. Some years have more days than 365 and the test fails. The fix is simply > > diff --git a/test/sun/security/tools/jarsigner/concise_jarsigner.sh b/test/sun/security/tools/jarsigner/concise_jarsigner.sh > --- a/test/sun/security/tools/jarsigner/concise_jarsigner.sh > +++ b/test/sun/security/tools/jarsigner/concise_jarsigner.sh > @@ -69,8 +69,8 @@ > # First part: output format > # ========================================================== > > -$KT -genkeypair -alias a1 -dname CN=a1 -validity 365 > -$KT -genkeypair -alias a2 -dname CN=a2 -validity 365 > +$KT -genkeypair -alias a1 -dname CN=a1 -validity 366 > +$KT -genkeypair -alias a2 -dname CN=a2 -validity 366 > > # a.jar includes 8 unsigned, 2 signed by a1 and a2, 2 signed by a3 > $JAR cvf a.jar A1.class A2.class > > Thanks > Max > From weijun.wang at oracle.com Mon Jan 4 08:21:36 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Mon, 4 Jan 2016 16:21:36 +0800 Subject: RFR 8146377: test/sun/security/tools/jarsigner/concise_jarsigner.sh failing In-Reply-To: <568A2B2E.2000504@oracle.com> References: <6FD46EB9-0806-4CD6-AE33-5B875391A0F9@oracle.com> <568A2B2E.2000504@oracle.com> Message-ID: > On Jan 4, 2016, at 4:19 PM, Xuelei Fan wrote: > > An interesting bug. Looks fine to me. Yes, I could have closed it as "Not Reproducible" and wait for another 4 years to fix it. --Max > > Xuelei > > On 1/1/2016 1:26 AM, Wang Weijun wrote: >> Hi >> >> Please review the fix of https://bugs.openjdk.java.net/browse/JDK-8146377. Some years have more days than 365 and the test fails. The fix is simply >> >> diff --git a/test/sun/security/tools/jarsigner/concise_jarsigner.sh b/test/sun/security/tools/jarsigner/concise_jarsigner.sh >> --- a/test/sun/security/tools/jarsigner/concise_jarsigner.sh >> +++ b/test/sun/security/tools/jarsigner/concise_jarsigner.sh >> @@ -69,8 +69,8 @@ >> # First part: output format >> # ========================================================== >> >> -$KT -genkeypair -alias a1 -dname CN=a1 -validity 365 >> -$KT -genkeypair -alias a2 -dname CN=a2 -validity 365 >> +$KT -genkeypair -alias a1 -dname CN=a1 -validity 366 >> +$KT -genkeypair -alias a2 -dname CN=a2 -validity 366 >> >> # a.jar includes 8 unsigned, 2 signed by a1 and a2, 2 signed by a3 >> $JAR cvf a.jar A1.class A2.class >> >> Thanks >> Max >> > From weijun.wang at oracle.com Mon Jan 4 09:05:41 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Mon, 4 Jan 2016 17:05:41 +0800 Subject: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs In-Reply-To: <63548002-8f1e-4c64-a9c5-55df5d27fc7b@default> References: <367c763e-d25e-4f12-a80c-c79611f67dc0@default> <565C31EA.4050709@oracle.com> <0bea66aa-c1ab-486c-88f1-1791719c2c54@default> <56661315.2070701@oracle.com> <3d12ebbb-f4f0-4cea-b319-a67b1d742896@default> <566753FD.5020106@oracle.com> <5667708F.9000706@oracle.com> <62346504-1078-4ccd-9188-29dcd288f269@default> <62fab1cf-13f9-4e7b-bec1-ad59a2a6ebbc@default> <35522719-0284-4FFB-89F0-E987CA61657B@oracle.com> <8C0A593F-C56B-4790-8483-E9DF7F9442E3@oracle.com> <08c99338-0244-4492-a599-f298636c51f1@default> <0A2B94FD-7468-4169-A676-E55AF20CF5BB@oracle.com> <63548002-8f1e-4c64-a9c5-55df5d27fc7b@default> Message-ID: <43E8BD33-AB62-4A5E-9049-D80193B80DB2@oracle.com> I have no more comment. --Max > On Jan 3, 2016, at 3:48 PM, Sibabrata Sahoo wrote: > > Updated the bug title and description. > > Thanks, > Siba > > -----Original Message----- > From: Wang Weijun > Sent: Sunday, January 03, 2016 1:02 PM > To: Sibabrata Sahoo > Cc: Mandy Chung; Valerie Peng; jigsaw-dev at openjdk.java.net; OpenJDK > Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs > > Then you don't need to include the "signed/unsigned" words in the bug description. > > --Max > >> On Jan 3, 2016, at 2:30 PM, Sibabrata Sahoo wrote: >> >> Hi Max, >> >> The test is for verifying 3rd party security provider in classpath/modulepath. I am using an empty provider to check, if the provider can be found during runtime when the bundle provided through classpath/modulepath with different modular type combination. As the provider is empty, I think this is unnecessary to sign the bundle. >> >> Even the same comment[1] was also provided by "Valerie" few days ago and the comment was addressed with this webrev, >> >> [1] I think it's somewhat misleading to use the term JCE here as what you are testing here is just security provider loading. JCE is more about security providers supporting export-controlled services/algorithms. Since your provider is just an empty one, I don't think u need to sign it (again, it's only for JCE providers). >> >> Thanks, >> Siba > From sibabrata.sahoo at oracle.com Mon Jan 4 09:13:02 2016 From: sibabrata.sahoo at oracle.com (Sibabrata Sahoo) Date: Mon, 4 Jan 2016 01:13:02 -0800 (PST) Subject: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs In-Reply-To: <43E8BD33-AB62-4A5E-9049-D80193B80DB2@oracle.com> References: <367c763e-d25e-4f12-a80c-c79611f67dc0@default> <565C31EA.4050709@oracle.com> <0bea66aa-c1ab-486c-88f1-1791719c2c54@default> <56661315.2070701@oracle.com> <3d12ebbb-f4f0-4cea-b319-a67b1d742896@default> <566753FD.5020106@oracle.com> <5667708F.9000706@oracle.com> <62346504-1078-4ccd-9188-29dcd288f269@default> <62fab1cf-13f9-4e7b-bec1-ad59a2a6ebbc@default> <35522719-0284-4FFB-89F0-E987CA61657B@oracle.com> <8C0A593F-C56B-4790-8483-E9DF7F9442E3@oracle.com> <08c99338-0244-4492-a599-f298636c51f1@default> <0A2B94FD-7468-4169-A676-E55AF20CF5BB@oracle.com> <63548002-8f1e-4c64-a9c5-55df5d27fc7b@default> <43E8BD33-AB62-4A5E-9049-D80193B80DB2@oracle.com> Message-ID: <7effb779-2f60-4058-a312-a17d1d8929d4@default> Hi Valerie, If everything looks fine in the current version of webrev then can you please help me push the changes to JAKE repo. Thanks, Siba -----Original Message----- From: Wang Weijun Sent: Monday, January 04, 2016 2:36 PM To: Sibabrata Sahoo Cc: Mandy Chung; Valerie Peng; jigsaw-dev at openjdk.java.net; OpenJDK Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs I have no more comment. --Max > On Jan 3, 2016, at 3:48 PM, Sibabrata Sahoo wrote: > > Updated the bug title and description. > > Thanks, > Siba > > -----Original Message----- > From: Wang Weijun > Sent: Sunday, January 03, 2016 1:02 PM > To: Sibabrata Sahoo > Cc: Mandy Chung; Valerie Peng; jigsaw-dev at openjdk.java.net; OpenJDK > Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs > > Then you don't need to include the "signed/unsigned" words in the bug description. > > --Max > >> On Jan 3, 2016, at 2:30 PM, Sibabrata Sahoo wrote: >> >> Hi Max, >> >> The test is for verifying 3rd party security provider in classpath/modulepath. I am using an empty provider to check, if the provider can be found during runtime when the bundle provided through classpath/modulepath with different modular type combination. As the provider is empty, I think this is unnecessary to sign the bundle. >> >> Even the same comment[1] was also provided by "Valerie" few days ago and the comment was addressed with this webrev, >> >> [1] I think it's somewhat misleading to use the term JCE here as what you are testing here is just security provider loading. JCE is more about security providers supporting export-controlled services/algorithms. Since your provider is just an empty one, I don't think u need to sign it (again, it's only for JCE providers). >> >> Thanks, >> Siba > From chris.hegarty at oracle.com Mon Jan 4 14:02:34 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Mon, 4 Jan 2016 14:02:34 +0000 Subject: RFR [9] 8145544: Move sun.misc.VM to jdk.internal.misc Message-ID: <568A7B7A.5060001@oracle.com> sun.misc.VM provides a low-level interface for a small number of specific operations with the VM. In preparation for JEP 260, this class should be moved out of sun.misc and located in a non-exported package [. http://cr.openjdk.java.net/~chegar/8145544/00/ Note: as in other areas some tests that require access to internal APIs have been updated to use types from a more stable package, sun.security.x509. -Chris. [1] https://bugs.openjdk.java.net/browse/JDK-8145544 From sean.mullan at oracle.com Mon Jan 4 14:12:16 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Mon, 4 Jan 2016 09:12:16 -0500 Subject: RFR [9] 8145544: Move sun.misc.VM to jdk.internal.misc In-Reply-To: <568A7B7A.5060001@oracle.com> References: <568A7B7A.5060001@oracle.com> Message-ID: <568A7DC0.6090604@oracle.com> On 01/04/2016 09:02 AM, Chris Hegarty wrote: > sun.misc.VM provides a low-level interface for a small number > of specific operations with the VM. In preparation for JEP 260, > this class should be moved out of sun.misc and located in a > non-exported package [. > > http://cr.openjdk.java.net/~chegar/8145544/00/ The security-libs changes look fine to me. > > Note: as in other areas some tests that require access to > internal APIs have been updated to use types from a more > stable package, sun.security.x509. Not sure what you mean - which tests do you mean and why is sun.security.x509 related to this issue? --Sean > > -Chris. > > [1] https://bugs.openjdk.java.net/browse/JDK-8145544 From weijun.wang at oracle.com Mon Jan 4 14:13:30 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Mon, 4 Jan 2016 22:13:30 +0800 Subject: RFR [9] 8145544: Move sun.misc.VM to jdk.internal.misc In-Reply-To: <568A7B7A.5060001@oracle.com> References: <568A7B7A.5060001@oracle.com> Message-ID: I am OK with the change for krb5 in both src and test. Thanks Max > On Jan 4, 2016, at 10:02 PM, Chris Hegarty wrote: > > sun.misc.VM provides a low-level interface for a small number > of specific operations with the VM. In preparation for JEP 260, > this class should be moved out of sun.misc and located in a > non-exported package [. > > http://cr.openjdk.java.net/~chegar/8145544/00/ > > Note: as in other areas some tests that require access to > internal APIs have been updated to use types from a more > stable package, sun.security.x509. > > -Chris. > > [1] https://bugs.openjdk.java.net/browse/JDK-8145544 From chris.hegarty at oracle.com Mon Jan 4 14:14:12 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Mon, 4 Jan 2016 14:14:12 +0000 Subject: RFR [9] 8145544: Move sun.misc.VM to jdk.internal.misc In-Reply-To: <568A7DC0.6090604@oracle.com> References: <568A7B7A.5060001@oracle.com> <568A7DC0.6090604@oracle.com> Message-ID: <568A7E34.8060703@oracle.com> On 04/01/16 14:12, Sean Mullan wrote: > On 01/04/2016 09:02 AM, Chris Hegarty wrote: >> sun.misc.VM provides a low-level interface for a small number >> of specific operations with the VM. In preparation for JEP 260, >> this class should be moved out of sun.misc and located in a >> non-exported package [. >> >> http://cr.openjdk.java.net/~chegar/8145544/00/ > > The security-libs changes look fine to me. Thanks Sean. >> Note: as in other areas some tests that require access to >> internal APIs have been updated to use types from a more >> stable package, sun.security.x509. > > Not sure what you mean - which tests do you mean and why is > sun.security.x509 related to this issue? Not an issue for security, there are a couple of langtools tests that verify that the compiler issues an appropriate warning when internal types are used. These tests used to use sun.misc.VM, I changed them to use types from sun.security.x509. We have done this in a few other placed too. -Chris. > --Sean > >> >> -Chris. >> >> [1] https://bugs.openjdk.java.net/browse/JDK-8145544 From Alan.Bateman at oracle.com Mon Jan 4 14:16:20 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 4 Jan 2016 14:16:20 +0000 Subject: RFR [9] 8145544: Move sun.misc.VM to jdk.internal.misc In-Reply-To: <568A7B7A.5060001@oracle.com> References: <568A7B7A.5060001@oracle.com> Message-ID: <568A7EB4.4080308@oracle.com> On 04/01/2016 14:02, Chris Hegarty wrote: > sun.misc.VM provides a low-level interface for a small number > of specific operations with the VM. In preparation for JEP 260, > this class should be moved out of sun.misc and located in a > non-exported package [. > > http://cr.openjdk.java.net/~chegar/8145544/00/ > > Note: as in other areas some tests that require access to > internal APIs have been updated to use types from a more > stable package, sun.security.x509. This looks okay to me. There's a few places where importing jdk.internal.misc.VM might be nicer to avoid repeating the fully qualified name - java.lang.Class and java.lang.System are two examples. In passing then I wonder if it's time to drop OSEnvironment, I don't think it has been needed for a long time (the win32 error mode stuff is legacy). -Alan. From sean.mullan at oracle.com Mon Jan 4 14:19:48 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Mon, 4 Jan 2016 09:19:48 -0500 Subject: RFR [9] 8145544: Move sun.misc.VM to jdk.internal.misc In-Reply-To: <568A7E34.8060703@oracle.com> References: <568A7B7A.5060001@oracle.com> <568A7DC0.6090604@oracle.com> <568A7E34.8060703@oracle.com> Message-ID: <568A7F84.4060707@oracle.com> On 01/04/2016 09:14 AM, Chris Hegarty wrote: >>> Note: as in other areas some tests that require access to >>> internal APIs have been updated to use types from a more >>> stable package, sun.security.x509. >> >> Not sure what you mean - which tests do you mean and why is >> sun.security.x509 related to this issue? > > > Not an issue for security, there are a couple of langtools tests > that verify that the compiler issues an appropriate warning when > internal types are used. These tests used to use sun.misc.VM, I > changed them to use types from sun.security.x509. We have done > this in a few other placed too. Ah, ok. --Sean From chris.hegarty at oracle.com Mon Jan 4 14:37:54 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Mon, 4 Jan 2016 14:37:54 +0000 Subject: RFR [9] 8145544: Move sun.misc.VM to jdk.internal.misc In-Reply-To: <568A7EB4.4080308@oracle.com> References: <568A7B7A.5060001@oracle.com> <568A7EB4.4080308@oracle.com> Message-ID: <568A83C2.2090807@oracle.com> On 04/01/16 14:16, Alan Bateman wrote: > On 04/01/2016 14:02, Chris Hegarty wrote: >> sun.misc.VM provides a low-level interface for a small number >> of specific operations with the VM. In preparation for JEP 260, >> this class should be moved out of sun.misc and located in a >> non-exported package [. >> >> http://cr.openjdk.java.net/~chegar/8145544/00/ >> >> Note: as in other areas some tests that require access to >> internal APIs have been updated to use types from a more >> stable package, sun.security.x509. > This looks okay to me. Thanks Alan. > There's a few places where importing > jdk.internal.misc.VM might be nicer to avoid repeating the fully > qualified name - java.lang.Class and java.lang.System are two examples. I see these. Integer and few others too. I fixed them and updated the webrev in-place. > In passing then I wonder if it's time to drop OSEnvironment, I don't > think it has been needed for a long time (the win32 error mode stuff is > legacy). Right. If it is ok, I'll file another bug and do the cleanup as a follow up. -Chris. From sean.mullan at oracle.com Mon Jan 4 17:28:58 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Mon, 4 Jan 2016 12:28:58 -0500 Subject: RFR: 8129560- CKR_ARGUMENTS_BAD - private exponent needs to comply with FIPS 186-4 In-Reply-To: <95db8a25-2e09-4290-9cb5-7212627d53f8@default> References: <0ed013aa-b95a-4db8-9bd3-db3274d3de0f@default> <56746A84.60106@oracle.com> <95db8a25-2e09-4290-9cb5-7212627d53f8@default> Message-ID: <568AABDA.6070409@oracle.com> On 12/20/2015 11:42 PM, Bhanu Gopularam wrote: > Hi Sean, > > The present fix solves the test issue which is happening in newer Solaris version viz., 11.3/12 which has FIPS guidelines as a prerequisite. > With your permission I shall leave the JDK-8074580 (test stabilization issue) in current state, and would like to continue with fix for public exponent issue as reported in JDK-8129560. > Please let me know. Sure, that is fine. --Sean > > Thank you, > Bhanu > > -----Original Message----- > From: Anthony Scarpino > Sent: Saturday, December 19, 2015 3:34 AM > To: Sean Mullan > Cc: Bhanu Gopularam; security-dev at openjdk.java.net > Subject: Re: RFR: 8129560- CKR_ARGUMENTS_BAD - private exponent needs to comply with FIPS 186-4 > > The problems are different. The PKCS11 error means everything in this case. > > Tony > >> On Dec 18, 2015, at 12:20 PM, Sean Mullan wrote: >> >> The fix looks good, although this test is already on the ProblemList due to JDK-8074580. Do you know if that bug is caused by the same issue? The underlying PKCS11 error is different (maybe due to a different Solaris version?), but it looks like an identical stack trace. It would be good to also remove it from the ProblemList and close the other bug if it is a duplicate issue. >> >> --Sean >> >>> On 12/18/2015 12:41 AM, Bhanu Gopularam wrote: >>> Hi all, >>> >>> Please review a fix for following bug: >>> >>> Bug Id - https://bugs.openjdk.java.net/browse/JDK-8129560 >>> >>> Issue ? Test sun/security/pkcs11/rsa/TestKeyPairGenerator.java is >>> failing because RSAKeyGenParameterSpec >>> >>> public exponent is not accordance with FIPS 186-4 guidance >>> >>> Solution ? Used proper value for exponent based on reference from >>> FIPS 186-4, section B-2. >>> >>> webrev - http://cr.openjdk.java.net/~ntv/bhanu/8129560/webrev.00/ >>> >>> Thanks, >>> >>> Bhanu >>> From valerie.peng at oracle.com Mon Jan 4 18:53:54 2016 From: valerie.peng at oracle.com (Valerie Peng) Date: Mon, 04 Jan 2016 10:53:54 -0800 Subject: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs In-Reply-To: <7effb779-2f60-4058-a312-a17d1d8929d4@default> References: <367c763e-d25e-4f12-a80c-c79611f67dc0@default> <565C31EA.4050709@oracle.com> <0bea66aa-c1ab-486c-88f1-1791719c2c54@default> <56661315.2070701@oracle.com> <3d12ebbb-f4f0-4cea-b319-a67b1d742896@default> <566753FD.5020106@oracle.com> <5667708F.9000706@oracle.com> <62346504-1078-4ccd-9188-29dcd288f269@default> <62fab1cf-13f9-4e7b-bec1-ad59a2a6ebbc@default> <35522719-0284-4FFB-89F0-E987CA61657B@oracle.com> <8C0A593F-C56B-4790-8483-E9DF7F9442E3@oracle.com> <08c99338-0244-4492-a599-f298636c51f1@default> <0A2B94FD-7468-4169-A676-E55AF20CF5BB@oracle.com> <63548002-8f1e-4c64-a9c5-55df5d27fc7b@default> <43E8BD33-AB62-4A5E-9049-D80193B80DB2@oracle.com> <7effb779-2f60-4058-a312-a17d1d8929d4@de! fault> Message-ID: <568ABFC2.4010000@oracle.com> Well, for Jake repo, it will have to be either Mandy or Sean (Mullan). I can't push to that repo... Valerie On 1/4/2016 1:13 AM, Sibabrata Sahoo wrote: > Hi Valerie, > > If everything looks fine in the current version of webrev then can you please help me push the changes to JAKE repo. > > Thanks, > Siba > > -----Original Message----- > From: Wang Weijun > Sent: Monday, January 04, 2016 2:36 PM > To: Sibabrata Sahoo > Cc: Mandy Chung; Valerie Peng; jigsaw-dev at openjdk.java.net; OpenJDK > Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs > > I have no more comment. > > --Max > >> On Jan 3, 2016, at 3:48 PM, Sibabrata Sahoo wrote: >> >> Updated the bug title and description. >> >> Thanks, >> Siba >> >> -----Original Message----- >> From: Wang Weijun >> Sent: Sunday, January 03, 2016 1:02 PM >> To: Sibabrata Sahoo >> Cc: Mandy Chung; Valerie Peng; jigsaw-dev at openjdk.java.net; OpenJDK >> Subject: Re: [9] RFR:8130360: Add tests to verify 3rd party security providers if they are in signed/unsigned modular JARs >> >> Then you don't need to include the "signed/unsigned" words in the bug description. >> >> --Max >> >>> On Jan 3, 2016, at 2:30 PM, Sibabrata Sahoo wrote: >>> >>> Hi Max, >>> >>> The test is for verifying 3rd party security provider in classpath/modulepath. I am using an empty provider to check, if the provider can be found during runtime when the bundle provided through classpath/modulepath with different modular type combination. As the provider is empty, I think this is unnecessary to sign the bundle. >>> >>> Even the same comment[1] was also provided by "Valerie" few days ago and the comment was addressed with this webrev, >>> >>> [1] I think it's somewhat misleading to use the term JCE here as what you are testing here is just security provider loading. JCE is more about security providers supporting export-controlled services/algorithms. Since your provider is just an empty one, I don't think u need to sign it (again, it's only for JCE providers). >>> >>> Thanks, >>> Siba From sean.mullan at oracle.com Mon Jan 4 22:59:16 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Mon, 4 Jan 2016 17:59:16 -0500 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> Message-ID: <568AF944.10904@oracle.com> Here are some more comments on the API: * EntropyInput: 29 * An interface of a source of entropy input. "interface" is implied, so you can just say "A source of entropy input." Also, I think this interface should be called "EntropySource". To me, "Input" means the byte array that is already populated, whereas "Source" produces those bytes. A sentence or two with more details in the description would also be helpful. Do we want to allow the generated entropy input to be longer than the size requested (see section 7.1 of sp800-90Ar1)? Perhaps, a method such as: byte[] getFullEntropy(int length) might be more suitable, and specify that a byte array longer than the specified length may be returned. * EntropyNotAvailableException: 37 * Creates one Incomplete sentence. In the class description, add an @see link to EntropyInput.getFullEntropy. * SecureRandomParameters: It seems a little odd to have a class with one parameter that can be optional, and then accepting null as a value in the ctor, which typically will only needed by subclasses. I think it would be nicer to avoid exposing that in the API. Have you considered defining this as an interface, with a static method that returns an instance with an EntropyInput, ex: public interface SecureRandomParameters { EntropyInput getEntropyInput(); static SecureRandomParameters of(EntropyInput); } --Sean On 12/16/2015 02:20 AM, Wang Weijun wrote: > Webrev updated: > > http://cr.openjdk.java.net/~weijun/8051408/webrev.02/ > http://cr.openjdk.java.net/~weijun/8051408/webrev.02/specdiff/java/security/package-summary.html > > Changes: > > 1. DrbgParameters has a Builder now > > 2. No more default implementation for reseed() > > 3. Synchronization is now inside implementation, on engineXXX() methods > > 4. engineConfigure() now throws InvalidAlgorithmParameterException instead of IllegalArgumentException > > 5. CtrDRBG uses up all input in engineSetSeed() > > Thanks > Max From mark.sheppard at oracle.com Tue Jan 5 00:54:24 2016 From: mark.sheppard at oracle.com (Mark Sheppard) Date: Tue, 5 Jan 2016 00:54:24 +0000 Subject: RFR: JDK-8134577 - Eliminate or standardize a replacement for sun.net.spi.nameservice.NameServiceDescriptor In-Reply-To: <56877EFC.2000505@oracle.com> References: <562D6679.9090509@oracle.com> <5644C26B.2030007@oracle.com> <5645DB41.8000704@oracle.com> <56853BED.2070007@oracle.com> <56877EFC.2000505@oracle.com> Message-ID: <568B1440.6040404@oracle.com> Hi, as per feedback below webrev has been updated http://cr.openjdk.java.net/~msheppar/8134577/webrev.06/ change summary: * List nameServices replaced with Nameservice nameService * references to nameServices removed * private interface NameService added, with two implementation PlatformNameService and HostsFileNameService * Scanner created with UTF-8 charset * removed StringTokenizer, replaced with String.split() * comment handling extended, handling comments on line with mapping entry * try with resources added to addMappingToHostsFile method in tests regards Mark On 02/01/2016 07:40, Alan Bateman wrote: > On 31/12/2015 14:30, Mark Sheppard wrote: >> Hi >> please oblige and review the current version of the fix for >> https://bugs.openjdk.java.net/browse/JDK-8134577 >> >> at >> http://cr.openjdk.java.net/~msheppar/8134577/webrev.05/ >> >> which is based on feedback from the second review. > I looked through the latest webrev and I think this is starting to > look good. Having the hosts file be the same format (albeit a subset) > as /etc/hosts is a big improvement on previous iterations. > > InetAddress.nameServices is still a List but the List > will always have one element, should this be changed to > InetAddress.nameService (singular)? > > I think it would be cleaner if NameService were changed to an > interface with two implementations, say PlatformNameService and > HostsFileNameService. That way you could eliminate the > useLocalHostsFileLookup and hostsFileName fields from InetAddress and > HostsFileNameService could encapsulate the parsing of the hosts file > rather than NameService trying to support both ways. > > The property name jdk.net.hosts.file is good but if set to a file that > doesn't exist then the current patch falls back to use the platform > name service. I assume this is not the original intention. > > The Scanner is created without specifying a charset, is this > deliberate because the platform /etc/hosts is in platform encoding? > For tests then it might be better to use UTF-8 because these hosts > file will be used on several different platforms. > > Is there any reason to use legacy StringTokenizer in > createAddressByteArray? In other areas of the patch then it using > Scanner or String.split so it seems inconsistent to see legacy > StringTokenizer in use too. > > You mentioned in the mail about # supported as a comment when the > first character. It doesn't seem to be much effort to just drop > everything after the # so that it is more consistent with the platform > hosts file. > > UHE is thrown in a few places without any exception message. For the > hosts file then it would be useful to include some message to make > configuration issues easier to diagnose. > > The comment in NameService has a historical reference to the JNDI DNS > provider, I assume that is not needed. > > I also looked through the test changes. Several tests set test.src and > not clear that this is needed. I assume that what you really want is: > String testSrc = System.getProperty("test.src", "."); > > addMappingToHostsFile is added to a number of tests. It would be good > if this could use try-with-resources to avoid leaving a file open then > the write fails (say a test machine with a full file system). > > sun/security/x509/URICertStore/ExtensionsWithLDAP.java has been added > to the exclude list with JDK-8134577 as the issue number. Is there is > a different issue number for this? > > Are all of the tests in test/sun/net/InetAddress/nameservice still > needed? Some of these tests, as least in the 'dns' directory, are > tests for the JNDI DNS provider and maybe they should be deleted. > > The update to KDC means that any test using this library will need to > run in othervm mode. That may be true already but we should check. > Related to this is that setting the system property in the main method > might be fragile in that it's possible for code to execute before the > main method that triggers the initialization of InetAddress. Something > to keep in mind as we might have to re-visit these tests again. > > -Alan -------------- next part -------------- An HTML attachment was scrubbed... URL: From weijun.wang at oracle.com Tue Jan 5 01:17:43 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Tue, 5 Jan 2016 09:17:43 +0800 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: <568AF944.10904@oracle.com> References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> <568AF944.10904@oracle.com> Message-ID: <2EB14CF3-76B8-4237-A0BE-309A444581E5@oracle.com> > On Jan 5, 2016, at 6:59 AM, Sean Mullan wrote: > > Here are some more comments on the API: > > * EntropyInput: > > 29 * An interface of a source of entropy input. > > "interface" is implied, so you can just say "A source of entropy input." Also, I think this interface should be called "EntropySource". To me, "Input" means the byte array that is already populated, whereas "Source" produces those bytes. A sentence or two with more details in the description would also be helpful. Well, as defined in Section 4 of SP 800-90Ar1, "Entropy Source" means real random source based on a physical device. What we need here is the "Randomness Source" or "Source of entropy input" (section 2 of 800-90B). Shall we call it RandomnessSource? > > Do we want to allow the generated entropy input to be longer than the size requested (see section 7.1 of sp800-90Ar1)? Perhaps, a method such as: > > byte[] getFullEntropy(int length) > > might be more suitable, and specify that a byte array longer than the specified length may be returned. This should be named getEntropy(), because full means every bit of the output contains one bit of entropy. Such a method is OK for most cases, but except for one, CtrDRBG with no derivation function, where the entropy input must be full. Therefore a getFullEntropy() is needed anyway so I just use it everywhere. I also thought that every random source should have a conditioning module to convert non-full entropy bytes to full ones. If this is not true, 2 methods are needed: byte[] getEntropy(int length); void getFullEntropy(byte[] entropy); Detailed descriptions will be added on when and which is used. And I don't think we need to provide any conditioning codes. > > * EntropyNotAvailableException: > > 37 * Creates one > > Incomplete sentence. Will fix it. > > In the class description, add an @see link to EntropyInput.getFullEntropy. > > * SecureRandomParameters: > > It seems a little odd to have a class with one parameter that can be optional, and then accepting null as a value in the ctor, which typically will only needed by subclasses. I think it would be nicer to avoid exposing that in the API. Have you considered defining this as an interface, with a static method that returns an instance with an EntropyInput, ex: > > public interface SecureRandomParameters { > > EntropyInput getEntropyInput(); > > static SecureRandomParameters of(EntropyInput); > } OK. Thanks Max > > --Sean > > On 12/16/2015 02:20 AM, Wang Weijun wrote: >> Webrev updated: >> >> http://cr.openjdk.java.net/~weijun/8051408/webrev.02/ >> http://cr.openjdk.java.net/~weijun/8051408/webrev.02/specdiff/java/security/package-summary.html >> >> Changes: >> >> 1. DrbgParameters has a Builder now >> >> 2. No more default implementation for reseed() >> >> 3. Synchronization is now inside implementation, on engineXXX() methods >> >> 4. engineConfigure() now throws InvalidAlgorithmParameterException instead of IllegalArgumentException >> >> 5. CtrDRBG uses up all input in engineSetSeed() >> >> Thanks >> Max From yasuenag at gmail.com Tue Jan 5 13:19:13 2016 From: yasuenag at gmail.com (Yasumasa Suenaga) Date: Tue, 5 Jan 2016 22:19:13 +0900 Subject: Negative parameter in c'tor of EllipticCurve Message-ID: <568BC2D1.8000506@gmail.com> Hi all, I encountered IllegalArgumentException when I generate EC key pair as below. reproducer: ----------------- import java.math.*; import java.security.*; import java.security.spec.*; import java.security.interfaces.*; public class ECKeyGen{ public static BigInteger P = new BigInteger("900812823637587646514106462588455890498729007071"); public static BigInteger A = new BigInteger("-3"); public static BigInteger B = new BigInteger("366394034647231750324370400222002566844354703832"); public static BigInteger Gx = new BigInteger("264865613959729647018113670854605162895977008838"); public static BigInteger Gy = new BigInteger("51841075954883162510413392745168936296187808697"); public static BigInteger R = new BigInteger("900812823637587646514106555566573588779770753047"); public static void main(String[] args) throws Exception{ EllipticCurve curve = new EllipticCurve(new ECFieldFp(P), A, B); ECParameterSpec spec = new ECParameterSpec(curve, new ECPoint(Gx, Gy), R, 1); KeyPairGenerator keygen = KeyPairGenerator.getInstance("EC"); KeyPair keypair = keygen.generateKeyPair(); ECPrivateKey privateKey = (ECPrivateKey)keypair.getPrivate(); ECPoint publicKey = ((ECPublicKey)keypair.getPublic()).getW(); System.out.println("Private Key: " + privateKey.getS().toString(16)); System.out.println("Public Key:"); System.out.println(" x: " + publicKey.getAffineX().toString(16)); System.out.println(" y: " + publicKey.getAffineY().toString(16)); } } ----------------- console: ----------------- $ /usr/local/jdk1.8.0_66/bin/java ECKeyGen Exception in thread "main" java.lang.IllegalArgumentException: first coefficient is negative at java.security.spec.EllipticCurve.checkValidity(EllipticCurve.java:59) at java.security.spec.EllipticCurve.(EllipticCurve.java:112) at java.security.spec.EllipticCurve.(EllipticCurve.java:83) at ECKeyGen.main(ECKeyGen.java:27) ----------------- I checked this exception with both 8u66 and 9. Cause of this is the "a" parameter is negative value. However, these parameters are based on [1] . I'm not sure about the EC. However, [1] shows negative parameter, and C code which uses OpenSSL does not occur error with same parameters. If JDK implementation is incorrect, I will file it to JBS and create a webrev to avoid the check for negative value. Could you help? Thanks, Yasumasa [1] Advanced Access Content System (AACS) Introduction and Common Cryptographic Elements Table 2-1 - ECC Parameters http://www.aacsla.com/specifications/AACS_Spec_Common_Final_0953.pdf From sean.mullan at oracle.com Tue Jan 5 16:01:02 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 5 Jan 2016 11:01:02 -0500 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: <2EB14CF3-76B8-4237-A0BE-309A444581E5@oracle.com> References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> <568AF944.10904@oracle.com> <2EB14CF3-76B8-4237-A0BE-309A444581E5@oracle.com> Message-ID: <568BE8BE.8010508@oracle.com> On 01/04/2016 08:17 PM, Wang Weijun wrote: > >> On Jan 5, 2016, at 6:59 AM, Sean Mullan >> wrote: >> >> Here are some more comments on the API: >> >> * EntropyInput: >> >> 29 * An interface of a source of entropy input. >> >> "interface" is implied, so you can just say "A source of entropy >> input." Also, I think this interface should be called >> "EntropySource". To me, "Input" means the byte array that is >> already populated, whereas "Source" produces those bytes. A >> sentence or two with more details in the description would also be >> helpful. > > Well, as defined in Section 4 of SP 800-90Ar1, "Entropy Source" means > real random source based on a physical device. What we need here is > the "Randomness Source" or "Source of entropy input" (section 2 of > 800-90B). Ok, but in what cases would you really want someone to use a source that is not based on a physical device? In the default implementation, isn't the only case if the securerandom.source property is not set or is not correct, and then the SHA1PRNG non-device algorithm is used? Perhaps we could have an option which throws an exception and refuses to fall back on that for the DRBG mechanisms. Also, whether it is an approved DRBG implementation seems like a separate testing or compliance issue to me. > Shall we call it RandomnessSource? EntropySource still seems like the best name to me. EntropySource implementations produce entropy :) RandomnessSource may lead to more confusion as to what is the difference between that and SecureRandom. >> Do we want to allow the generated entropy input to be longer than >> the size requested (see section 7.1 of sp800-90Ar1)? Perhaps, a >> method such as: >> >> byte[] getFullEntropy(int length) >> >> might be more suitable, and specify that a byte array longer than >> the specified length may be returned. > > This should be named getEntropy(), because full means every bit of > the output contains one bit of entropy. > > Such a method is OK for most cases, but except for one, CtrDRBG with > no derivation function, where the entropy input must be full. > Therefore a getFullEntropy() is needed anyway so I just use it > everywhere. I also thought that every random source should have a > conditioning module to convert non-full entropy bytes to full ones. > > If this is not true, 2 methods are needed: > > byte[] getEntropy(int length); void getFullEntropy(byte[] entropy); > > Detailed descriptions will be added on when and which is used. > > And I don't think we need to provide any conditioning codes. If you think getFullEntropy is sufficient, then let's just keep the one method. --Sean From mstjohns at comcast.net Tue Jan 5 16:28:04 2016 From: mstjohns at comcast.net (Michael StJohns) Date: Tue, 5 Jan 2016 11:28:04 -0500 Subject: Negative parameter in c'tor of EllipticCurve In-Reply-To: <568BC2D1.8000506@gmail.com> References: <568BC2D1.8000506@gmail.com> Message-ID: <568BEF14.9000202@comcast.net> I believe you need to take "a mod p" to get the correct value. If you google for one of the other values in the table, you can find implementations that pre-reduce this and have a value for a that is 3 less than p. BTW - this is generally not the place to ask non-JDK questions. Mike On 1/5/2016 8:19 AM, Yasumasa Suenaga wrote: > Hi all, > > I encountered IllegalArgumentException when I generate EC key pair as below. > > reproducer: > ----------------- > import java.math.*; > import java.security.*; > import java.security.spec.*; > import java.security.interfaces.*; > > > public class ECKeyGen{ > > public static BigInteger P = > new BigInteger("900812823637587646514106462588455890498729007071"); > > public static BigInteger A = new BigInteger("-3"); > > public static BigInteger B = > new BigInteger("366394034647231750324370400222002566844354703832"); > > public static BigInteger Gx = > new BigInteger("264865613959729647018113670854605162895977008838"); > > public static BigInteger Gy = > new BigInteger("51841075954883162510413392745168936296187808697"); > > public static BigInteger R = > new BigInteger("900812823637587646514106555566573588779770753047"); > > public static void main(String[] args) throws Exception{ > EllipticCurve curve = new EllipticCurve(new ECFieldFp(P), A, B); > ECParameterSpec spec = > new ECParameterSpec(curve, new ECPoint(Gx, Gy), R, 1); > > KeyPairGenerator keygen = KeyPairGenerator.getInstance("EC"); > KeyPair keypair = keygen.generateKeyPair(); > > ECPrivateKey privateKey = (ECPrivateKey)keypair.getPrivate(); > ECPoint publicKey = ((ECPublicKey)keypair.getPublic()).getW(); > System.out.println("Private Key: " + privateKey.getS().toString(16)); > System.out.println("Public Key:"); > System.out.println(" x: " + publicKey.getAffineX().toString(16)); > System.out.println(" y: " + publicKey.getAffineY().toString(16)); > } > > } > > ----------------- > > console: > ----------------- > $ /usr/local/jdk1.8.0_66/bin/java ECKeyGen > Exception in thread "main" java.lang.IllegalArgumentException: first coefficient is negative > at java.security.spec.EllipticCurve.checkValidity(EllipticCurve.java:59) > at java.security.spec.EllipticCurve.(EllipticCurve.java:112) > at java.security.spec.EllipticCurve.(EllipticCurve.java:83) > at ECKeyGen.main(ECKeyGen.java:27) > ----------------- > > I checked this exception with both 8u66 and 9. > Cause of this is the "a" parameter is negative value. > However, these parameters are based on [1] . > > I'm not sure about the EC. > However, [1] shows negative parameter, and C code which uses OpenSSL > does not occur error with same parameters. > > If JDK implementation is incorrect, I will file it to JBS and create > a webrev to avoid the check for negative value. > > Could you help? > > > Thanks, > > Yasumasa > > > [1] Advanced Access Content System (AACS) > Introduction and Common Cryptographic Elements > Table 2-1 - ECC Parameters > http://www.aacsla.com/specifications/AACS_Spec_Common_Final_0953.pdf > > From sean.mullan at oracle.com Tue Jan 5 17:21:29 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 5 Jan 2016 12:21:29 -0500 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> Message-ID: <568BFB99.8040900@oracle.com> Here are some more comments on the API. I will send some comments on the impl next. * DrbgParameters 38 * A DRBG mechanism should extend this class. Is this sentence necessary? None of the builtin DRBG mechs extend this class. 175 * If this method is not called, the implementation will select 176 * a default {@code EntropyInput}. I think you need to be more specific about what you mean by "the implementation" (and in other methods of this class). It is not the implementation of this class, it is the DRBG SecureRandom implementations. 236 * Requests that a derivation function to be used by the DRBG mechanism. s/to be used/is to be used/ 280 * @return teh newly built {@code DrbgParameters} object s/teh/the/ The get methods should state whether they can return null or not. Some of the methods should be more specific about whether they return or make copies of mutable parameters. * SecureRandomSpi 67 protected SecureRandomSpi() { This seems like an incompatible change to me. The previous version had a default public constructor. I think this needs to be public. 75 * This argument can be {@code null}. Why can't we call the SecureRandomSpi ctor that takes no args when the parameter is null? It seems it would be cleaner to do that, but there is probably a good reason. 109 * @param bytes output. Too terse. How about "the array to be filled in with random bytes" 110 * @param additionalInput additional input. {@code null} if none. I think you should throw NPE if this is null because callers should call engineNextBytes(byte[]) in that case. 110, 134: both of these methods need an @throws UnsupportedOperationException 134 * @param additionalInput additional string, {@code null} if none. I think it would be better to add 2 engineReseed methods, one which takes no arguments and one with an additionalInput arg that throws NPE if it is null. This would also be consistent with the corresponding methods on SecureRandom. * SecureRandom 68 * {@link SecureRandomParameters} parameter. For example, a DRBG 69 * can be initialized with a {@link DrbgParameters} object. s/a DRBG/a DRBG implementation/ 87 *

Except for the one created by {@link #SecureRandom(byte[])}, a newly s/one/instance/ 88 * instantiated SecureRandom object is not seeded. Call one of {@code reseed} 89 * or {@code setSeed} methods to seed it. If none is called, the first call s/Call one of/Call the/ s/methods/method/ s/If none/If neither method/ 92 * at instantiate time through a {@code SecureRandomParameters} object. s/instantiate/instantiation/ (or creation) 94 * This self-seeding will not occur if one of {@code reseed} or {@code setSeed} 95 * methods was previously called. s/one of/the/ s/methods/method/ 97 *

A SecureRandom can be reseeded at any time by calling one of the s/one of the/the/ s/methods/method/ 883 * {@code additionalInput} may contain entropy but its main usage is to 884 * provide diversity. s/entropy but/entropy, its/ --Sean On 12/16/2015 02:20 AM, Wang Weijun wrote: > Webrev updated: > > http://cr.openjdk.java.net/~weijun/8051408/webrev.02/ > http://cr.openjdk.java.net/~weijun/8051408/webrev.02/specdiff/java/security/package-summary.html > > Changes: > > 1. DrbgParameters has a Builder now > > 2. No more default implementation for reseed() > > 3. Synchronization is now inside implementation, on engineXXX() methods > > 4. engineConfigure() now throws InvalidAlgorithmParameterException instead of IllegalArgumentException > > 5. CtrDRBG uses up all input in engineSetSeed() > > Thanks > Max From usha.seshadri at lmco.com Tue Jan 5 17:28:44 2016 From: usha.seshadri at lmco.com (Seshadri, Usha) Date: Tue, 5 Jan 2016 17:28:44 +0000 Subject: Java security configuration to look at CRL for revocation checking Message-ID: <0F6322F01158F94EBDA664939D5EA15504F4663D@HVXDSP25.us.lmco.com> Hi, I am using Java 8, and am trying to configure JVM to go to CRL for revocation checking. I didn't see any parameter in java.security to enable CRL revocation checking, although there are parameters to configure OCSP. I tried setting these two parameters as JVM options with -D, but doesn't seem to take any effect. deployment.security.validation.crl= true deployment.security.validation.crl.url=file:///root/xyz/crls/ --> points to the CRL directory What configurable property controls the CRL revocation checking? Any answer will be greatly appreciated! Thanks, Usha Seshadri Lockheed Martin, IS&GS 301-240-7496 [LM-logo] -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.jpg Type: image/jpeg Size: 3520 bytes Desc: image004.jpg URL: From richardl at ufp.com Tue Jan 5 17:35:54 2016 From: richardl at ufp.com (Richard Levenberg) Date: Tue, 5 Jan 2016 09:35:54 -0800 Subject: CallbackHandler updates? Message-ID: <568BFEFA.9040005@ufp.com> Is there any work planned for the javax.security.auth.callback.* package and the provided com.sun.security.auth.callback.TextCallbackHandler? Specifically it would be nice if the readLine method were protected rather than private, and some thought went in to how to extend the class, perhaps unrolling the loop through the array of Callback's. r From sean.mullan at oracle.com Tue Jan 5 18:38:12 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 5 Jan 2016 13:38:12 -0500 Subject: Java security configuration to look at CRL for revocation checking In-Reply-To: <0F6322F01158F94EBDA664939D5EA15504F4663D@HVXDSP25.us.lmco.com> References: <0F6322F01158F94EBDA664939D5EA15504F4663D@HVXDSP25.us.lmco.com> Message-ID: <568C0D94.7050505@oracle.com> On 01/05/2016 12:28 PM, Seshadri, Usha wrote: > Hi, > > I am using Java 8, and am trying to configure JVM to go to CRL for > revocation checking.I didn?t see any parameter in java.security to > enable CRL revocation checking, although there are parameters to > configure OCSP. > > I tried setting these two parameters as JVM options with -D, but doesn?t > seem to take any effect. > > deployment.security.validation.crl= true > > deployment.security.validation.crl.url=file:///root/xyz/crls/ ?points to > the CRL directory These properties are not general JDK system properties. They are specifically used for revocation checking of certificates used when running signed applets via Java Plugin or WebStart. > What configurable property controls the CRL revocation checking? Any > answer will be greatly appreciated! It would be helpful to know what security APIs your application is using, as the JVM itself doesn't perform revocation checking. For example, if you are using JSSE, then setting the following system properties may help address your issue: com.sun.net.ssl.checkRevocation=true com.sun.security.enableCRLDP=true You can find more information and examples in the JSSE reference guide: http://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide.html Note that this list is not intended to be a general alias for questions about Java Security, so this question is somewhat off topic. There are various forums/websites that are probably more appropriate. Thanks, Sean > > Thanks, > > Usha Seshadri > > Lockheed Martin, IS&GS > > 301-240-7496 > > LM-logo > From weijun.wang at oracle.com Wed Jan 6 03:37:31 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 6 Jan 2016 11:37:31 +0800 Subject: CallbackHandler updates? In-Reply-To: <568BFEFA.9040005@ufp.com> References: <568BFEFA.9040005@ufp.com> Message-ID: <6F751418-777E-4A8E-90BB-E92742F86019@oracle.com> > On Jan 6, 2016, at 1:35 AM, Richard Levenberg wrote: > > Is there any work planned for the javax.security.auth.callback.* package > and the provided com.sun.security.auth.callback.TextCallbackHandler? No. > > Specifically it would be nice if the readLine method were protected > rather than private, and some thought went in to how to extend the > class, perhaps unrolling the loop through the array of Callback's. You are welcome to contribute any enhancement in this area. Please read the jdk9 change on this class first. Thanks Max > > r From david.holmes at oracle.com Wed Jan 6 04:20:05 2016 From: david.holmes at oracle.com (David Holmes) Date: Wed, 6 Jan 2016 14:20:05 +1000 Subject: RFR [9] 8145544: Move sun.misc.VM to jdk.internal.misc In-Reply-To: <568A7B7A.5060001@oracle.com> References: <568A7B7A.5060001@oracle.com> Message-ID: <568C95F5.4040101@oracle.com> Hi Chris, Hotspot comment change looks okay.:) I see a lot of hotspot tests that include @modules java.base/sun.misc but I don't understand why it is present in the few cases I looked at eg: hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java so not sure when it needs to be converted to jdk.internal.misc Thanks, David On 5/01/2016 12:02 AM, Chris Hegarty wrote: > sun.misc.VM provides a low-level interface for a small number > of specific operations with the VM. In preparation for JEP 260, > this class should be moved out of sun.misc and located in a > non-exported package [. > > http://cr.openjdk.java.net/~chegar/8145544/00/ > > Note: as in other areas some tests that require access to > internal APIs have been updated to use types from a more > stable package, sun.security.x509. > > -Chris. > > [1] https://bugs.openjdk.java.net/browse/JDK-8145544 From weijun.wang at oracle.com Wed Jan 6 05:05:03 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 6 Jan 2016 13:05:03 +0800 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: <568BFB99.8040900@oracle.com> References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> <568BFB99.8040900@oracle.com> Message-ID: > On Jan 6, 2016, at 1:21 AM, Sean Mullan wrote: > > Here are some more comments on the API. I will send some comments on the impl next. > > * DrbgParameters > > 38 * A DRBG mechanism should extend this class. > > Is this sentence necessary? None of the builtin DRBG mechs extend this class. I was wrong. > > 175 * If this method is not called, the implementation will select > 176 * a default {@code EntropyInput}. > > I think you need to be more specific about what you mean by "the implementation" (and in other methods of this class). It is not the implementation of this class, it is the DRBG SecureRandom implementations. OK. > > 236 * Requests that a derivation function to be used by the DRBG mechanism. > > s/to be used/is to be used/ > > 280 * @return teh newly built {@code DrbgParameters} object > > s/teh/the/ > > The get methods should state whether they can return null or not. Some of the methods should be more specific about whether they return or make copies of mutable parameters. OK. > > * SecureRandomSpi > > 67 protected SecureRandomSpi() { > > This seems like an incompatible change to me. The previous version had a default public constructor. I think this needs to be public. OK. > > 75 * This argument can be {@code null}. > > Why can't we call the SecureRandomSpi ctor that takes no args when the parameter is null? It seems it would be cleaner to do that, but there is probably a good reason. SecureRandom.getInstance("HashDRBG") will call new HashDrbg(null), which calls a series of super(null) until SecureRandomSpi. The @implSpec of the class has more details. I can revisit the change in Provider.java. Maybe the following will work: if (param == null) { findCtorWithNoArg().newInstance(); } else { findCtorWithArg(argClazz).newInstance(param); } > > 109 * @param bytes output. > > Too terse. How about "the array to be filled in with random bytes" OK. > > 110 * @param additionalInput additional input. {@code null} if none. > > I think you should throw NPE if this is null because callers should call engineNextBytes(byte[]) in that case. OK. I'll need to implement engineNextBytes(1,2) and engineNextBytes(1) in all implementations and probably let them call something like nextBytesInternal(). > > 110, 134: both of these methods need an @throws UnsupportedOperationException OK. > > 134 * @param additionalInput additional string, {@code null} if none. > > I think it would be better to add 2 engineReseed methods, one which takes no arguments and one with an additionalInput arg that throws NPE if it is null. This would also be consistent with the corresponding methods on SecureRandom. OK. > > * SecureRandom > > 68 * {@link SecureRandomParameters} parameter. For example, a DRBG > 69 * can be initialized with a {@link DrbgParameters} object. > > s/a DRBG/a DRBG implementation/ > > 87 *

Except for the one created by {@link #SecureRandom(byte[])}, a newly > > s/one/instance/ > > 88 * instantiated SecureRandom object is not seeded. Call one of {@code reseed} > 89 * or {@code setSeed} methods to seed it. If none is called, the first call > > s/Call one of/Call the/ > s/methods/method/ > s/If none/If neither method/ > > 92 * at instantiate time through a {@code SecureRandomParameters} object. > > s/instantiate/instantiation/ (or creation) > > 94 * This self-seeding will not occur if one of {@code reseed} or {@code setSeed} > 95 * methods was previously called. > > s/one of/the/ > s/methods/method/ > > 97 *

A SecureRandom can be reseeded at any time by calling one of the > > s/one of the/the/ > s/methods/method/ > > 883 * {@code additionalInput} may contain entropy but its main usage is to > 884 * provide diversity. > > s/entropy but/entropy, its/ OK. Thanks Max > > --Sean > > On 12/16/2015 02:20 AM, Wang Weijun wrote: >> Webrev updated: >> >> http://cr.openjdk.java.net/~weijun/8051408/webrev.02/ >> http://cr.openjdk.java.net/~weijun/8051408/webrev.02/specdiff/java/security/package-summary.html >> >> Changes: >> >> 1. DrbgParameters has a Builder now >> >> 2. No more default implementation for reseed() >> >> 3. Synchronization is now inside implementation, on engineXXX() methods >> >> 4. engineConfigure() now throws InvalidAlgorithmParameterException instead of IllegalArgumentException >> >> 5. CtrDRBG uses up all input in engineSetSeed() >> >> Thanks >> Max From weijun.wang at oracle.com Wed Jan 6 05:08:09 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 6 Jan 2016 13:08:09 +0800 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: <568BE8BE.8010508@oracle.com> References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> <568AF944.10904@oracle.com> <2EB14CF3-76B8-4237-A0BE-309A444581E5@oracle.com> <568BE8BE.8010508@oracle.com> Message-ID: > On Jan 6, 2016, at 12:01 AM, Sean Mullan wrote: > > If you think getFullEntropy is sufficient, then let's just keep the one method. I thought about this more and we can actually do /** * An interface of a source of entropy input. *

* This interface has 2 methods returning byte arrays containing entropy. * The result of {@link #getFullEntropy} contains full entropy and that of * {@link #getEntropy} contains the request amount of entropy but might not * be full. The default implementation of the methods inside this interface * are dependent on each other. An implementation must implement at least * one of them to be useful. * * @since 1.9 */ public interface EntropyInput { /** * Fills a byte array with full entropy. *

* This method might block and/or fail. * * @implSpec The default implementation calls {@link #getEntropy} * to return a byte array which might not have full entropy, and then * calls the hashdf conditioning function defined in NIST SP 800-90Ar1 * 10.3.1 to condense it into an array with full entropy. * * @param entropy the byte array with filled entropy. * @throws EntropyNotAvailableException if not enough entropy is available. */ default void getFullEntropy(byte[] entropy) { byte[] raw = getEntropy(entropy.length); if (raw.length != entropy.length) { try { MessageDigest md = MessageDigest.getInstance("SHA-256", "SUN"); raw = HashDrbg.hashDf(md, md.getDigestLength(), entropy.length, raw); } catch (Exception e) { throw new InternalError(e); } } System.arraycopy(raw, 0, entropy, 0, raw.length); } /** * Returns a byte array with at least length*8 bits of entropy. *

* This method might block and/or fail. * * @implSpec The default implementation calls {@link #getFullEntropy} * to return a byte array which has full entropy. * * @param length the minimum size of entropy requested in bytes * @return a byte array containing entropy * @throws EntropyNotAvailableException if not enough entropy is available. */ default byte[] getEntropy(int length) { byte[] result = new byte[length]; getFullEntropy(result); return result; } } From chris.hegarty at oracle.com Wed Jan 6 06:10:39 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Wed, 6 Jan 2016 06:10:39 +0000 Subject: RFR [9] 8145544: Move sun.misc.VM to jdk.internal.misc In-Reply-To: <568C95F5.4040101@oracle.com> References: <568A7B7A.5060001@oracle.com> <568C95F5.4040101@oracle.com> Message-ID: <42EE23DC-1CD2-4816-949A-0EC4875909F5@oracle.com> On 6 Jan 2016, at 04:20, David Holmes wrote: > Hi Chris, > > Hotspot comment change looks okay.:) Thanks David. > I see a lot of hotspot tests that include > > @modules java.base/sun.misc > > but I don't understand why it is present in the few cases I looked at eg: > > hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java The dependency on sun.misc is coming from the test library, specifically jdk.test.lib.Utils. Quite a few tests in the hotspot repo use the test library, so have this dependency ( on sun.misc.Unsafe ). > so not sure when it needs to be converted to jdk.internal.misc It is on my list to update these tests, see 8140608 [1]. I punted doing this with the Unsafe move, as I was unhappy with the test coverage of sun.misc.Unsafe. Paul has since added some additional tests [2] that have variants that cover both jdk.internal.misc.Unsafe and sun.misc.Unsafe, so I think the hotspot tests can now be updated to only use jdk.internal.misc. I?ll move 8140608 forward over the next few weeks. -Chris. [1] https://bugs.openjdk.java.net/browse/JDK-8140608 [2] http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/rev/d84bd22ab531 > Thanks, > David > > On 5/01/2016 12:02 AM, Chris Hegarty wrote: >> sun.misc.VM provides a low-level interface for a small number >> of specific operations with the VM. In preparation for JEP 260, >> this class should be moved out of sun.misc and located in a >> non-exported package [. >> >> http://cr.openjdk.java.net/~chegar/8145544/00/ >> >> Note: as in other areas some tests that require access to >> internal APIs have been updated to use types from a more >> stable package, sun.security.x509. >> >> -Chris. >> >> [1] https://bugs.openjdk.java.net/browse/JDK-8145544 From ecki at zusammenkunft.net Wed Jan 6 07:31:37 2016 From: ecki at zusammenkunft.net (ecki at zusammenkunft.net) Date: Wed, 6 Jan 2016 08:31:37 +0100 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> <568AF944.10904@oracle.com> <2EB14CF3-76B8-4237-A0BE-309A444581E5@oracle.com> <568BE8BE.8010508@oracle.com> Message-ID: Hello, is the Intention of the default implementation of getFullEntropy to expand a too short array with the DF as well (which is a dangerous thing to do IMHO) or is the conditional conditioning only to condense (aka shorten)? In that case you should maybe add an assert and make the if compare against bigger length only? (On the other hand I wonder why not simly discarding the bytes would be fine, too. I dont see an implementation providing excessive bytes anyway. Why not have a int fillEntropy (byte [] out, boolean partial (, int pos, int len)) methods instead? (This also avoids the need to exlain "full" as well as "get". When partial is false the method is guranteed to throw if not enough entropy is available and by not creating arrays it cannot create exceeding bytes. The default impl for the pos/len is to call fillEntropy(out, partial, 0, out.length). It might not be needed hoewever. Bernd -- http://bernd.eckenfels.net -----Original Message----- From: Wang Weijun To: Sean Mullan Cc: OpenJDK Dev list Sent: Mi., 06 Jan. 2016 6:19 Subject: Re: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations > On Jan 6, 2016, at 12:01 AM, Sean Mullan wrote: > > If you think getFullEntropy is sufficient, then let's just keep the one method. I thought about this more and we can actually do /** * An interface of a source of entropy input. *

* This interface has 2 methods returning byte arrays containing entropy. * The result of {@link #getFullEntropy} contains full entropy and that of * {@link #getEntropy} contains the request amount of entropy but might not * be full. The default implementation of the methods inside this interface * are dependent on each other. An implementation must implement at least * one of them to be useful. * * @since 1.9 */ public interface EntropyInput { /** * Fills a byte array with full entropy. *

* This method might block and/or fail. * * @implSpec The default implementation calls {@link #getEntropy} * to return a byte array which might not have full entropy, and then * calls the hashdf conditioning function defined in NIST SP 800-90Ar1 * 10.3.1 to condense it into an array with full entropy. * * @param entropy the byte array with filled entropy. * @throws EntropyNotAvailableException if not enough entropy is available. */ default void getFullEntropy(byte[] entropy) { byte[] raw = getEntropy(entropy.length); if (raw.length != entropy.length) { try { MessageDigest md = MessageDigest.getInstance("SHA-256", "SUN"); raw = HashDrbg.hashDf(md, md.getDigestLength(), entropy.length, raw); } catch (Exception e) { throw new InternalError(e); } } System.arraycopy(raw, 0, entropy, 0, raw.length); } /** * Returns a byte array with at least length*8 bits of entropy. *

* This method might block and/or fail. * * @implSpec The default implementation calls {@link #getFullEntropy} * to return a byte array which has full entropy. * * @param length the minimum size of entropy requested in bytes * @return a byte array containing entropy * @throws EntropyNotAvailableException if not enough entropy is available. */ default byte[] getEntropy(int length) { byte[] result = new byte[length]; getFullEntropy(result); return result; } } From weijun.wang at oracle.com Wed Jan 6 08:34:25 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 6 Jan 2016 16:34:25 +0800 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> <568AF944.10904@oracle.com> <2EB14CF3-76B8-4237-A0BE-309A444581E5@oracle.com> <568BE8BE.8010508@oracle.com> Message-ID: <79E62BC1-FAAF-437B-BD43-353813EC19E7@oracle.com> > On Jan 6, 2016, at 3:31 PM, ecki at zusammenkunft.net wrote: > > Hello, > > is the Intention of the default implementation of getFullEntropy to expand a too short array with the DF as well (which is a dangerous thing to do IMHO) or is the conditional conditioning only to condense (aka shorten)? Only shorten. Should check. > In that case you should maybe add an assert and make the if compare against bigger length only? (On the other hand I wonder why not simly discarding the bytes would be fine, too. I dont see an implementation providing excessive bytes anyway. Discard extra bytes? At least the current code is an approved conditioning function. > > Why not have a int fillEntropy (byte [] out, boolean partial (, int pos, int len)) methods instead? (This also avoids the need to exlain "full" as well as "get". So if partial is true, the method may return a value smaller than len? Is this really useful? Should the caller call it again and again until enough bytes are available? > > When partial is false the method is guranteed to throw if not enough entropy is available and by not creating arrays it cannot create exceeding bytes. > > The default impl for the pos/len is to call fillEntropy(out, partial, 0, out.length). It might not be needed however. These methods will prevent unnecessary System.arraycopy(). Will consider. Thanks Max > > Bernd > -- > http://bernd.eckenfels.net > > -----Original Message----- > From: Wang Weijun > To: Sean Mullan > Cc: OpenJDK Dev list > Sent: Mi., 06 Jan. 2016 6:19 > Subject: Re: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations > > >> On Jan 6, 2016, at 12:01 AM, Sean Mullan wrote: >> >> If you think getFullEntropy is sufficient, then let's just keep the one method. > > I thought about this more and we can actually do > > /** > * An interface of a source of entropy input. > *

> * This interface has 2 methods returning byte arrays containing entropy. > * The result of {@link #getFullEntropy} contains full entropy and that of > * {@link #getEntropy} contains the request amount of entropy but might not > * be full. The default implementation of the methods inside this interface > * are dependent on each other. An implementation must implement at least > * one of them to be useful. > * > * @since 1.9 > */ > public interface EntropyInput { > /** > * Fills a byte array with full entropy. > *

> * This method might block and/or fail. > * > * @implSpec The default implementation calls {@link #getEntropy} > * to return a byte array which might not have full entropy, and then > * calls the hashdf conditioning function defined in NIST SP 800-90Ar1 > * 10.3.1 to condense it into an array with full entropy. > * > * @param entropy the byte array with filled entropy. > * @throws EntropyNotAvailableException if not enough entropy is available. > */ > default void getFullEntropy(byte[] entropy) { > byte[] raw = getEntropy(entropy.length); > if (raw.length != entropy.length) { > try { > MessageDigest md = MessageDigest.getInstance("SHA-256", "SUN"); > raw = HashDrbg.hashDf(md, md.getDigestLength(), > entropy.length, raw); > } catch (Exception e) { > throw new InternalError(e); > } > } > System.arraycopy(raw, 0, entropy, 0, raw.length); > } > > /** > * Returns a byte array with at least length*8 bits of entropy. > *

> * This method might block and/or fail. > * > * @implSpec The default implementation calls {@link #getFullEntropy} > * to return a byte array which has full entropy. > * > * @param length the minimum size of entropy requested in bytes > * @return a byte array containing entropy > * @throws EntropyNotAvailableException if not enough entropy is available. > */ > default byte[] getEntropy(int length) { > byte[] result = new byte[length]; > getFullEntropy(result); > return result; > } > } From ecki at zusammenkunft.net Wed Jan 6 09:53:26 2016 From: ecki at zusammenkunft.net (ecki at zusammenkunft.net) Date: Wed, 6 Jan 2016 10:53:26 +0100 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: <79E62BC1-FAAF-437B-BD43-353813EC19E7@oracle.com> References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> <568AF944.10904@oracle.com> <2EB14CF3-76B8-4237-A0BE-309A444581E5@oracle.com> <568BE8BE.8010508@oracle.com> <79E62BC1-FAAF-437B-BD43-353813EC19E7@oracle.com> Message-ID: Hello, Wang Weijun : >> On Jan 6, 2016, at 3:31 PM, ecki at zusammenkunft.net wrote: >> is the Intention of the default implementation of getFullEntropy to expand a too short array with the DF as well (which is a dangerous thing to do IMHO) or is the conditional conditioning only to condense (aka shorten)? >Only shorten. Should check. >> In that case you should maybe add an assert and make the if compare against bigger length only? (On the other hand I wonder why not simly discarding the bytes would be fine, too. I dont see an implementation providing excessive bytes anyway. > Discard extra bytes? At least the current code is an approved conditioning function. I dont know what the reason for an entropy source to return more bytes than requested would be. For a framework it is hard to make the call if the entropy source is good (and a conditioning with possible limited internal state could make it worse). If you want to allow a entropy source to return more bytes because its internal accounting might estimate bad entropy, then calling the conditioning function would be aproperiate, but then the question is if this a good idea to design a API which expects weak entropy (but only implicite control of post-processing). >> Why not have a int fillEntropy (byte [] out, boolean partial (, int pos, int len)) methods instead? (This also avoids the need to exlain "full" as well as "get". > So if partial is true, the method may return a value smaller than len? Is this really useful? Should the caller call it again and again until enough bytes are available? Yes it is only useful if it is needed for stuff like timed background reseeding. It would probably not be used by the normal DRG codebase. Instead of using "partial" an alternative would be "blocking" or "timeout" parameters. Gruss Bernd From weijun.wang at oracle.com Wed Jan 6 12:40:40 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 6 Jan 2016 20:40:40 +0800 Subject: Design and impl review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> <566EE8C1.90700@oracle.com> <87F2B424-C68D-4166-89F1-1F010E1844AB@oracle.com> <567091F3.7000200@oracle.com> <10E6F8D0-F090-4944-889F-2E6A19771E24@oracle.com> <568AF944.10904@oracle.com> <2EB14CF3-76B8-4237-A0BE-309A444581E5@oracle.com> <568BE8BE.8010508@oracle.com> <79E62BC1-FAAF-437B-BD43-353813EC19E7@oracle.com> Message-ID: > On Jan 6, 2016, at 5:53 PM, ecki at zusammenkunft.net wrote: > > Hello, > > Wang Weijun : >>> On Jan 6, 2016, at 3:31 PM, ecki at zusammenkunft.net wrote: >>> is the Intention of the default implementation of getFullEntropy to expand a too short array with the DF as well (which is a dangerous thing to do IMHO) or is the conditional conditioning only to condense (aka shorten)? >> Only shorten. Should check. > >>> In that case you should maybe add an assert and make the if compare against bigger length only? (On the other hand I wonder why not simly discarding the bytes would be fine, too. I dont see an implementation providing excessive bytes anyway. >> Discard extra bytes? At least the current code is an approved conditioning function. > > I dont know what the reason for an entropy source to return more bytes than requested would be. For a framework it is hard to make the call if the entropy source is good (and a conditioning with possible limited internal state could make it worse). If you want to allow a entropy source to return more bytes because its internal accounting might estimate bad entropy, then calling the conditioning function would be aproperiate, but then the question is if this a good idea to design a API which expects weak entropy (but only implicite control of post-processing). I used to only have getFullEntropy(), but at every corner of SP 800-90A you can see the word min-entropy which seems to suggest that in the DRBG world an entropy source with weak entropy is quite a common thing and should be considered in API design. Also in the real world I believe there are cases where it's much more efficient to implement getEntropy() than getFullEntropy(). When getEntropy() is usable it should be preferred. > >>> Why not have a int fillEntropy (byte [] out, boolean partial (, int pos, int len)) methods instead? (This also avoids the need to exlain "full" as well as "get". >> So if partial is true, the method may return a value smaller than len? Is this really useful? Should the caller call it again and again until enough bytes are available? > > Yes it is only useful if it is needed for stuff like timed background reseeding. It would probably not be used by the normal DRG codebase. Instead of using "partial" an alternative would be "blocking" or "timeout" parameters. Sounds useful. This JEP is focused on DRBG and we only want to define an EntropyInput interface with very few methods. We can enhance it in another JEP in JDK 10. Thanks Max > > Gruss > Bernd From artem.smotrakov at oracle.com Wed Jan 6 20:39:02 2016 From: artem.smotrakov at oracle.com (Artem Smotrakov) Date: Wed, 6 Jan 2016 12:39:02 -0800 Subject: [9] RFR: 8144539: Update PKCS11 tests to run with security manager Message-ID: <568D7B66.8020203@oracle.com> Hello, Please review this enhancement for PKCS11 tests which updates them to run with both enabled and disable security manager. Tests enable a security manager before running actual test cases for each particular security provider, and disable it when the test cases finish. This helps to avoid granting lots of permissions because PKCS11Test class does some initialization which accesses some protected operations. There also are several updates: - tests run in a separate JVM since PKCS11Test class modifies system properties, adds and removes security providers (even if a security manager is not set) - added new policy files (some tests need a separate policy file since they require some extra permissions, but I wouldn't add them for all tests) - updated the code to use try-with-resources blocks where possible - replaced Vector with ArrayList since it doesn't seem to need synchronization - removed using internal sun.security.util.ECUtil class - some cosmetic changes I have run the updated tests on all supported generic platforms, they seem to work fine. Bug: https://bugs.openjdk.java.net/browse/JDK-8144539 Webrev: http://cr.openjdk.java.net/~asmotrak/8144539/webrev.01/ Artem From weijun.wang at oracle.com Thu Jan 7 12:33:20 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Thu, 7 Jan 2016 20:33:20 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> Message-ID: <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> An updated webrev http://cr.openjdk.java.net/~weijun/8058778/webrev.07/ http://cr.openjdk.java.net/~weijun/8058778/webrev.07/specdiff/java/security/cert/package-summary.html with more changes: 1. Certificate.Builder and X509Certificate.Builder are now interfaces 2. Implementation is in a provider through CertificateFactory.getCertificateBuilder 3. New class CertificateRequest and PKCS10CertificateRequest, and CertificateFactory#generateCertificateRequest 4. New class X509Certificate.GeneralName 5. X509Certificate.Builder#setSigAlg(Name|OID|Params) 6. X509Certificate.Builder#serialNumber Thanks Max > On Dec 16, 2015, at 10:26 AM, Wang Weijun wrote: > > Hi All > > Here is an updated webrev > > http://cr.openjdk.java.net/~weijun/8058778/webrev.05/ > > Spec change is at > > http://cr.openjdk.java.net/~weijun/8058778/webrev.05/specdiff/java/security/cert/package-summary.html > > These changes are made: > > 1. The Builder is moved into java.security.cert.X509Certificate as an inner class > > 2. There is no more addExtension(String,String,boolean) that tries to parse input value strings (leave them to keytool). Each supported extension has its own addXXXExtension() method in java.security.cert.X509Extension. The input format is the same as the output format of X509Certificate.getXXX() for each extension type. This relieves the requirement to define interfaces for GeneralNames etc at the moment. > > 3. keytool directly calls X509Certificate.Builder now. > > No CertificateRequest at the moment. Builder still using byte[] which is PKCS #10 encoded. > > Many thanks to Mandy, Larry, and Sean for your comments. Mike, we will add more methods later when they are needed. > > --Max > >> On Dec 15, 2015, at 11:53 PM, Sean Mullan wrote: >> >> On 12/03/2015 09:07 PM, Wang Weijun wrote: >>> Or if this is too much, we can at least do the X509Extension part. If >>> CertificateRequest is needed one day, we can create a new method >>> Builder.certificateRequest() that returns it and deprecate the >>> current request() method. >>> >>> Or use certificateRequest() to return byte[] and save request() for >>> the future. :-) >> >> I agree with this approach. I like the idea of moving the creation of Extensions to X509Extension so that they could be used independently of the X509Certificate.Builder API. Let's defer a CertificateRequest API for later. >> >> --Sean > From sean.mullan at oracle.com Thu Jan 7 22:06:08 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Thu, 7 Jan 2016 17:06:08 -0500 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> Message-ID: <568EE150.10406@oracle.com> This is looking really nice. Here are some comments on the API portion, will review the impl later ... * Certificate 315 * can provider more builder methods. s/provider/provide/ 329 * Builds a certificate by signing a request. Technically, this signs the certificate, not the request, so I think this should say: "Builds a certificate from a request and signs it with the issuer's key." 343 * Builds a certificate request of the specified type. This also signs the request, so I think it is important to say that, ex: "Builds and signs a certificate request of the specified type." * CertificateFactory 44 * their encodings. A factory can also be used to build a certificate request I would probably reword this: "A factory can also return a certificate builder that can create certificates and certificate requests." 105 * (if {@link #generateCertificateRequest} and {@link #getCertificateBuilder} 106 * are implemented): I think you can remove these lines. 407 public final Certificate.Builder getCertificateBuilder() { Should this be or something like that? * CertificateFactorySpi Need more details on how inStream is parsed. Missing an @implSpec on engineGenerateCertificateRequest * X509Certificate 657 * A builder that builds X.509 v3 certificates and certificate requests. Why only v3? I think we need to allow this to support other versions, if there ever are any. 673 * Implementations of {@link #buildCertificateRequest} and various 674 * overloaded {@code #buildCertificate} must support the 675 * {@link PKCS10CertificateRequest} type. I don't think we should mandate this for every impl, only SE implementations. I would remove this. 756 * SHA384withECDSA for a 384-bit EC key. TODO: return OID? TODO needs to be addressed. 772 String getDefaultSigAlgName(PrivateKey key); This seems like it should just be a static utility method, and not something every subclass has to implement. 1064 public static class GeneralName { This should be a standalone class, since we may leverage it in other APIs that are not X509Certificate specific. 1075 public int getType() { Should this be an Enum? * CertificateRequest 58 private int hash = -1; // Default to -1 should be volatile. 64 * See the CertificateFactory section in the There should be a new section for CR encodings like there is one for CertPath encodings. * PKCS10CertificateRequest Methods should state whether they return or create new copies/clones. 105 * @exception CertificateEncodingException if an encoding error occurs. Use @throws. Also, do we really need to throw this exception? When wouldn't we be able to create a valid encoding? --Sean On 01/07/2016 07:33 AM, Wang Weijun wrote: > An updated webrev > > http://cr.openjdk.java.net/~weijun/8058778/webrev.07/ > http://cr.openjdk.java.net/~weijun/8058778/webrev.07/specdiff/java/security/cert/package-summary.html > > with more changes: > > 1. Certificate.Builder and X509Certificate.Builder are now interfaces > > 2. Implementation is in a provider through CertificateFactory.getCertificateBuilder > > 3. New class CertificateRequest and PKCS10CertificateRequest, and CertificateFactory#generateCertificateRequest > > 4. New class X509Certificate.GeneralName > > 5. X509Certificate.Builder#setSigAlg(Name|OID|Params) > > 6. X509Certificate.Builder#serialNumber > > Thanks > Max > > >> On Dec 16, 2015, at 10:26 AM, Wang Weijun wrote: >> >> Hi All >> >> Here is an updated webrev >> >> http://cr.openjdk.java.net/~weijun/8058778/webrev.05/ >> >> Spec change is at >> >> http://cr.openjdk.java.net/~weijun/8058778/webrev.05/specdiff/java/security/cert/package-summary.html >> >> These changes are made: >> >> 1. The Builder is moved into java.security.cert.X509Certificate as an inner class >> >> 2. There is no more addExtension(String,String,boolean) that tries to parse input value strings (leave them to keytool). Each supported extension has its own addXXXExtension() method in java.security.cert.X509Extension. The input format is the same as the output format of X509Certificate.getXXX() for each extension type. This relieves the requirement to define interfaces for GeneralNames etc at the moment. >> >> 3. keytool directly calls X509Certificate.Builder now. >> >> No CertificateRequest at the moment. Builder still using byte[] which is PKCS #10 encoded. >> >> Many thanks to Mandy, Larry, and Sean for your comments. Mike, we will add more methods later when they are needed. >> >> --Max >> >>> On Dec 15, 2015, at 11:53 PM, Sean Mullan wrote: >>> >>> On 12/03/2015 09:07 PM, Wang Weijun wrote: >>>> Or if this is too much, we can at least do the X509Extension part. If >>>> CertificateRequest is needed one day, we can create a new method >>>> Builder.certificateRequest() that returns it and deprecate the >>>> current request() method. >>>> >>>> Or use certificateRequest() to return byte[] and save request() for >>>> the future. :-) >>> >>> I agree with this approach. I like the idea of moving the creation of Extensions to X509Extension so that they could be used independently of the X509Certificate.Builder API. Let's defer a CertificateRequest API for later. >>> >>> --Sean >> > From weijun.wang at oracle.com Fri Jan 8 03:38:58 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Fri, 8 Jan 2016 11:38:58 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <568EE150.10406@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> Message-ID: <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> > On Jan 8, 2016, at 6:06 AM, Sean Mullan wrote: > > This is looking really nice. Here are some comments on the API portion, will review the impl later ... > > 407 public final Certificate.Builder getCertificateBuilder() { > > Should this be or something like that? I can write it into > to avoid a warning. But it still seems incomplete because it does not show that the 1st ? should be the same as the 3rd one. I'll do some experiment with a simple program. Might need to ask langtools. > > * CertificateFactorySpi > > Need more details on how inStream is parsed. I thought a "@see CertificateFactory#generateCertificateRequest" is enough. I do noticed that CertificateFactorySpi#engineGenerateCertificate copies all spec from CertificateFactory#generateCertificate. > > * X509Certificate > > 657 * A builder that builds X.509 v3 certificates and certificate requests. > > Why only v3? I think we need to allow this to support other versions, if there ever are any. IMO no one wants v1 or v2 now. Or are you thinking of a future version? That said, I can add a version(Enum) method. If it's v1 or v2 extensions will be ignored, if >3, UOE. > > 673 * Implementations of {@link #buildCertificateRequest} and various > 674 * overloaded {@code #buildCertificate} must support the > 675 * {@link PKCS10CertificateRequest} type. > > I don't think we should mandate this for every impl, only SE implementations. I would remove this. > > 756 * SHA384withECDSA for a 384-bit EC key. TODO: return OID? > > TODO needs to be addressed. We know the OID is more precise than the Name, and it's the actual value encoded in a cert, therefore I wondered if we should instead make a getDefaultSigAlgOId(). My opinion now is to keep using getDefaultSigAlgName(). As long as a name is a standard one, it is equivalent to an OID and more people understand it. So, just remove the TODO words. > > 772 String getDefaultSigAlgName(PrivateKey key); > > This seems like it should just be a static utility method, and not something every subclass has to implement. But only the provider (X509Factory here) knows about the return values, and another provider can return different values. > > 1064 public static class GeneralName { > > This should be a standalone class, since we may leverage it in other APIs that are not X509Certificate specific. Honestly the current GeneralName is not quite useful. It is only used as a *parameter* in building certificates. A real GeneralName needs getEncoded(). Or, we can do it like interface GeneralName { byte[] getEncoded(); } class X509Certificate.Builder { GeneralName newGeneralName(int/Enum type, String svalue); GeneralName newGeneralName(int/Enum type, byte[] value); } > > 1075 public int getType() { > > Should this be an Enum? Yes. > > * PKCS10CertificateRequest > > Methods should state whether they return or create new copies/clones. > > 105 * @exception CertificateEncodingException if an encoding error occurs. > > Use @throws. Also, do we really need to throw this exception? When wouldn't we be able to create a valid encoding? Aha, I copied most from X509Certificate, where getTBSCertificate() throws such an exception. In a public API view, you can only create a Certificate from CertificateFactory#generateCertificate, therefore the cert is always encoded and signed. But we do have X509CertImpl that extends X509Certificate that can be unfilled, unsigned and unencoded, and looks like this is the reason that getTBSCertificate() and getEncoded() could throw an exception. The PKCS10 class has the same problem. I consider this not a feature but a bug. Every public available Certificate and CertificateRequest objects should be encoded and signed and immutable. I'll remove that exception from getCertificationRequestInfo(). We need to make sure that unsigned and unencoded Certificate or CertificateRequest should never be revealed to an application. Thanks Max > > --Sean > > On 01/07/2016 07:33 AM, Wang Weijun wrote: >> An updated webrev >> >> http://cr.openjdk.java.net/~weijun/8058778/webrev.07/ >> http://cr.openjdk.java.net/~weijun/8058778/webrev.07/specdiff/java/security/cert/package-summary.html From bhanu.prakash.gopularam at oracle.com Fri Jan 8 07:54:22 2016 From: bhanu.prakash.gopularam at oracle.com (Bhanu Gopularam) Date: Thu, 7 Jan 2016 23:54:22 -0800 (PST) Subject: RFR: 8133085- Remove old style (pre-JDK 1.4) "new SunJCE()" provider calls in tests. Fails to compile. In-Reply-To: <0ed013aa-b95a-4db8-9bd3-db3274d3de0f@default> References: <0ed013aa-b95a-4db8-9bd3-db3274d3de0f@default> Message-ID: Hi all, Please review a fix for following bug: Bug Id - https://bugs.openjdk.java.net/browse/JDK-8133085 Issue - Some security regression tests are directly instantiating the security providers instead of using the registered providers. Most of the cases the issue can be corrected by using registered security providers which are available during execution and instance need not be created. Solution - Refactored tests which are directly instantiating the security provider to use the registered ones. Fixes also include couple of tests which run on Solaris environment. ->sun/security/pkcs11/fips/TrustManagerTest.java ->sun/security/pkcs11/fips/ClientJSSEServerJSSE.java Webrev - http://cr.openjdk.java.net/~ntv/bhanu/8133085/webrev/ Thanks, Bhanu -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.mullan at oracle.com Fri Jan 8 16:34:42 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Fri, 8 Jan 2016 11:34:42 -0500 Subject: RFR: 8133085- Remove old style (pre-JDK 1.4) "new SunJCE()" provider calls in tests. Fails to compile. In-Reply-To: References: <0ed013aa-b95a-4db8-9bd3-db3274d3de0f@default> Message-ID: <568FE522.1080905@oracle.com> Please update copyrights to include 2016. Otherwise, looks fine to me. --Sean On 01/08/2016 02:54 AM, Bhanu Gopularam wrote: > Hi all, > > Please review a fix for following bug: > > Bug Id -https://bugs.openjdk.java.net/browse/JDK-8133085 > > Issue ? Some security regression tests are directly instantiating the > security providers instead of using the registered providers. Most of > the cases the issue can be corrected by using registered security > providers which are available during execution and instance need not be > created. > > Solution ? Refactored tests which are directly instantiating the > security provider to use the registered ones. Fixes also include couple > of tests which run on Solaris environment. > > ->sun/security/pkcs11/fips/TrustManagerTest.java > > ->sun/security/pkcs11/fips/ClientJSSEServerJSSE.java > > Webrev - http://cr.openjdk.java.net/~ntv/bhanu/8133085/webrev/ > > Thanks, > > Bhanu > From bradford.wetmore at oracle.com Fri Jan 8 19:01:27 2016 From: bradford.wetmore at oracle.com (Bradford Wetmore) Date: Fri, 8 Jan 2016 11:01:27 -0800 Subject: RFR: 8133085- Remove old style (pre-JDK 1.4) "new SunJCE()" provider calls in tests. Fails to compile. In-Reply-To: <568FE522.1080905@oracle.com> References: <0ed013aa-b95a-4db8-9bd3-db3274d3de0f@default> <568FE522.1080905@oracle.com> Message-ID: <56900787.9000309@oracle.com> (Xuelei, see below) Bhanu, The proposed ClientJSSEServerJSSE.java/TrustManagerTest.java changes are incorrect. These tests are setting JSSE into FIPS mode, so this test should be correct as is. Brad On 1/8/2016 8:34 AM, Sean Mullan wrote: > Please update copyrights to include 2016. Otherwise, looks fine to me. > > --Sean > > On 01/08/2016 02:54 AM, Bhanu Gopularam wrote: >> Hi all, >> >> Please review a fix for following bug: >> >> Bug Id -https://bugs.openjdk.java.net/browse/JDK-8133085 >> >> Issue ? Some security regression tests are directly instantiating the >> security providers instead of using the registered providers. Most of >> the cases the issue can be corrected by using registered security >> providers which are available during execution and instance need not be >> created. >> >> Solution ? Refactored tests which are directly instantiating the >> security provider to use the registered ones. Fixes also include couple >> of tests which run on Solaris environment. >> >> ->sun/security/pkcs11/fips/TrustManagerTest.java >> >> ->sun/security/pkcs11/fips/ClientJSSEServerJSSE.java >> >> Webrev - http://cr.openjdk.java.net/~ntv/bhanu/8133085/webrev/ >> >> Thanks, >> >> Bhanu >> From sean.mullan at oracle.com Fri Jan 8 20:06:52 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Fri, 8 Jan 2016 15:06:52 -0500 Subject: RFR: 8085903: New fix for memory leak in ProtectionDomain cache Message-ID: <569016DC.1050107@oracle.com> Please review this fix for a memory leak in the ProtectionDomain cache (which maps each ProtectionDomain to their granted PermissionCollection). The memory leak only occurs if custom permissions are used in a policy file. http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.00/ Custom permissions cause a chain of strong references that link back to the ProtectionDomain key used in the map, preventing it from being removed (and also preventing the custom permission's URLClassLoader from being garbage collected). This fix wraps the PermissionCollection in a SoftReference which allows the objects to be garbage collected in response to memory demand. Thanks, Sean From sean.mullan at oracle.com Fri Jan 8 20:40:46 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Fri, 8 Jan 2016 15:40:46 -0500 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> Message-ID: <56901ECE.3060009@oracle.com> On 01/07/2016 10:38 PM, Wang Weijun wrote: > >> On Jan 8, 2016, at 6:06 AM, Sean Mullan >> wrote: >> * CertificateFactorySpi >> >> Need more details on how inStream is parsed. > > I thought a "@see CertificateFactory#generateCertificateRequest" is > enough. I do noticed that > CertificateFactorySpi#engineGenerateCertificate copies all spec from > CertificateFactory#generateCertificate. I think if you specifically linked to that from the method description it would be sufficient, ex: "For details on how inStream is parsed, see ...", but an @see on its own is more like an FYI and does not imply that it is part of the specification. >> * X509Certificate >> >> 657 * A builder that builds X.509 v3 certificates and >> certificate requests. >> >> Why only v3? I think we need to allow this to support other >> versions, if there ever are any. > > IMO no one wants v1 or v2 now. Or are you thinking of a future > version? Yes. > That said, I can add a version(Enum) method. If it's v1 or v2 > extensions will be ignored, if >3, UOE. Actually maybe just keep it simple for now and assume v3 is the default. We can always add this method later if necessary. >> >> 772 String getDefaultSigAlgName(PrivateKey key); >> >> This seems like it should just be a static utility method, and not >> something every subclass has to implement. > > But only the provider (X509Factory here) knows about the return > values, and another provider can return different values. Can you remind me why this needs to be a public method? Why can't this be an implementation detail when the caller doesn't specify a signature algorithm? >> 1064 public static class GeneralName { >> >> This should be a standalone class, since we may leverage it in >> other APIs that are not X509Certificate specific. > > Honestly the current GeneralName is not quite useful. It is only used > as a *parameter* in building certificates. A real GeneralName needs > getEncoded(). If we are going to add this class, I think it should be generally useful. > Or, we can do it like > > interface GeneralName { byte[] getEncoded(); } and an enum for the type and a getType method? > > class X509Certificate.Builder { GeneralName newGeneralName(int/Enum > type, String svalue); GeneralName newGeneralName(int/Enum type, > byte[] value); } Ok. --Sean From xuelei.fan at oracle.com Sat Jan 9 00:44:03 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Sat, 9 Jan 2016 08:44:03 +0800 Subject: Code Review Request JDK-8146725 Issues with SignatureAndHashAlgorithm.getSupportedAlgorithms Message-ID: <569057D3.7050905@oracle.com> Hi, Please review this simple fix for JDK-8146725. In the SignatureAndHashAlgorithm.getSupportedAlgorithms() method, there is a synchronization block on a static final collection, priorityMap. The priorityMap would not get update any more after the instantiation. The synchronization is not actually necessary. See the attack diff for the fix. No new regression test. Thanks, Xuelei -------------- next part -------------- --- a/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java +++ b/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java @@ -153,13 +153,11 @@ getSupportedAlgorithms(AlgorithmConstraints constraints) { Collection supported = new ArrayList<>(); - synchronized (priorityMap) { - for (SignatureAndHashAlgorithm sigAlg : priorityMap.values()) { - if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM && - constraints.permits(SIGNATURE_PRIMITIVE_SET, - sigAlg.algorithm, null)) { - supported.add(sigAlg); - } + for (SignatureAndHashAlgorithm sigAlg : priorityMap.values()) { + if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM && + constraints.permits(SIGNATURE_PRIMITIVE_SET, + sigAlg.algorithm, null)) { + supported.add(sigAlg); } } From weijun.wang at oracle.com Sat Jan 9 00:49:52 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Sat, 9 Jan 2016 08:49:52 +0800 Subject: Code Review Request JDK-8146725 Issues with SignatureAndHashAlgorithm.getSupportedAlgorithms In-Reply-To: <569057D3.7050905@oracle.com> References: <569057D3.7050905@oracle.com> Message-ID: Looks fine. Thanks Max > On Jan 9, 2016, at 8:44 AM, Xuelei Fan wrote: > > Hi, > > Please review this simple fix for JDK-8146725. > > In the SignatureAndHashAlgorithm.getSupportedAlgorithms() method, there > is a synchronization block on a static final collection, priorityMap. > The priorityMap would not get update any more after the instantiation. > The synchronization is not actually necessary. > > See the attack diff for the fix. No new regression test. > > Thanks, > Xuelei > From weijun.wang at oracle.com Sat Jan 9 00:57:36 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Sat, 9 Jan 2016 08:57:36 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <56901ECE.3060009@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> Message-ID: > On Jan 9, 2016, at 4:40 AM, Sean Mullan wrote: > > On 01/07/2016 10:38 PM, Wang Weijun wrote: >> >>> On Jan 8, 2016, at 6:06 AM, Sean Mullan >>> wrote: > >>> * CertificateFactorySpi >>> >>> Need more details on how inStream is parsed. >> >> I thought a "@see CertificateFactory#generateCertificateRequest" is >> enough. I do noticed that >> CertificateFactorySpi#engineGenerateCertificate copies all spec from >> CertificateFactory#generateCertificate. > > I think if you specifically linked to that from the method description it would be sufficient, ex: "For details on how inStream is parsed, see ...", but an @see on its own is more like an FYI and does not imply that it is part of the specification. I'll copy the text then, same with generateCertificate(). > >>> >>> 772 String getDefaultSigAlgName(PrivateKey key); >>> >>> This seems like it should just be a static utility method, and not >>> something every subclass has to implement. >> >> But only the provider (X509Factory here) knows about the return >> values, and another provider can return different values. > > Can you remind me why this needs to be a public method? Why can't this be an implementation detail when the caller doesn't specify a signature algorithm? It allows a caller (maybe a GUI tool) to know what default values are. > ful. > >> Or, we can do it like >> >> interface GeneralName { byte[] getEncoded(); } > > and an enum for the type and a getType method? enum will be here. getType() is useful but not necessary. Thanks Max > >> >> class X509Certificate.Builder { GeneralName newGeneralName(int/Enum >> type, String svalue); GeneralName newGeneralName(int/Enum type, >> byte[] value); } > > Ok. > > --Sean From bradford.wetmore at oracle.com Sat Jan 9 01:25:48 2016 From: bradford.wetmore at oracle.com (Bradford Wetmore) Date: Fri, 8 Jan 2016 17:25:48 -0800 Subject: Code Review Request JDK-8146725 Issues with SignatureAndHashAlgorithm.getSupportedAlgorithms In-Reply-To: <569057D3.7050905@oracle.com> References: <569057D3.7050905@oracle.com> Message-ID: <5690619C.1020206@oracle.com> Looks good. brad On 1/8/2016 4:44 PM, Xuelei Fan wrote: > Hi, > > Please review this simple fix for JDK-8146725. > > In the SignatureAndHashAlgorithm.getSupportedAlgorithms() method, there > is a synchronization block on a static final collection, priorityMap. > The priorityMap would not get update any more after the instantiation. > The synchronization is not actually necessary. > > See the attack diff for the fix. No new regression test. > > Thanks, > Xuelei > From xuelei.fan at oracle.com Sat Jan 9 11:06:50 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Sat, 9 Jan 2016 19:06:50 +0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out Message-ID: <5690E9CA.9030403@oracle.com> Hi, Please review a test update for JDK-8146387: http://cr.openjdk.java.net/~xuelei/8146387/webrev.00/ In the test case, javax/net/ssl/SSLSession/SessionCacheSizeTests.java, an integer (createdPorts) is used to count the server sockets. Every server socket is created in a new thread. The access and update to createdPorts should be synchronized for multiple threading safe. Thanks, Xuelei From joe.darcy at oracle.com Sun Jan 10 20:54:48 2016 From: joe.darcy at oracle.com (joe darcy) Date: Sun, 10 Jan 2016 12:54:48 -0800 Subject: JDK 9 RFR of JDK-8146745: Problem list SessionCacheSizeTests.java Message-ID: <5692C518.4050607@oracle.com> Hello, The test javax/net/ssl/SSLSession/SessionCacheSizeTests.java has been failing intermittently with high-frequency on Solaris and Windows of late. The test should be problem listed until the underlying problem is fixed (JDK-8146387). Patch to do this below. Thanks, -Joe diff -r aa9fd2797b82 test/ProblemList.txt --- a/test/ProblemList.txt Sun Jan 10 11:09:31 2016 -0800 +++ b/test/ProblemList.txt Sun Jan 10 12:53:16 2016 -0800 @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2016, 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 @@ -299,6 +299,9 @@ # 8074580 sun/security/pkcs11/rsa/TestKeyPairGenerator.java generic-all +# 8146387 +javax/net/ssl/SSLSession/SessionCacheSizeTests.java windows-all,solaris-all + ############################################################################ # jdk_sound diff -r aa9fd2797b82 test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java --- a/test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java Sun Jan 10 11:09:31 2016 -0800 +++ b/test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java Sun Jan 10 12:53:16 2016 -0800 @@ -31,6 +31,7 @@ * @bug 4366807 * @summary Need new APIs to get/set session timeout and session cache size. * @run main/othervm SessionCacheSizeTests + * @key intermittent */ import java.io.*; From xuelei.fan at oracle.com Mon Jan 11 00:11:10 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Mon, 11 Jan 2016 08:11:10 +0800 Subject: JDK 9 RFR of JDK-8146745: Problem list SessionCacheSizeTests.java In-Reply-To: <5692C518.4050607@oracle.com> References: <5692C518.4050607@oracle.com> Message-ID: <5692F31E.9000703@oracle.com> Looks fine to me. BTW, the fix for JDK-8146387 is asking for code review. http://mail.openjdk.java.net/pipermail/security-dev/2016-January/013301.html Thanks, Xuelei On 1/11/2016 4:54 AM, joe darcy wrote: > Hello, > > The test > > javax/net/ssl/SSLSession/SessionCacheSizeTests.java > > has been failing intermittently with high-frequency on Solaris and > Windows of late. The test should be problem listed until the underlying > problem is fixed (JDK-8146387). > > Patch to do this below. > > Thanks, > > -Joe > > diff -r aa9fd2797b82 test/ProblemList.txt > --- a/test/ProblemList.txt Sun Jan 10 11:09:31 2016 -0800 > +++ b/test/ProblemList.txt Sun Jan 10 12:53:16 2016 -0800 > @@ -1,6 +1,6 @@ > ########################################################################### > > # > -# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights > reserved. > +# Copyright (c) 2009, 2016, 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 > @@ -299,6 +299,9 @@ > # 8074580 > sun/security/pkcs11/rsa/TestKeyPairGenerator.java generic-all > > +# 8146387 > +javax/net/ssl/SSLSession/SessionCacheSizeTests.java > windows-all,solaris-all > + > ############################################################################ > > > # jdk_sound > diff -r aa9fd2797b82 > test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java > --- a/test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java Sun Jan > 10 11:09:31 2016 -0800 > +++ b/test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java Sun Jan > 10 12:53:16 2016 -0800 > @@ -31,6 +31,7 @@ > * @bug 4366807 > * @summary Need new APIs to get/set session timeout and session cache > size. > * @run main/othervm SessionCacheSizeTests > + * @key intermittent > */ > > import java.io.*; > > From joe.darcy at oracle.com Mon Jan 11 02:50:13 2016 From: joe.darcy at oracle.com (joe darcy) Date: Sun, 10 Jan 2016 18:50:13 -0800 Subject: JDK 9 RFR of JDK-8146745: Problem list SessionCacheSizeTests.java In-Reply-To: <5692F31E.9000703@oracle.com> References: <5692C518.4050607@oracle.com> <5692F31E.9000703@oracle.com> Message-ID: <56931865.2010709@oracle.com> Hi Xuelei, I'm not a concurrency expert, but I don't think it is proper to only synchronize on the writing of a data structure -- the reading should be synchronized too. Have you reproduced the failure with the code and seen the failure go away with the new code? Is there a hypothesis on why the failure started to happen recently when the test doesn't seem to have been modified? As a code review comment, I recommend in the doServerSide method using a try-with-resources statement to manage the sslServerSocket variable. For a larger refactoring, is an array with a separate createdPorts count the best data structure to use here? Thanks, -Joe On 1/10/2016 4:11 PM, Xuelei Fan wrote: > Looks fine to me. > > BTW, the fix for JDK-8146387 is asking for code review. > > http://mail.openjdk.java.net/pipermail/security-dev/2016-January/013301.html > > Thanks, > Xuelei > > On 1/11/2016 4:54 AM, joe darcy wrote: >> Hello, >> >> The test >> >> javax/net/ssl/SSLSession/SessionCacheSizeTests.java >> >> has been failing intermittently with high-frequency on Solaris and >> Windows of late. The test should be problem listed until the underlying >> problem is fixed (JDK-8146387). >> >> Patch to do this below. >> >> Thanks, >> >> -Joe >> >> diff -r aa9fd2797b82 test/ProblemList.txt >> --- a/test/ProblemList.txt Sun Jan 10 11:09:31 2016 -0800 >> +++ b/test/ProblemList.txt Sun Jan 10 12:53:16 2016 -0800 >> @@ -1,6 +1,6 @@ >> ########################################################################### >> >> # >> -# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights >> reserved. >> +# Copyright (c) 2009, 2016, 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 >> @@ -299,6 +299,9 @@ >> # 8074580 >> sun/security/pkcs11/rsa/TestKeyPairGenerator.java generic-all >> >> +# 8146387 >> +javax/net/ssl/SSLSession/SessionCacheSizeTests.java >> windows-all,solaris-all >> + >> ############################################################################ >> >> >> # jdk_sound >> diff -r aa9fd2797b82 >> test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java >> --- a/test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java Sun Jan >> 10 11:09:31 2016 -0800 >> +++ b/test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java Sun Jan >> 10 12:53:16 2016 -0800 >> @@ -31,6 +31,7 @@ >> * @bug 4366807 >> * @summary Need new APIs to get/set session timeout and session cache >> size. >> * @run main/othervm SessionCacheSizeTests >> + * @key intermittent >> */ >> >> import java.io.*; >> >> From xuelei.fan at oracle.com Mon Jan 11 03:58:35 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Mon, 11 Jan 2016 11:58:35 +0800 Subject: JDK 9 RFR of JDK-8146745: Problem list SessionCacheSizeTests.java In-Reply-To: <56931865.2010709@oracle.com> References: <5692C518.4050607@oracle.com> <5692F31E.9000703@oracle.com> <56931865.2010709@oracle.com> Message-ID: <5693286B.40607@oracle.com> On 1/11/2016 10:50 AM, joe darcy wrote: > Hi Xuelei, > > I'm not a concurrency expert, but I don't think it is proper to only > synchronize on the writing of a data structure -- the reading should be > synchronized too. > Yes. The fix considered the reading side too. The reading of the serverPorts will not happen unless the write side finished. The behavior is controlled by the "serverReady" variable. Therefore, it is OK to synchronize the write side of serverPorts in the test case. The problem is mainly about the updated of the counter variable createdPorts. Both the reading and writing sides are synchronized in the same block. > Have you reproduced the failure with the code and seen the failure go > away with the new code? Is there a hypothesis on why the failure started > to happen recently when the test doesn't seem to have been modified? > It used to failure intermittent. But I cannot find the root cause in the past. So a socket accept timeout was added in order to find the underlying issues of the intermittent failure. The socket accept timeout would increase the frequency of the failure. And it did help to expose the root cause of the failure. > As a code review comment, I recommend in the doServerSide method using a > try-with-resources statement to manage the sslServerSocket variable. > It's a better style. I will make the update. > For a larger refactoring, is an array with a separate createdPorts count > the best data structure to use here? > It could be more clear, I think. But need too much refactoring, and may introduce new synchronization requirement. I will like to try this simple update at first, and see what happens. Thanks, Xuelei > Thanks, > > -Joe > > On 1/10/2016 4:11 PM, Xuelei Fan wrote: >> Looks fine to me. >> >> BTW, the fix for JDK-8146387 is asking for code review. >> >> http://mail.openjdk.java.net/pipermail/security-dev/2016-January/013301.html >> >> >> Thanks, >> Xuelei >> >> On 1/11/2016 4:54 AM, joe darcy wrote: >>> Hello, >>> >>> The test >>> >>> javax/net/ssl/SSLSession/SessionCacheSizeTests.java >>> >>> has been failing intermittently with high-frequency on Solaris and >>> Windows of late. The test should be problem listed until the underlying >>> problem is fixed (JDK-8146387). >>> >>> Patch to do this below. >>> >>> Thanks, >>> >>> -Joe >>> >>> diff -r aa9fd2797b82 test/ProblemList.txt >>> --- a/test/ProblemList.txt Sun Jan 10 11:09:31 2016 -0800 >>> +++ b/test/ProblemList.txt Sun Jan 10 12:53:16 2016 -0800 >>> @@ -1,6 +1,6 @@ >>> >>> ########################################################################### >>> >>> >>> # >>> -# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights >>> reserved. >>> +# Copyright (c) 2009, 2016, 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 >>> @@ -299,6 +299,9 @@ >>> # 8074580 >>> sun/security/pkcs11/rsa/TestKeyPairGenerator.java generic-all >>> >>> +# 8146387 >>> +javax/net/ssl/SSLSession/SessionCacheSizeTests.java >>> windows-all,solaris-all >>> + >>> >>> ############################################################################ >>> >>> >>> >>> # jdk_sound >>> diff -r aa9fd2797b82 >>> test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java >>> --- a/test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java Sun Jan >>> 10 11:09:31 2016 -0800 >>> +++ b/test/javax/net/ssl/SSLSession/SessionCacheSizeTests.java Sun Jan >>> 10 12:53:16 2016 -0800 >>> @@ -31,6 +31,7 @@ >>> * @bug 4366807 >>> * @summary Need new APIs to get/set session timeout and session cache >>> size. >>> * @run main/othervm SessionCacheSizeTests >>> + * @key intermittent >>> */ >>> >>> import java.io.*; >>> >>> > From xuelei.fan at oracle.com Mon Jan 11 04:10:55 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Mon, 11 Jan 2016 12:10:55 +0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out In-Reply-To: <5690E9CA.9030403@oracle.com> References: <5690E9CA.9030403@oracle.com> Message-ID: <56932B4F.4060205@oracle.com> Hi Weijun, Are you available review this test fix? Updated to use try-with-resources for server socket. Keep the client socket closure unchanged in order to keep this fix simple and easy to verify. http://cr.openjdk.java.net/~xuelei/8146387/webrev.01/ Thanks, Xuelei On 1/9/2016 7:06 PM, Xuelei Fan wrote: > Hi, > > Please review a test update for JDK-8146387: > > http://cr.openjdk.java.net/~xuelei/8146387/webrev.00/ > > In the test case, javax/net/ssl/SSLSession/SessionCacheSizeTests.java, > an integer (createdPorts) is used to count the server sockets. Every > server socket is created in a new thread. The access and update to > createdPorts should be synchronized for multiple threading safe. > > Thanks, > Xuelei > From weijun.wang at oracle.com Mon Jan 11 07:59:41 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Mon, 11 Jan 2016 15:59:41 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> Message-ID: <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> Once again http://cr.openjdk.java.net/~weijun/8058778/webrev.08/ http://cr.openjdk.java.net/~weijun/8058778/webrev.08/specdiff/java/security/cert/package-summary.html Changes: - GeneralName is now a standalone interface. Still no getType(), useless - Two newGeneralName, the binary one is simply newGeneralName(byte[]) which accepts every encoding including those having a string value There is still one TODO: We used to have subject(String) and subject(X500Principal), but on the issuer side there is only one buildCertificate(CertificateRequest, KeyPair, X500Principal) seems not the same level. I'd prefer to remove subject(String). It's just a short form and no more efficient than subject(X500Principal). Thanks Max > On Jan 9, 2016, at 8:57 AM, Wang Weijun wrote: > >> >> On Jan 9, 2016, at 4:40 AM, Sean Mullan wrote: >> >> On 01/07/2016 10:38 PM, Wang Weijun wrote: >>> >>>> On Jan 8, 2016, at 6:06 AM, Sean Mullan >>>> wrote: >> >>>> * CertificateFactorySpi >>>> >>>> Need more details on how inStream is parsed. >>> >>> I thought a "@see CertificateFactory#generateCertificateRequest" is >>> enough. I do noticed that >>> CertificateFactorySpi#engineGenerateCertificate copies all spec from >>> CertificateFactory#generateCertificate. >> >> I think if you specifically linked to that from the method description it would be sufficient, ex: "For details on how inStream is parsed, see ...", but an @see on its own is more like an FYI and does not imply that it is part of the specification. > > I'll copy the text then, same with generateCertificate(). > >> >>>> >>>> 772 String getDefaultSigAlgName(PrivateKey key); >>>> >>>> This seems like it should just be a static utility method, and not >>>> something every subclass has to implement. >>> >>> But only the provider (X509Factory here) knows about the return >>> values, and another provider can return different values. >> >> Can you remind me why this needs to be a public method? Why can't this be an implementation detail when the caller doesn't specify a signature algorithm? > > It allows a caller (maybe a GUI tool) to know what default values are. > >> ful. >> >>> Or, we can do it like >>> >>> interface GeneralName { byte[] getEncoded(); } >> >> and an enum for the type and a getType method? > > enum will be here. getType() is useful but not necessary. > > Thanks > Max > >> >>> >>> class X509Certificate.Builder { GeneralName newGeneralName(int/Enum >>> type, String svalue); GeneralName newGeneralName(int/Enum type, >>> byte[] value); } >> >> Ok. >> >> --Sean From weijun.wang at oracle.com Mon Jan 11 08:10:58 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Mon, 11 Jan 2016 16:10:58 +0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out In-Reply-To: <5690E9CA.9030403@oracle.com> References: <5690E9CA.9030403@oracle.com> Message-ID: Can you make sure every read to serverPorts is after serverReady = true? I hope so but cannot confirm it, especially in the constructor (on line 342 etc). Or shouldn't you always start the server at port 0 and then read it into serverPorts? You want to start a server on the same port on and on? Thanks Max > On Jan 9, 2016, at 7:06 PM, Xuelei Fan wrote: > > Hi, > > Please review a test update for JDK-8146387: > > http://cr.openjdk.java.net/~xuelei/8146387/webrev.00/ > > In the test case, javax/net/ssl/SSLSession/SessionCacheSizeTests.java, > an integer (createdPorts) is used to count the server sockets. Every > server socket is created in a new thread. The access and update to > createdPorts should be synchronized for multiple threading safe. > > Thanks, > Xuelei From weijun.wang at oracle.com Mon Jan 11 08:43:41 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Mon, 11 Jan 2016 16:43:41 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> Message-ID: <9D7015BD-9229-40C1-A0AD-7C40C85E8AD3@oracle.com> Another thing to discuss: Now SubjectKeyIdentifier and AuthorityKeyIdentifier are automatically added. Should they only be added when requested? Thanks Max > On Jan 11, 2016, at 3:59 PM, Wang Weijun wrote: > > Once again > > http://cr.openjdk.java.net/~weijun/8058778/webrev.08/ > http://cr.openjdk.java.net/~weijun/8058778/webrev.08/specdiff/java/security/cert/package-summary.html From xuelei.fan at oracle.com Mon Jan 11 09:09:07 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Mon, 11 Jan 2016 17:09:07 +0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out In-Reply-To: References: <5690E9CA.9030403@oracle.com> Message-ID: <56937133.8060306@oracle.com> On 1/11/2016 4:10 PM, Wang Weijun wrote: > Can you make sure every read to serverPorts is after serverReady = true? Not actually. The serverPorts is accessed before the serverReady is true. > I hope so but cannot confirm it, especially in the constructor (on line > 342 etc). Or shouldn't you always start the server at port 0 and then > read it into serverPorts? Yes. That's the current behavior to use port 0 and than set the used port into serverPorts. > You want to start a server on the same port on and on? > Not actually. Different port are used for different server socket. The logic looks like: // define four slots for the ports int serverPorts[] = new int[]{0, 0, 0, 0}; // for each slot, create a server socket, // and assign the actually used port for each slot. for each slots run a thread { SSLServerSocket sslServerSocket = ... serverPorts[nextPort] = sslServerSocket.getLocalPort(); ^^^^^^^^ } // use the actual port for each slot in client side if (server ready) { connect to the server socket (host:port) } The concurrent access to serverPorts is not the underlying problem. The problem is which slot should be assigned the right port value. Before this fix, the following code is prolematic: serverPorts[createdPorts++] = sslServerSocket.getLocalPort(); For example, two threads access createdPorts, which is 0. createdPorts++ set createdPorts to 1. Two server ports are generated, but only count once. The serverReady would never set to true: if (createdPorts == serverPorts.length) { serverReady = true; } This fix is trying to increase the createdPorts value properly. It is not actually need to synchronize serverPorts. Thanks, Xuelei > Thanks > Max > >> On Jan 9, 2016, at 7:06 PM, Xuelei Fan wrote: >> >> Hi, >> >> Please review a test update for JDK-8146387: >> >> http://cr.openjdk.java.net/~xuelei/8146387/webrev.00/ >> >> In the test case, javax/net/ssl/SSLSession/SessionCacheSizeTests.java, >> an integer (createdPorts) is used to count the server sockets. Every >> server socket is created in a new thread. The access and update to >> createdPorts should be synchronized for multiple threading safe. >> >> Thanks, >> Xuelei > From xuelei.fan at oracle.com Mon Jan 11 09:13:27 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Mon, 11 Jan 2016 17:13:27 +0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out In-Reply-To: <56937133.8060306@oracle.com> References: <5690E9CA.9030403@oracle.com> <56937133.8060306@oracle.com> Message-ID: <56937237.5000108@oracle.com> On 1/11/2016 5:09 PM, Xuelei Fan wrote: > On 1/11/2016 4:10 PM, Wang Weijun wrote: >> Can you make sure every read to serverPorts is after serverReady = true? > Not actually. The serverPorts is accessed before the serverReady is true. > >> I hope so but cannot confirm it, especially in the constructor (on line >> 342 etc). Or shouldn't you always start the server at port 0 and then >> read it into serverPorts? > Yes. That's the current behavior to use port 0 and than set the used > port into serverPorts. > >> You want to start a server on the same port on and on? >> > Not actually. Different port are used for different server socket. The > logic looks like: > // define four slots for the ports > int serverPorts[] = new int[]{0, 0, 0, 0}; > > // for each slot, create a server socket, > // and assign the actually used port for each slot. > for each slots run a thread { > SSLServerSocket sslServerSocket = ... > serverPorts[nextPort] = sslServerSocket.getLocalPort(); > ^^^^^^^^ > } > > // use the actual port for each slot in client side > if (server ready) { > connect to the server socket (host:port) > } > > The concurrent access to serverPorts is not the underlying problem. The > problem is which slot should be assigned the right port value. > > Before this fix, the following code is prolematic: > > serverPorts[createdPorts++] = sslServerSocket.getLocalPort(); > > For example, two threads access createdPorts, which is 0. > createdPorts++ set createdPorts to 1. And the #0 slot get updated, #1 slot not. That's also a problem. > Two server ports are generated, > but only count once. The serverReady would never set to true: > > if (createdPorts == serverPorts.length) { > serverReady = true; > } > > > This fix is trying to increase the createdPorts value properly. It is > not actually need to synchronize serverPorts. > > Thanks, > Xuelei > >> Thanks >> Max >> >>> On Jan 9, 2016, at 7:06 PM, Xuelei Fan wrote: >>> >>> Hi, >>> >>> Please review a test update for JDK-8146387: >>> >>> http://cr.openjdk.java.net/~xuelei/8146387/webrev.00/ >>> >>> In the test case, javax/net/ssl/SSLSession/SessionCacheSizeTests.java, >>> an integer (createdPorts) is used to count the server sockets. Every >>> server socket is created in a new thread. The access and update to >>> createdPorts should be synchronized for multiple threading safe. >>> >>> Thanks, >>> Xuelei >> > From weijun.wang at oracle.com Mon Jan 11 09:43:35 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Mon, 11 Jan 2016 17:43:35 +0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out In-Reply-To: <56937237.5000108@oracle.com> References: <5690E9CA.9030403@oracle.com> <56937133.8060306@oracle.com> <56937237.5000108@oracle.com> Message-ID: <2D71428F-54FF-4B23-A2C0-524696D590C7@oracle.com> >> >>> You want to start a server on the same port on and on? >>> >> Not actually. Different port are used for different server socket. The >> logic looks like: >> // define four slots for the ports >> int serverPorts[] = new int[]{0, 0, 0, 0}; >> >> // for each slot, create a server socket, >> // and assign the actually used port for each slot. >> for each slots run a thread { >> SSLServerSocket sslServerSocket = ... >> serverPorts[nextPort] = sslServerSocket.getLocalPort(); >> ^^^^^^^^ >> } >> >> // use the actual port for each slot in client side >> if (server ready) { >> connect to the server socket (host:port) >> } Why do you need a serverPort parameter in doServerSide()? Can it just always be 0? >> >> This fix is trying to increase the createdPorts value properly. It is >> not actually need to synchronize serverPorts. I see. Why not just synchronized on this and add a small comment? --Max From xuelei.fan at oracle.com Mon Jan 11 11:02:36 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Mon, 11 Jan 2016 19:02:36 +0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out In-Reply-To: <2D71428F-54FF-4B23-A2C0-524696D590C7@oracle.com> References: <5690E9CA.9030403@oracle.com> <56937133.8060306@oracle.com> <56937237.5000108@oracle.com> <2D71428F-54FF-4B23-A2C0-524696D590C7@oracle.com> Message-ID: <56938BCC.8050806@oracle.com> On 1/11/2016 5:43 PM, Wang Weijun wrote: > >>> >>>> You want to start a server on the same port on and on? >>>> >>> Not actually. Different port are used for different server socket. The >>> logic looks like: >>> // define four slots for the ports >>> int serverPorts[] = new int[]{0, 0, 0, 0}; >>> >>> // for each slot, create a server socket, >>> // and assign the actually used port for each slot. >>> for each slots run a thread { >>> SSLServerSocket sslServerSocket = ... >>> serverPorts[nextPort] = sslServerSocket.getLocalPort(); >>> ^^^^^^^^ >>> } >>> >>> // use the actual port for each slot in client side >>> if (server ready) { >>> connect to the server socket (host:port) >>> } > > Why do you need a serverPort parameter in doServerSide()? Can it just always be 0? > It is always 0 before the server socket generated. But after the server socket generated, need to remember the actual port so that client can connect to the port. >>> >>> This fix is trying to increase the createdPorts value properly. It is >>> not actually need to synchronize serverPorts. > > I see. Why not just synchronized on this and add a small comment? > Synchronized on any object is OK. I will add a comment like: // set the server port and increase the count synchronized Thanks, Xuelei From weijun.wang at oracle.com Mon Jan 11 11:51:16 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Mon, 11 Jan 2016 19:51:16 +0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out In-Reply-To: <56938BCC.8050806@oracle.com> References: <5690E9CA.9030403@oracle.com> <56937133.8060306@oracle.com> <56937237.5000108@oracle.com> <2D71428F-54FF-4B23-A2C0-524696D590C7@oracle.com> <56938BCC.8050806@oracle.com> Message-ID: > On Jan 11, 2016, at 7:02 PM, Xuelei Fan wrote: > > On 1/11/2016 5:43 PM, Wang Weijun wrote: >> >>>> >>>>> You want to start a server on the same port on and on? >>>>> >>>> Not actually. Different port are used for different server socket. The >>>> logic looks like: >>>> // define four slots for the ports >>>> int serverPorts[] = new int[]{0, 0, 0, 0}; >>>> >>>> // for each slot, create a server socket, >>>> // and assign the actually used port for each slot. >>>> for each slots run a thread { >>>> SSLServerSocket sslServerSocket = ... >>>> serverPorts[nextPort] = sslServerSocket.getLocalPort(); >>>> ^^^^^^^^ >>>> } >>>> >>>> // use the actual port for each slot in client side >>>> if (server ready) { >>>> connect to the server socket (host:port) >>>> } >> >> Why do you need a serverPort parameter in doServerSide()? Can it just always be 0? >> > It is always 0 before the server socket generated. But after the server > socket generated, need to remember the actual port so that client can > connect to the port. Can you hard code zero? (SSLServerSocket) sslssf.createServerSocket(0) Then those startServer() calls does not need to pass serverPorts[i] at all. --Max > >>>> >>>> This fix is trying to increase the createdPorts value properly. It is >>>> not actually need to synchronize serverPorts. >> >> I see. Why not just synchronized on this and add a small comment? >> > Synchronized on any object is OK. I will add a comment like: > // set the server port and increase the count synchronized > > Thanks, > Xuelei From xuelei.fan at oracle.com Mon Jan 11 11:58:52 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Mon, 11 Jan 2016 19:58:52 +0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out In-Reply-To: References: <5690E9CA.9030403@oracle.com> <56937133.8060306@oracle.com> <56937237.5000108@oracle.com> <2D71428F-54FF-4B23-A2C0-524696D590C7@oracle.com> <56938BCC.8050806@oracle.com> Message-ID: <569398FC.6010104@oracle.com> On 1/11/2016 7:51 PM, Wang Weijun wrote: > >> On Jan 11, 2016, at 7:02 PM, Xuelei Fan wrote: >> >> On 1/11/2016 5:43 PM, Wang Weijun wrote: >>> >>>>> >>>>>> You want to start a server on the same port on and on? >>>>>> >>>>> Not actually. Different port are used for different server socket. The >>>>> logic looks like: >>>>> // define four slots for the ports >>>>> int serverPorts[] = new int[]{0, 0, 0, 0}; >>>>> >>>>> // for each slot, create a server socket, >>>>> // and assign the actually used port for each slot. >>>>> for each slots run a thread { >>>>> SSLServerSocket sslServerSocket = ... >>>>> serverPorts[nextPort] = sslServerSocket.getLocalPort(); >>>>> ^^^^^^^^ >>>>> } >>>>> >>>>> // use the actual port for each slot in client side >>>>> if (server ready) { >>>>> connect to the server socket (host:port) >>>>> } >>> >>> Why do you need a serverPort parameter in doServerSide()? Can it just always be 0? >>> >> It is always 0 before the server socket generated. But after the server >> socket generated, need to remember the actual port so that client can >> connect to the port. > > Can you hard code zero? > > (SSLServerSocket) sslssf.createServerSocket(0) > > Then those startServer() calls does not need to pass serverPorts[i] at all. > Yes, I can. There are also some other potential improvement for this test case. But I want to focus on the issue and don't want to touch them at present. Otherwise, if some other issue is introduced, it is not easy to verify whether this update fixes this issue or not. Thanks, Xuelei > --Max > >> >>>>> >>>>> This fix is trying to increase the createdPorts value properly. It is >>>>> not actually need to synchronize serverPorts. >>> >>> I see. Why not just synchronized on this and add a small comment? >>> >> Synchronized on any object is OK. I will add a comment like: >> // set the server port and increase the count synchronized >> >> Thanks, >> Xuelei > From bradford.wetmore at oracle.com Tue Jan 12 01:01:34 2016 From: bradford.wetmore at oracle.com (Bradford Wetmore) Date: Mon, 11 Jan 2016 17:01:34 -0800 Subject: Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out In-Reply-To: <56932B4F.4060205@oracle.com> References: <5690E9CA.9030403@oracle.com> <56932B4F.4060205@oracle.com> Message-ID: <5694506E.1080102@oracle.com> 272: I would suggest using MAX_ACTIVE_CONNECTIONS to initialize this array, in case there is ever a resizing done in the future. I see we are doing timeout tests elsewhere in the test suite, good. Looks ok otherwise. Brad On 1/10/2016 8:10 PM, Xuelei Fan wrote: > Hi Weijun, > > Are you available review this test fix? > > Updated to use try-with-resources for server socket. Keep the client > socket closure unchanged in order to keep this fix simple and easy to > verify. > > http://cr.openjdk.java.net/~xuelei/8146387/webrev.01/ > > Thanks, > Xuelei > > > On 1/9/2016 7:06 PM, Xuelei Fan wrote: >> Hi, >> >> Please review a test update for JDK-8146387: >> >> http://cr.openjdk.java.net/~xuelei/8146387/webrev.00/ >> >> In the test case, javax/net/ssl/SSLSession/SessionCacheSizeTests.java, >> an integer (createdPorts) is used to count the server sockets. Every >> server socket is created in a new thread. The access and update to >> createdPorts should be synchronized for multiple threading safe. >> >> Thanks, >> Xuelei >> > From bhanu.prakash.gopularam at oracle.com Tue Jan 12 09:37:47 2016 From: bhanu.prakash.gopularam at oracle.com (Bhanu Gopularam) Date: Tue, 12 Jan 2016 01:37:47 -0800 (PST) Subject: RFR: 8133085- Remove old style (pre-JDK 1.4) "new SunJCE()" provider calls in tests. Fails to compile. In-Reply-To: <56900787.9000309@oracle.com> References: <0ed013aa-b95a-4db8-9bd3-db3274d3de0f@default> <568FE522.1080905@oracle.com> <56900787.9000309@oracle.com> Message-ID: <8e461124-8f3f-4e32-8477-41eee5437ec3@default> Hi all, Please see the updated webrev: http://cr.openjdk.java.net/~ntv/bhanu/8133085/webrev.01/ Changes: Reverted changes to tests running in FIPS mode and added 2016 to copyright. Thanks, Bhanu -----Original Message----- From: Bradford Wetmore Sent: Saturday, January 09, 2016 12:31 AM To: Sean Mullan; Bhanu Gopularam; security-dev at openjdk.java.net Subject: Re: RFR: 8133085- Remove old style (pre-JDK 1.4) "new SunJCE()" provider calls in tests. Fails to compile. (Xuelei, see below) Bhanu, The proposed ClientJSSEServerJSSE.java/TrustManagerTest.java changes are incorrect. These tests are setting JSSE into FIPS mode, so this test should be correct as is. Brad On 1/8/2016 8:34 AM, Sean Mullan wrote: > Please update copyrights to include 2016. Otherwise, looks fine to me. > > --Sean > > On 01/08/2016 02:54 AM, Bhanu Gopularam wrote: >> Hi all, >> >> Please review a fix for following bug: >> >> Bug Id -https://bugs.openjdk.java.net/browse/JDK-8133085 >> >> Issue - Some security regression tests are directly instantiating the >> security providers instead of using the registered providers. Most of >> the cases the issue can be corrected by using registered security >> providers which are available during execution and instance need not >> be created. >> >> Solution - Refactored tests which are directly instantiating the >> security provider to use the registered ones. Fixes also include >> couple of tests which run on Solaris environment. >> >> ->sun/security/pkcs11/fips/TrustManagerTest.java >> >> ->sun/security/pkcs11/fips/ClientJSSEServerJSSE.java >> >> Webrev - http://cr.openjdk.java.net/~ntv/bhanu/8133085/webrev/ >> >> Thanks, >> >> Bhanu >> From sean.mullan at oracle.com Tue Jan 12 13:26:11 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 12 Jan 2016 08:26:11 -0500 Subject: RFR: 8085903: New fix for memory leak in ProtectionDomain cache In-Reply-To: <569016DC.1050107@oracle.com> References: <569016DC.1050107@oracle.com> Message-ID: <5694FEF3.8000201@oracle.com> I received a private comment that there may be cases where the map's value is reclaimed by the garbage collector, but the key still exists. If that ProtectionDomain is subsequently used for permission checks, a Map.putIfAbsent method will not replace the value. So, I have added an additional check for this case in the PDCache.put method, and it instead uses the Map.replace method. Updated webrev: http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.01/ --Sean On 01/08/2016 03:06 PM, Sean Mullan wrote: > Please review this fix for a memory leak in the ProtectionDomain cache > (which maps each ProtectionDomain to their granted > PermissionCollection). The memory leak only occurs if custom permissions > are used in a policy file. > > http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.00/ > > Custom permissions cause a chain of strong references that link back to > the ProtectionDomain key used in the map, preventing it from being > removed (and also preventing the custom permission's URLClassLoader from > being garbage collected). This fix wraps the PermissionCollection in a > SoftReference which allows the objects to be garbage collected in > response to memory demand. > > Thanks, > Sean From ivan.gerasimov at oracle.com Tue Jan 12 14:38:36 2016 From: ivan.gerasimov at oracle.com (Ivan Gerasimov) Date: Tue, 12 Jan 2016 17:38:36 +0300 Subject: RFR: 8085903: New fix for memory leak in ProtectionDomain cache In-Reply-To: <5694FEF3.8000201@oracle.com> References: <569016DC.1050107@oracle.com> <5694FEF3.8000201@oracle.com> Message-ID: <56950FEC.2040804@oracle.com> Hi Sean! On 12.01.2016 16:26, Sean Mullan wrote: > I received a private comment that there may be cases where the map's > value is reclaimed by the garbage collector, but the key still exists. > If that ProtectionDomain is subsequently used for permission checks, a > Map.putIfAbsent method will not replace the value. > > So, I have added an additional check for this case in the PDCache.put > method, and it instead uses the Map.replace method. Updated webrev: > Wouldn't it be a little bit more efficient to use merge() here? Something like: pdMap.merge(weakPd, v, (pv, nv) -> pv.get() != null ? pv : nv); Sincerely yours, Ivan > http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.01/ > > --Sean > > On 01/08/2016 03:06 PM, Sean Mullan wrote: >> Please review this fix for a memory leak in the ProtectionDomain cache >> (which maps each ProtectionDomain to their granted >> PermissionCollection). The memory leak only occurs if custom permissions >> are used in a policy file. >> >> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.00/ >> >> Custom permissions cause a chain of strong references that link back to >> the ProtectionDomain key used in the map, preventing it from being >> removed (and also preventing the custom permission's URLClassLoader from >> being garbage collected). This fix wraps the PermissionCollection in a >> SoftReference which allows the objects to be garbage collected in >> response to memory demand. >> >> Thanks, >> Sean > From sean.mullan at oracle.com Tue Jan 12 15:01:10 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 12 Jan 2016 10:01:10 -0500 Subject: RFR: 8085903: New fix for memory leak in ProtectionDomain cache In-Reply-To: <56950FEC.2040804@oracle.com> References: <569016DC.1050107@oracle.com> <5694FEF3.8000201@oracle.com> <56950FEC.2040804@oracle.com> Message-ID: <56951536.1070901@oracle.com> Hi Ivan, On 01/12/2016 09:38 AM, Ivan Gerasimov wrote: > Hi Sean! > > On 12.01.2016 16:26, Sean Mullan wrote: >> I received a private comment that there may be cases where the map's >> value is reclaimed by the garbage collector, but the key still exists. >> If that ProtectionDomain is subsequently used for permission checks, a >> Map.putIfAbsent method will not replace the value. >> >> So, I have added an additional check for this case in the PDCache.put >> method, and it instead uses the Map.replace method. Updated webrev: >> > > Wouldn't it be a little bit more efficient to use merge() here? > > Something like: > pdMap.merge(weakPd, v, (pv, nv) -> pv.get() != null ? pv : nv); Yes - good catch! Will update and send out new webrev after a round of testing ... Thanks, Sean > > Sincerely yours, > Ivan > >> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.01/ >> >> --Sean >> >> On 01/08/2016 03:06 PM, Sean Mullan wrote: >>> Please review this fix for a memory leak in the ProtectionDomain cache >>> (which maps each ProtectionDomain to their granted >>> PermissionCollection). The memory leak only occurs if custom permissions >>> are used in a policy file. >>> >>> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.00/ >>> >>> Custom permissions cause a chain of strong references that link back to >>> the ProtectionDomain key used in the map, preventing it from being >>> removed (and also preventing the custom permission's URLClassLoader from >>> being garbage collected). This fix wraps the PermissionCollection in a >>> SoftReference which allows the objects to be garbage collected in >>> response to memory demand. >>> >>> Thanks, >>> Sean >> > From xuelei.fan at oracle.com Tue Jan 12 15:26:41 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Tue, 12 Jan 2016 23:26:41 +0800 Subject: RFR: 8085903: New fix for memory leak in ProtectionDomain cache In-Reply-To: <56951536.1070901@oracle.com> References: <569016DC.1050107@oracle.com> <5694FEF3.8000201@oracle.com> <56950FEC.2040804@oracle.com> <56951536.1070901@oracle.com> Message-ID: <56951B31.20900@oracle.com> I think hashMap.put() may be similar or more effective than hashMap.putIfAbsent(). Is there a case that the key/weakPd is the same, but the value/pc is different? Xuelei On 1/12/2016 11:01 PM, Sean Mullan wrote: > Hi Ivan, > > On 01/12/2016 09:38 AM, Ivan Gerasimov wrote: >> Hi Sean! >> >> On 12.01.2016 16:26, Sean Mullan wrote: >>> I received a private comment that there may be cases where the map's >>> value is reclaimed by the garbage collector, but the key still exists. >>> If that ProtectionDomain is subsequently used for permission checks, a >>> Map.putIfAbsent method will not replace the value. >>> >>> So, I have added an additional check for this case in the PDCache.put >>> method, and it instead uses the Map.replace method. Updated webrev: >>> >> >> Wouldn't it be a little bit more efficient to use merge() here? >> >> Something like: >> pdMap.merge(weakPd, v, (pv, nv) -> pv.get() != null ? pv : nv); > > Yes - good catch! > > Will update and send out new webrev after a round of testing ... > > Thanks, > Sean > >> >> Sincerely yours, >> Ivan >> >>> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.01/ >>> >>> --Sean >>> >>> On 01/08/2016 03:06 PM, Sean Mullan wrote: >>>> Please review this fix for a memory leak in the ProtectionDomain cache >>>> (which maps each ProtectionDomain to their granted >>>> PermissionCollection). The memory leak only occurs if custom >>>> permissions >>>> are used in a policy file. >>>> >>>> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.00/ >>>> >>>> Custom permissions cause a chain of strong references that link back to >>>> the ProtectionDomain key used in the map, preventing it from being >>>> removed (and also preventing the custom permission's URLClassLoader >>>> from >>>> being garbage collected). This fix wraps the PermissionCollection in a >>>> SoftReference which allows the objects to be garbage collected in >>>> response to memory demand. >>>> >>>> Thanks, >>>> Sean >>> >> From sean.mullan at oracle.com Tue Jan 12 16:02:43 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 12 Jan 2016 11:02:43 -0500 Subject: RFR: 8085903: New fix for memory leak in ProtectionDomain cache In-Reply-To: <56951B31.20900@oracle.com> References: <569016DC.1050107@oracle.com> <5694FEF3.8000201@oracle.com> <56950FEC.2040804@oracle.com> <56951536.1070901@oracle.com> <56951B31.20900@oracle.com> Message-ID: <569523A3.7060202@oracle.com> On 01/12/2016 10:26 AM, Xuelei Fan wrote: > I think hashMap.put() may be similar or more effective than > hashMap.putIfAbsent(). Ok, I think I see what you are trying to say. The common case is that the putIfAbsent method is going to succeed (i.e. the entry will be absent). It may not succeed in cases where there are multiple threads simultaneously computing the initial permissions for the same PD or the value is garbage collected due to memory demand. So, I think the question boils down to whether put is faster than putIfAbsent in the common case (when there is not an entry). Probably yes, since it doesn't have to check if there is an entry already. > Is there a case that the key/weakPd is the same, > but the value/pc is different? I believe the pc should always be the same. If you change the policy file(s), then you have to explicitly refresh it (using Policy.refresh()) which should cause a new cache to be created. Let me do some more testing around this, and see if I can check performance and see what is better. Thanks, Sean > > Xuelei > > On 1/12/2016 11:01 PM, Sean Mullan wrote: >> Hi Ivan, >> >> On 01/12/2016 09:38 AM, Ivan Gerasimov wrote: >>> Hi Sean! >>> >>> On 12.01.2016 16:26, Sean Mullan wrote: >>>> I received a private comment that there may be cases where the map's >>>> value is reclaimed by the garbage collector, but the key still exists. >>>> If that ProtectionDomain is subsequently used for permission checks, a >>>> Map.putIfAbsent method will not replace the value. >>>> >>>> So, I have added an additional check for this case in the PDCache.put >>>> method, and it instead uses the Map.replace method. Updated webrev: >>>> >>> >>> Wouldn't it be a little bit more efficient to use merge() here? >>> >>> Something like: >>> pdMap.merge(weakPd, v, (pv, nv) -> pv.get() != null ? pv : nv); >> >> Yes - good catch! >> >> Will update and send out new webrev after a round of testing ... >> >> Thanks, >> Sean >> >>> >>> Sincerely yours, >>> Ivan >>> >>>> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.01/ >>>> >>>> --Sean >>>> >>>> On 01/08/2016 03:06 PM, Sean Mullan wrote: >>>>> Please review this fix for a memory leak in the ProtectionDomain cache >>>>> (which maps each ProtectionDomain to their granted >>>>> PermissionCollection). The memory leak only occurs if custom >>>>> permissions >>>>> are used in a policy file. >>>>> >>>>> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.00/ >>>>> >>>>> Custom permissions cause a chain of strong references that link back to >>>>> the ProtectionDomain key used in the map, preventing it from being >>>>> removed (and also preventing the custom permission's URLClassLoader >>>>> from >>>>> being garbage collected). This fix wraps the PermissionCollection in a >>>>> SoftReference which allows the objects to be garbage collected in >>>>> response to memory demand. >>>>> >>>>> Thanks, >>>>> Sean >>>> >>> > From sean.mullan at oracle.com Tue Jan 12 19:24:40 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 12 Jan 2016 14:24:40 -0500 Subject: RFR: 8085903: New fix for memory leak in ProtectionDomain cache In-Reply-To: <569523A3.7060202@oracle.com> References: <569016DC.1050107@oracle.com> <5694FEF3.8000201@oracle.com> <56950FEC.2040804@oracle.com> <56951536.1070901@oracle.com> <56951B31.20900@oracle.com> <569523A3.7060202@oracle.com> Message-ID: <569552F8.3080709@oracle.com> New (simpler) fix using Map.put(): http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.02/ This should be ok, as the JDK 8 code and the JDK 9 code prior to the fix for 8055753 [1] was using Map.put instead of putIfAbsent. Thanks, Sean [1] https://bugs.openjdk.java.net/browse/JDK-8055753 On 01/12/2016 11:02 AM, Sean Mullan wrote: > On 01/12/2016 10:26 AM, Xuelei Fan wrote: >> I think hashMap.put() may be similar or more effective than >> hashMap.putIfAbsent(). > > Ok, I think I see what you are trying to say. > > The common case is that the putIfAbsent method is going to succeed (i.e. > the entry will be absent). It may not succeed in cases where there are > multiple threads simultaneously computing the initial permissions for > the same PD or the value is garbage collected due to memory demand. > > So, I think the question boils down to whether put is faster than > putIfAbsent in the common case (when there is not an entry). Probably > yes, since it doesn't have to check if there is an entry already. > >> Is there a case that the key/weakPd is the same, >> but the value/pc is different? > > I believe the pc should always be the same. If you change the policy > file(s), then you have to explicitly refresh it (using Policy.refresh()) > which should cause a new cache to be created. > > Let me do some more testing around this, and see if I can check > performance and see what is better. > > Thanks, > Sean > >> >> Xuelei >> >> On 1/12/2016 11:01 PM, Sean Mullan wrote: >>> Hi Ivan, >>> >>> On 01/12/2016 09:38 AM, Ivan Gerasimov wrote: >>>> Hi Sean! >>>> >>>> On 12.01.2016 16:26, Sean Mullan wrote: >>>>> I received a private comment that there may be cases where the map's >>>>> value is reclaimed by the garbage collector, but the key still exists. >>>>> If that ProtectionDomain is subsequently used for permission checks, a >>>>> Map.putIfAbsent method will not replace the value. >>>>> >>>>> So, I have added an additional check for this case in the PDCache.put >>>>> method, and it instead uses the Map.replace method. Updated webrev: >>>>> >>>> >>>> Wouldn't it be a little bit more efficient to use merge() here? >>>> >>>> Something like: >>>> pdMap.merge(weakPd, v, (pv, nv) -> pv.get() != null ? pv : nv); >>> >>> Yes - good catch! >>> >>> Will update and send out new webrev after a round of testing ... >>> >>> Thanks, >>> Sean >>> >>>> >>>> Sincerely yours, >>>> Ivan >>>> >>>>> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.01/ >>>>> >>>>> --Sean >>>>> >>>>> On 01/08/2016 03:06 PM, Sean Mullan wrote: >>>>>> Please review this fix for a memory leak in the ProtectionDomain >>>>>> cache >>>>>> (which maps each ProtectionDomain to their granted >>>>>> PermissionCollection). The memory leak only occurs if custom >>>>>> permissions >>>>>> are used in a policy file. >>>>>> >>>>>> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.00/ >>>>>> >>>>>> Custom permissions cause a chain of strong references that link >>>>>> back to >>>>>> the ProtectionDomain key used in the map, preventing it from being >>>>>> removed (and also preventing the custom permission's URLClassLoader >>>>>> from >>>>>> being garbage collected). This fix wraps the PermissionCollection >>>>>> in a >>>>>> SoftReference which allows the objects to be garbage collected in >>>>>> response to memory demand. >>>>>> >>>>>> Thanks, >>>>>> Sean >>>>> >>>> >> From sean.mullan at oracle.com Tue Jan 12 21:58:49 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 12 Jan 2016 16:58:49 -0500 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> Message-ID: <56957719.2010508@oracle.com> A few more comments for now, but I'll need another day or so to finish my review: * General Use @throws instead of @exception * X509Certificate lines 572-585 were removed, but where was it copied? It is not in GeneralName and probably should not be unless we add a toString method. 847 * @exception IllegalArgumentException if {@code name} 848 * is not a valid signature algorithm name. TODO: really? Agree, you can't detect this until the certificate is built/signed, so I think you should remove it, and add a note that the signature algorithm will not be checked for availability until it is built or signed. 867 * If Both this method and {@link #setSigAlgName} are called, the s/Both/both/ * CertificateRequest 125 * @return the encoded form of this certificate request 126 */ 127 public abstract byte[] getEncoded(); Should say that it returns a new byte array each time it is called. --Sean On 01/11/2016 02:59 AM, Wang Weijun wrote: > Once again > > http://cr.openjdk.java.net/~weijun/8058778/webrev.08/ > http://cr.openjdk.java.net/~weijun/8058778/webrev.08/specdiff/java/security/cert/package-summary.html > > Changes: > > - GeneralName is now a standalone interface. Still no getType(), useless > > - Two newGeneralName, the binary one is simply newGeneralName(byte[]) which accepts every encoding including those having a string value > > There is still one TODO: > > We used to have subject(String) and subject(X500Principal), but on the issuer side there is only one > > buildCertificate(CertificateRequest, KeyPair, X500Principal) > > seems not the same level. I'd prefer to remove subject(String). It's just a short form and no more efficient than subject(X500Principal). > > Thanks > Max From xuelei.fan at oracle.com Wed Jan 13 00:36:31 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Wed, 13 Jan 2016 08:36:31 +0800 Subject: RFR: 8085903: New fix for memory leak in ProtectionDomain cache In-Reply-To: <569552F8.3080709@oracle.com> References: <569016DC.1050107@oracle.com> <5694FEF3.8000201@oracle.com> <56950FEC.2040804@oracle.com> <56951536.1070901@oracle.com> <56951B31.20900@oracle.com> <569523A3.7060202@oracle.com> <569552F8.3080709@oracle.com> Message-ID: <56959C0F.9020008@oracle.com> Looks fine to me. Thanks, Xuelei On 1/13/2016 3:24 AM, Sean Mullan wrote: > New (simpler) fix using Map.put(): > > http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.02/ > > This should be ok, as the JDK 8 code and the JDK 9 code prior to the fix > for 8055753 [1] was using Map.put instead of putIfAbsent. > > Thanks, > Sean > > [1] https://bugs.openjdk.java.net/browse/JDK-8055753 > > On 01/12/2016 11:02 AM, Sean Mullan wrote: >> On 01/12/2016 10:26 AM, Xuelei Fan wrote: >>> I think hashMap.put() may be similar or more effective than >>> hashMap.putIfAbsent(). >> >> Ok, I think I see what you are trying to say. >> >> The common case is that the putIfAbsent method is going to succeed (i.e. >> the entry will be absent). It may not succeed in cases where there are >> multiple threads simultaneously computing the initial permissions for >> the same PD or the value is garbage collected due to memory demand. >> >> So, I think the question boils down to whether put is faster than >> putIfAbsent in the common case (when there is not an entry). Probably >> yes, since it doesn't have to check if there is an entry already. >> >>> Is there a case that the key/weakPd is the same, >>> but the value/pc is different? >> >> I believe the pc should always be the same. If you change the policy >> file(s), then you have to explicitly refresh it (using Policy.refresh()) >> which should cause a new cache to be created. >> >> Let me do some more testing around this, and see if I can check >> performance and see what is better. >> >> Thanks, >> Sean >> >>> >>> Xuelei >>> >>> On 1/12/2016 11:01 PM, Sean Mullan wrote: >>>> Hi Ivan, >>>> >>>> On 01/12/2016 09:38 AM, Ivan Gerasimov wrote: >>>>> Hi Sean! >>>>> >>>>> On 12.01.2016 16:26, Sean Mullan wrote: >>>>>> I received a private comment that there may be cases where the map's >>>>>> value is reclaimed by the garbage collector, but the key still >>>>>> exists. >>>>>> If that ProtectionDomain is subsequently used for permission >>>>>> checks, a >>>>>> Map.putIfAbsent method will not replace the value. >>>>>> >>>>>> So, I have added an additional check for this case in the PDCache.put >>>>>> method, and it instead uses the Map.replace method. Updated webrev: >>>>>> >>>>> >>>>> Wouldn't it be a little bit more efficient to use merge() here? >>>>> >>>>> Something like: >>>>> pdMap.merge(weakPd, v, (pv, nv) -> pv.get() != null ? pv : nv); >>>> >>>> Yes - good catch! >>>> >>>> Will update and send out new webrev after a round of testing ... >>>> >>>> Thanks, >>>> Sean >>>> >>>>> >>>>> Sincerely yours, >>>>> Ivan >>>>> >>>>>> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.01/ >>>>>> >>>>>> --Sean >>>>>> >>>>>> On 01/08/2016 03:06 PM, Sean Mullan wrote: >>>>>>> Please review this fix for a memory leak in the ProtectionDomain >>>>>>> cache >>>>>>> (which maps each ProtectionDomain to their granted >>>>>>> PermissionCollection). The memory leak only occurs if custom >>>>>>> permissions >>>>>>> are used in a policy file. >>>>>>> >>>>>>> http://cr.openjdk.java.net/~mullan/webrevs/8085903/webrev.00/ >>>>>>> >>>>>>> Custom permissions cause a chain of strong references that link >>>>>>> back to >>>>>>> the ProtectionDomain key used in the map, preventing it from being >>>>>>> removed (and also preventing the custom permission's URLClassLoader >>>>>>> from >>>>>>> being garbage collected). This fix wraps the PermissionCollection >>>>>>> in a >>>>>>> SoftReference which allows the objects to be garbage collected in >>>>>>> response to memory demand. >>>>>>> >>>>>>> Thanks, >>>>>>> Sean >>>>>> >>>>> >>> From weijun.wang at oracle.com Wed Jan 13 01:02:54 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 13 Jan 2016 09:02:54 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <56957719.2010508@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> Message-ID: <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> A new webrev at http://cr.openjdk.java.net/~weijun/8058778/webrev.09/ http://cr.openjdk.java.net/~weijun/8058778/webrev.09/specdiff/java/security/cert/package-summary.html Changes from webrev.08: 1. X509Certificate.Builder addAuthorityKeyIdentifierExtension(); X509Certificate.Builder addSubjectKeyIdentifierExtension(); 2. X509Extension getRawExtensionValue(String oid) 3. Spec changes we discussed. Still one TODO in X509Certificate.Builder subject(String name). Some comments below in line. > On Jan 13, 2016, at 5:58 AM, Sean Mullan wrote: > > A few more comments for now, but I'll need another day or so to finish my review: > > * General > > Use @throws instead of @exception I'll fix all new lines. Do I need to touch existing ones? > > * X509Certificate > > lines 572-585 were removed, but where was it copied? It is not in GeneralName and probably should not be unless we add a toString method. I moved them to Buidler#newGeneralName(Type,String). "See {@link GeneralName}" should be "See {@link Builder#newGeneralName(GeneralName.Type, String)} for the formats". Or is it always better to keep them in the existing API and add a link the new one? > > 847 * @exception IllegalArgumentException if {@code name} > 848 * is not a valid signature algorithm name. TODO: really? > > Agree, you can't detect this until the certificate is built/signed, so I think you should remove it, and add a note that the signature algorithm will not be checked for availability until it is built or signed. > > 867 * If Both this method and {@link #setSigAlgName} are called, the > > s/Both/both/ > > * CertificateRequest > > 125 * @return the encoded form of this certificate request > 126 */ > 127 public abstract byte[] getEncoded(); > > Should say that it returns a new byte array each time it is called. OK. Thanks Max > > --Sean > > On 01/11/2016 02:59 AM, Wang Weijun wrote: >> Once again >> >> http://cr.openjdk.java.net/~weijun/8058778/webrev.08/ >> http://cr.openjdk.java.net/~weijun/8058778/webrev.08/specdiff/java/security/cert/package-summary.html >> >> Changes: >> >> - GeneralName is now a standalone interface. Still no getType(), useless >> >> - Two newGeneralName, the binary one is simply newGeneralName(byte[]) which accepts every encoding including those having a string value >> >> There is still one TODO: >> >> We used to have subject(String) and subject(X500Principal), but on the issuer side there is only one >> >> buildCertificate(CertificateRequest, KeyPair, X500Principal) >> >> seems not the same level. I'd prefer to remove subject(String). It's just a short form and no more efficient than subject(X500Principal). >> >> Thanks >> Max > From weijun.wang at oracle.com Wed Jan 13 01:09:50 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 13 Jan 2016 09:09:50 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> Message-ID: Another thing. Many people only generates self-signed certificates. Shall we make this simple? For example, using buildCertificate(null, KeyPair, null)? Thanks Max From larry.mccay at gmail.com Wed Jan 13 02:31:48 2016 From: larry.mccay at gmail.com (larry mccay) Date: Tue, 12 Jan 2016 21:31:48 -0500 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> Message-ID: That's a nice idea. Wouldn't the following be more clear though: buildSelfSignedCertificate(KeyPair)? On Tue, Jan 12, 2016 at 8:09 PM, Wang Weijun wrote: > Another thing. > > Many people only generates self-signed certificates. Shall we make this > simple? For example, using buildCertificate(null, KeyPair, null)? > > Thanks > Max > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From weijun.wang at oracle.com Wed Jan 13 02:37:31 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 13 Jan 2016 10:37:31 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> Message-ID: > On Jan 13, 2016, at 10:31 AM, larry mccay wrote: > > That's a nice idea. > Wouldn't the following be more clear though: > > buildSelfSignedCertificate(KeyPair)? Good. So this should be Certificate.Builder the base interface. I am not familiar with non-X.509 certs, but hopefully there is also the concept of self-signed cert else where. --Max > > On Tue, Jan 12, 2016 at 8:09 PM, Wang Weijun wrote: > Another thing. > > Many people only generates self-signed certificates. Shall we make this simple? For example, using buildCertificate(null, KeyPair, null)? > > Thanks > Max > > From weijun.wang at oracle.com Wed Jan 13 03:35:19 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 13 Jan 2016 11:35:19 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> Message-ID: > Still one TODO in X509Certificate.Builder subject(String name). Not an issue any more. With buildSelfSignedCertificate(kp), there is no need for buildCertificate(request, kp, name) anymore. Hurray! --Max From weijun.wang at oracle.com Wed Jan 13 06:55:15 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 13 Jan 2016 14:55:15 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> Message-ID: <8698FB47-F08F-4FA3-9EB6-A12D92BBCC87@oracle.com> webrev.09 updated at the same URL. + Certificate.Builder#buildSelfSignedCertificate(KeyPair) - X509Certificate.Builder#buildCertificate(CertificateRequest, KeyPair, X500Principal) --Max > On Jan 13, 2016, at 9:02 AM, Wang Weijun wrote: > > A new webrev at > > http://cr.openjdk.java.net/~weijun/8058778/webrev.09/ > http://cr.openjdk.java.net/~weijun/8058778/webrev.09/specdiff/java/security/cert/package-summary.html > > Changes from webrev.08: > > 1. X509Certificate.Builder addAuthorityKeyIdentifierExtension(); > X509Certificate.Builder addSubjectKeyIdentifierExtension(); > > 2. X509Extension getRawExtensionValue(String oid) > > 3. Spec changes we discussed. > > Still one TODO in X509Certificate.Builder subject(String name). > > Some comments below in line. > >> On Jan 13, 2016, at 5:58 AM, Sean Mullan wrote: >> >> A few more comments for now, but I'll need another day or so to finish my review: >> >> * General >> >> Use @throws instead of @exception > > I'll fix all new lines. Do I need to touch existing ones? > >> >> * X509Certificate >> >> lines 572-585 were removed, but where was it copied? It is not in GeneralName and probably should not be unless we add a toString method. > > I moved them to Buidler#newGeneralName(Type,String). "See {@link GeneralName}" should be "See {@link Builder#newGeneralName(GeneralName.Type, String)} for the formats". > > Or is it always better to keep them in the existing API and add a link the new one? > >> >> 847 * @exception IllegalArgumentException if {@code name} >> 848 * is not a valid signature algorithm name. TODO: really? >> >> Agree, you can't detect this until the certificate is built/signed, so I think you should remove it, and add a note that the signature algorithm will not be checked for availability until it is built or signed. >> >> 867 * If Both this method and {@link #setSigAlgName} are called, the >> >> s/Both/both/ >> >> * CertificateRequest >> >> 125 * @return the encoded form of this certificate request >> 126 */ >> 127 public abstract byte[] getEncoded(); >> >> Should say that it returns a new byte array each time it is called. > > OK. > > > Thanks > Max > >> >> --Sean >> >> On 01/11/2016 02:59 AM, Wang Weijun wrote: >>> Once again >>> >>> http://cr.openjdk.java.net/~weijun/8058778/webrev.08/ >>> http://cr.openjdk.java.net/~weijun/8058778/webrev.08/specdiff/java/security/cert/package-summary.html >>> >>> Changes: >>> >>> - GeneralName is now a standalone interface. Still no getType(), useless >>> >>> - Two newGeneralName, the binary one is simply newGeneralName(byte[]) which accepts every encoding including those having a string value >>> >>> There is still one TODO: >>> >>> We used to have subject(String) and subject(X500Principal), but on the issuer side there is only one >>> >>> buildCertificate(CertificateRequest, KeyPair, X500Principal) >>> >>> seems not the same level. I'd prefer to remove subject(String). It's just a short form and no more efficient than subject(X500Principal). >>> >>> Thanks >>> Max From ivan.gerasimov at oracle.com Wed Jan 13 08:09:26 2016 From: ivan.gerasimov at oracle.com (Ivan Gerasimov) Date: Wed, 13 Jan 2016 11:09:26 +0300 Subject: [xs] RFR: 8146967: [TEST_BUG] javax/security/auth/SubjectDomainCombiner/Optimize.java should use 4-args ProtectionDomain constructor Message-ID: <56960636.2090208@oracle.com> Hello! Would you please help review the fix that solves the issue spotted when running the test with earlier version of jdk? BUGURL: https://bugs.openjdk.java.net/browse/JDK-8146967 WEBREV: http://cr.openjdk.java.net/~igerasim/8146967/00/webrev/ Sincerely yours, Ivan From xuelei.fan at oracle.com Wed Jan 13 09:23:53 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Wed, 13 Jan 2016 17:23:53 +0800 Subject: Code Review Request 8146669 Test SessionTimeOutTests fails intermittently Message-ID: <569617A9.7040803@oracle.com> Hi, Please review the intermittently test failure fix. http://cr.openjdk.java.net/~xuelei/8146669/webrev.00/ In the updated test case, an integer (createdPorts) is used to count the server sockets. Every server socket is created in a new thread. The access and update to createdPorts should be synchronized for multiple threading safe. Update to use AtomicInteger.getAndIncrement() so that the access and update to createdPorts is atomic. Thanks, Xuelei From david.lloyd at redhat.com Wed Jan 13 12:08:26 2016 From: david.lloyd at redhat.com (David M. Lloyd) Date: Wed, 13 Jan 2016 06:08:26 -0600 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> Message-ID: <56963E3A.5020604@redhat.com> On 01/12/2016 07:02 PM, Wang Weijun wrote: > A new webrev at > > http://cr.openjdk.java.net/~weijun/8058778/webrev.09/ A couple of questions/comments... > + public interface Builder > + > { What is the point of the "T" self-type variable? It does not seem to be referenced. Also the type parameters are not documented in the interface JavaDoc, or generally anywhere. Also in places like this.... + @Override + public R engineGenerateCertificateRequest( + InputStream is, Class type) throws CertificateException { + if (is == null) { + // clear the caches (for debugging) + certCache.clear(); + X509CertificatePair.clearCache(); + throw new CertificateException("Missing input stream"); + } + try { + byte[] encoding = readOneBlock(is); + if (encoding != null) { + return type.cast(new PKCS10(encoding)); + } else { + throw new IOException("Empty input"); + } + } catch (ClassCastException e) { + throw new UnsupportedOperationException("Unsupported format"); + } catch (Exception e2) { + throw new CertificateException(e2); + } + } ...it's using UOE for unsupported format, which doesn't seem right. Also, it seems like you could check "type" up at the top. The docs don't seem to specify whether the CSR block is consumed in the event of an invalid type Class being passed in. -- - DML From weijun.wang at oracle.com Wed Jan 13 13:44:17 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 13 Jan 2016 21:44:17 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <56963E3A.5020604@redhat.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> <56963E3A.5020604@redhat.com> Message-ID: <933CF711-784A-4AD9-A915-FE5840C6D093@oracle.com> Hi David > On Jan 13, 2016, at 8:08 PM, David M. Lloyd wrote: > > On 01/12/2016 07:02 PM, Wang Weijun wrote: >> A new webrev at >> >> http://cr.openjdk.java.net/~weijun/8058778/webrev.09/ > > A couple of questions/comments... > >> + public interface Builder >> + > { > > What is the point of the "T" self-type variable? It does not seem to be referenced. Also the type parameters are not documented in the interface JavaDoc, or generally anywhere. If there were a mutator defined here, it could be written as "T setSomething()" so that when called in a child interface it can return the child type instead the base type. Will add some document. That said, I haven't applied this trick in X509Certificate.Builder, what if there is a 2nd-level child interface? I'll do some experiments. > > Also in places like this.... > > + @Override > + public R engineGenerateCertificateRequest( > + InputStream is, Class type) throws CertificateException { > + if (is == null) { > + // clear the caches (for debugging) > + certCache.clear(); > + X509CertificatePair.clearCache(); > + throw new CertificateException("Missing input stream"); > + } > + try { > + byte[] encoding = readOneBlock(is); > + if (encoding != null) { > + return type.cast(new PKCS10(encoding)); > + } else { > + throw new IOException("Empty input"); > + } > + } catch (ClassCastException e) { > + throw new UnsupportedOperationException("Unsupported format"); > + } catch (Exception e2) { > + throw new CertificateException(e2); > + } > + } > > ...it's using UOE for unsupported format, which doesn't seem right. It should be IllegalArgumentException, or a sub-type (although I cannot find one). > Also, it seems like you could check "type" up at the top. I can use Class#isAssignable. > > The docs don't seem to specify whether the CSR block is consumed in the event of an invalid type Class being passed in. I just copied the existing spec for generateCertificate(), in fact in some places I haven't done s/certificate/certificate request/ yet! The current behavior is that it will consume one ----BEGIN...END---- block (with optional text before the block) or one DER SEQUENCE, or undefined if no such data structure are found. However, I am not sure if I need to document that as a requirement. Do you want any guarantee? Thanks Max > > -- > - DML From david.lloyd at redhat.com Wed Jan 13 13:51:57 2016 From: david.lloyd at redhat.com (David M. Lloyd) Date: Wed, 13 Jan 2016 07:51:57 -0600 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <933CF711-784A-4AD9-A915-FE5840C6D093@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> <56963E3A.5020604@redhat.com> <933CF711-784A-4AD9-A915-FE5840C6D093@oracle.com> Message-ID: <5696567D.1090207@redhat.com> On 01/13/2016 07:44 AM, Wang Weijun wrote: > Hi David > >> On Jan 13, 2016, at 8:08 PM, David M. Lloyd wrote: >> >> On 01/12/2016 07:02 PM, Wang Weijun wrote: >>> A new webrev at >>> >>> http://cr.openjdk.java.net/~weijun/8058778/webrev.09/ >> >> A couple of questions/comments... >> >>> + public interface Builder >>> + > { >> >> What is the point of the "T" self-type variable? It does not seem to be referenced. Also the type parameters are not documented in the interface JavaDoc, or generally anywhere. > > If there were a mutator defined here, it could be written as "T setSomething()" so that when called in a child interface it can return the child type instead the base type. Will add some document. > > That said, I haven't applied this trick in X509Certificate.Builder, what if there is a 2nd-level child interface? I'll do some experiments. In my experience, self-type parameters usually end up with trouble. It's easier/safer to just override mutators in sub-interfaces to return the more specific type. >> Also in places like this.... >> [...] >> ...it's using UOE for unsupported format, which doesn't seem right. > > It should be IllegalArgumentException, or a sub-type (although I cannot find one). > >> Also, it seems like you could check "type" up at the top. > > I can use Class#isAssignable. > >> >> The docs don't seem to specify whether the CSR block is consumed in the event of an invalid type Class being passed in. > > I just copied the existing spec for generateCertificate(), in fact in some places I haven't done s/certificate/certificate request/ yet! > > The current behavior is that it will consume one ----BEGIN...END---- block (with optional text before the block) or one DER SEQUENCE, or undefined if no such data structure are found. However, I am not sure if I need to document that as a requirement. Do you want any guarantee? I think it's probably a good idea to at least document what happens in the event of various errors. It would be nice if this could be turned into some kind of generalized PEM support some day... -- - DML From sean.mullan at oracle.com Wed Jan 13 20:26:14 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Wed, 13 Jan 2016 15:26:14 -0500 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> Message-ID: <5696B2E6.2070700@oracle.com> On 01/12/2016 08:02 PM, Wang Weijun wrote: > A new webrev at > > http://cr.openjdk.java.net/~weijun/8058778/webrev.09/ > http://cr.openjdk.java.net/~weijun/8058778/webrev.09/specdiff/java/security/cert/package-summary.html > > Changes from webrev.08: > > 1. X509Certificate.Builder addAuthorityKeyIdentifierExtension(); > X509Certificate.Builder addSubjectKeyIdentifierExtension(); > > 2. X509Extension getRawExtensionValue(String oid) > > 3. Spec changes we discussed. > > Still one TODO in X509Certificate.Builder subject(String name). > > Some comments below in line. > >> On Jan 13, 2016, at 5:58 AM, Sean Mullan wrote: >> >> A few more comments for now, but I'll need another day or so to finish my review: >> >> * General >> >> Use @throws instead of @exception > > I'll fix all new lines. Do I need to touch existing ones? It's up to you. >> * X509Certificate >> >> lines 572-585 were removed, but where was it copied? It is not in GeneralName and probably should not be unless we add a toString method. > > I moved them to Buidler#newGeneralName(Type,String). "See {@link GeneralName}" should be "See {@link Builder#newGeneralName(GeneralName.Type, String)} for the formats". > > Or is it always better to keep them in the existing API and add a link the new one? For this case, I think it may be better to duplicate the information, since these are not GeneralName objects. Here are some comments on PKCS10CertificateRequest: - can all of the attributes be represented as extensions or is this just for a PKCS#9 ExtensionRequest attribute? If the latter, you should state that in the class description. It looks like you could also use the PKCS12Attribute class to represent these attributes( same ASN.1 structure) but that name would probably be confusing (in retrospect we should have named it PKCSAttribute or X500Attribute). - the getCertificationRequestInfo, getSignature, and getSigAlgParams methods should say that they return a new array each time they are called. - I think you should rename getSubjectX500Principal to getSubject. (The X500Principal-named methods were needed for X509Certificate to distinguish them from the existing getSubjectDN methods). 82 * As for RFC 1986, the version is always 0. s/1986/2986/ --Sean From weijun.wang at oracle.com Thu Jan 14 06:13:05 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Thu, 14 Jan 2016 14:13:05 +0800 Subject: Design review: JEP 273: DRBG-Based SecureRandom Implementations In-Reply-To: References: <3089B0AC-837D-4E79-BB25-6E6A9EA24318@oracle.com> <5644AF03.5010704@oracle.com> <391452A7-87B2-43FB-86DE-23A07A4E408F@oracle.com> <56462436.1050602@oracle.com> <5A81B95C-3AA6-4051-86AD-416FC21C693F@oracle.com> <564C7DDC.6000902@oracle.com> <564E02A8.5060402@oracle.com> <5D25E347-4D75-41FE-9766-3587FCA4189A@oracle.com> Message-ID: <5168451C-E16F-4B53-AEDB-C97C236BE764@oracle.com> There's been a long time, the current status is http://cr.openjdk.java.net/~weijun/8051408/webrev.03/ http://cr.openjdk.java.net/~weijun/8051408/webrev.03/specdiff/java/security/package-summary.html Two main changes: 1. s/EntropyInput/EntropySource/g. 2. Two methods in EntropySource, getFullEntropy() is only used by CtrDRBG without a derivation function and all generateSeed(), getEntropy() is used elsewhere. To be determined: 1. As 800-90Ar1 9.1 says, the nonce "shall not be provided by the consuming application". Currently the only usage for DrbgParameters.Builder#nonce is the DRBG CAVP test (not included in webrev yet). Shall we remove the related public methods (in DrbgParameters) for compliance? Or, add a comment that these methods "shall not" be called by applications unless they can guarantee the uniqueness? 2. 800-80Ar1 9.2 and 9.3.2 allow requested_security_strength and prediction_resistance_request parameters for the reseed and generation functions. We don't support this now. Unless a child class of SecureRandom is defined, we cannot add these parameters directly to SecureRandom#nextBytes. One solution is to add a SecureRandomParameters parameter there, but we need a place to clearly document which fields inside the parameter is used. 3. The current algorithm names are HashDRBG, HmacDRBG and CtrDRBG. This matches IBM JDK's HASHDRBG name. Or shall we use the names in 800-90Ar1? i.e. Hash_DRBG, HMAC_DRBG, CTR_DRBG? At least as aliases? 4. It seems there should be a "hasPredictionResistance()" method for EntropySource, since reseed() needs to know it. But this JEP is only about DRBG and EntropySource is a very complicated concept. Maybe we can just pretend every EntropySource has prediction resistance at the moment. Thanks Max > On Nov 21, 2015, at 10:40 PM, Wang Weijun wrote: > > >> On Nov 20, 2015, at 8:23 AM, Wang Weijun wrote: >> >>>> 2. For each of these, if you have getInstance(alg, params), there is no getInstance(alg). Obviously, for SecureRandom we need to have both. >>> >>> Right, this is the first case where we have both variants of getInstance. >>> >>> Just looking through the code, it looks like you can change Provider.Service.newInstance() to call the appropriate constructor depending on whether the constructorParameter is null or not. Can you try that? >> >> Good. I'll try. > > I first made this change > > - addEngine("SecureRandom", false, null); > + addEngine("SecureRandom", false, > + "java.security.SecureRandomParameters"); > > and then update this method > > private static Object newInstanceUtil(final Class clazz, > final Class ctrParamClz, final Object ctorParamObj) > throws Exception { > if (ctrParamClz == null) { > Constructor con = clazz.getConstructor(); > return con.newInstance(); > } else { > - Constructor con = clazz.getConstructor(ctrParamClz); > - return con.newInstance(ctorParamObj); > + try { > + Constructor con = clazz.getConstructor(ctrParamClz); > + return con.newInstance(ctorParamObj); > + } catch (NoSuchMethodException nsme) { > + if (ctorParamObj == null) { > + Constructor con = clazz.getConstructor(); > + return con.newInstance(); > + } else { > + throw nsme; > + } > + } > } > } > > For an existing implementation without (SecureRandomParameters), () will be called instead. > > Thanks > Max > From chris.hegarty at oracle.com Thu Jan 14 10:05:16 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 14 Jan 2016 10:05:16 +0000 Subject: RFR [9] 7067728: Remove stopThread default java.policy Message-ID: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> The "stopThread? RuntimePermission is granted by default. The Thread.stop methods have been deprecated for more than 15 years. It seems reasonable, in a major release, to remove the default grant of stopThread. diff --git a/src/java.base/share/conf/security/java.policy b/src/java.base/share/conf/security/java.policy --- a/src/java.base/share/conf/security/java.policy +++ b/src/java.base/share/conf/security/java.policy @@ -94,17 +94,6 @@ // default permissions granted to all domains grant { - // Allows any thread to stop itself using the java.lang.Thread.stop() - // method that takes no argument. - // Note that this permission is granted by default only to remain - // backwards compatible. - // It is strongly recommended that you either remove this permission - // from this policy file or further restrict it to code sources - // that you specify, because Thread.stop() is potentially unsafe. - // See the API specification of java.lang.Thread.stop() for more - // information. - permission java.lang.RuntimePermission "stopThread"; - As a result of this change, untrusted code calling Thread.stop will throw a SecurityException, as it will not have the required permission. The solution, from the deployers perspective, is to add "stopThread? RuntimePermission to the policy file. -Chris. From Alan.Bateman at oracle.com Thu Jan 14 10:14:44 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 14 Jan 2016 10:14:44 +0000 Subject: RFR [9] 7067728: Remove stopThread default java.policy In-Reply-To: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> References: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> Message-ID: <56977514.9080009@oracle.com> On 14/01/2016 10:05, Chris Hegarty wrote: > The "stopThread? RuntimePermission is granted by default. The Thread.stop > methods have been deprecated for more than 15 years. It seems reasonable, > in a major release, to remove the default grant of stopThread. This looks okay to me, we should have dropped granting this permission by default a long time ago. -Alan From david.holmes at oracle.com Thu Jan 14 10:37:34 2016 From: david.holmes at oracle.com (David Holmes) Date: Thu, 14 Jan 2016 20:37:34 +1000 Subject: RFR [9] 7067728: Remove stopThread default java.policy In-Reply-To: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> References: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> Message-ID: <56977A6E.6060202@oracle.com> Hi Chris, I would have expected some tests to need modifying here (or other places!). David On 14/01/2016 8:05 PM, Chris Hegarty wrote: > The "stopThread? RuntimePermission is granted by default. The Thread.stop > methods have been deprecated for more than 15 years. It seems reasonable, > in a major release, to remove the default grant of stopThread. > > diff --git a/src/java.base/share/conf/security/java.policy b/src/java.base/share/conf/security/java.policy > --- a/src/java.base/share/conf/security/java.policy > +++ b/src/java.base/share/conf/security/java.policy > @@ -94,17 +94,6 @@ > // default permissions granted to all domains > > grant { > - // Allows any thread to stop itself using the java.lang.Thread.stop() > - // method that takes no argument. > - // Note that this permission is granted by default only to remain > - // backwards compatible. > - // It is strongly recommended that you either remove this permission > - // from this policy file or further restrict it to code sources > - // that you specify, because Thread.stop() is potentially unsafe. > - // See the API specification of java.lang.Thread.stop() for more > - // information. > - permission java.lang.RuntimePermission "stopThread"; > - > > As a result of this change, untrusted code calling Thread.stop will throw a > SecurityException, as it will not have the required permission. The solution, > from the deployers perspective, is to add "stopThread? RuntimePermission > to the policy file. > > -Chris. > From chris.hegarty at oracle.com Thu Jan 14 10:40:15 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 14 Jan 2016 10:40:15 +0000 Subject: RFR [9] 7067728: Remove stopThread default java.policy In-Reply-To: <56977A6E.6060202@oracle.com> References: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> <56977A6E.6060202@oracle.com> Message-ID: On 14 Jan 2016, at 10:37, David Holmes wrote: > Hi Chris, > > I would have expected some tests to need modifying here (or other places!). I haven?t seen any test failures resulting from this change ( not sure if that is a good or a bad thing! ). Though, there were several implementation bugs that needed to be resolved before being able to remove default grant. -Chris. > David > > On 14/01/2016 8:05 PM, Chris Hegarty wrote: >> The "stopThread? RuntimePermission is granted by default. The Thread.stop >> methods have been deprecated for more than 15 years. It seems reasonable, >> in a major release, to remove the default grant of stopThread. >> >> diff --git a/src/java.base/share/conf/security/java.policy b/src/java.base/share/conf/security/java.policy >> --- a/src/java.base/share/conf/security/java.policy >> +++ b/src/java.base/share/conf/security/java.policy >> @@ -94,17 +94,6 @@ >> // default permissions granted to all domains >> >> grant { >> - // Allows any thread to stop itself using the java.lang.Thread.stop() >> - // method that takes no argument. >> - // Note that this permission is granted by default only to remain >> - // backwards compatible. >> - // It is strongly recommended that you either remove this permission >> - // from this policy file or further restrict it to code sources >> - // that you specify, because Thread.stop() is potentially unsafe. >> - // See the API specification of java.lang.Thread.stop() for more >> - // information. >> - permission java.lang.RuntimePermission "stopThread"; >> - >> >> As a result of this change, untrusted code calling Thread.stop will throw a >> SecurityException, as it will not have the required permission. The solution, >> from the deployers perspective, is to add "stopThread? RuntimePermission >> to the policy file. >> >> -Chris. >> From sean.mullan at oracle.com Thu Jan 14 13:49:19 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Thu, 14 Jan 2016 08:49:19 -0500 Subject: RFR [9] 7067728: Remove stopThread default java.policy In-Reply-To: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> References: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> Message-ID: <5697A75F.60109@oracle.com> Looks good to me. --Sean On 01/14/2016 05:05 AM, Chris Hegarty wrote: > The "stopThread? RuntimePermission is granted by default. The Thread.stop > methods have been deprecated for more than 15 years. It seems reasonable, > in a major release, to remove the default grant of stopThread. > > diff --git a/src/java.base/share/conf/security/java.policy b/src/java.base/share/conf/security/java.policy > --- a/src/java.base/share/conf/security/java.policy > +++ b/src/java.base/share/conf/security/java.policy > @@ -94,17 +94,6 @@ > // default permissions granted to all domains > > grant { > - // Allows any thread to stop itself using the java.lang.Thread.stop() > - // method that takes no argument. > - // Note that this permission is granted by default only to remain > - // backwards compatible. > - // It is strongly recommended that you either remove this permission > - // from this policy file or further restrict it to code sources > - // that you specify, because Thread.stop() is potentially unsafe. > - // See the API specification of java.lang.Thread.stop() for more > - // information. > - permission java.lang.RuntimePermission "stopThread"; > - > > As a result of this change, untrusted code calling Thread.stop will throw a > SecurityException, as it will not have the required permission. The solution, > from the deployers perspective, is to add "stopThread? RuntimePermission > to the policy file. > > -Chris. > From mandy.chung at oracle.com Thu Jan 14 16:52:54 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 14 Jan 2016 08:52:54 -0800 Subject: RFR [9] 7067728: Remove stopThread default java.policy In-Reply-To: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> References: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> Message-ID: <0616B189-6042-44D4-A8B1-8D19A0860D97@oracle.com> > On Jan 14, 2016, at 2:05 AM, Chris Hegarty wrote: > > The "stopThread? RuntimePermission is granted by default. The Thread.stop > methods have been deprecated for more than 15 years. It seems reasonable, > in a major release, to remove the default grant of stopThread. +1 to remove "stopThread? RuntimePermission from java.policy. There are existing tests whose grants this "stopThread? RuntimePermission that may not be needed for the test. The test policy likely copies that from the default system java.policy. We should update these test policy as well. >> >> I would have expected some tests to need modifying here (or other places!). > > I haven?t seen any test failures resulting from this change ( not sure > if that is a good or a bad thing! ). Though, there were several implementation > bugs that needed to be resolved before being able to remove default grant. jtreg policy tag overrides the system default security policy with the specified file. Tests that call Thread::stop and tested with security manager must have "stopThread? RuntimePermission set in the test policy. jtreg was enhanced to add a new java.security.policy tag to extend the system security policy [1]. Only tests using java.security.policy tag and calling Thread::stop will need to be modified. Mandy [1] https://bugs.openjdk.java.net/browse/CODETOOLS-7900898 From chris.hegarty at oracle.com Thu Jan 14 17:19:59 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 14 Jan 2016 17:19:59 +0000 Subject: RFR [9] 7067728: Remove stopThread default java.policy In-Reply-To: <0616B189-6042-44D4-A8B1-8D19A0860D97@oracle.com> References: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> <0616B189-6042-44D4-A8B1-8D19A0860D97@oracle.com> Message-ID: <05B81539-8555-452C-AD7E-41746C8CE5D0@oracle.com> On 14 Jan 2016, at 16:52, Mandy Chung wrote: >> On Jan 14, 2016, at 2:05 AM, Chris Hegarty wrote: >> >> The "stopThread? RuntimePermission is granted by default. The Thread.stop >> methods have been deprecated for more than 15 years. It seems reasonable, >> in a major release, to remove the default grant of stopThread. > > +1 to remove "stopThread? RuntimePermission from java.policy. Thanks for the review Mandy. > There are existing tests whose grants this "stopThread? RuntimePermission that may not be needed for the test. The test policy likely copies that from the default system java.policy. We should update these test policy as well. I do see a few of these, and some will need discussion. Ok if I file a separate bug on these, they are not directly related to this change, and do still pass, just that the permission is superfluous. >>> I would have expected some tests to need modifying here (or other places!). >> >> I haven?t seen any test failures resulting from this change ( not sure >> if that is a good or a bad thing! ). Though, there were several implementation >> bugs that needed to be resolved before being able to remove default grant. > > jtreg policy tag overrides the system default security policy with the specified file. Tests that call Thread::stop and tested with security manager must have "stopThread? RuntimePermission set in the test policy. jtreg was enhanced to add a new java.security.policy tag to extend the system security policy [1]. Thanks for this explanation. I always get confused with how jtreg supports this. > Only tests using java.security.policy tag and calling Thread::stop will need to be modified. I can find no such tests. -Chris. > Mandy > [1] https://bugs.openjdk.java.net/browse/CODETOOLS-7900898 From mandy.chung at oracle.com Thu Jan 14 17:29:54 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 14 Jan 2016 09:29:54 -0800 Subject: RFR [9] 7067728: Remove stopThread default java.policy In-Reply-To: <05B81539-8555-452C-AD7E-41746C8CE5D0@oracle.com> References: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> <0616B189-6042-44D4-A8B1-8D19A0860D97@oracle.com> <05B81539-8555-452C-AD7E-41746C8CE5D0@oracle.com> Message-ID: <71226EC2-EF9B-41F7-996E-B14D07B91C3F@oracle.com> > On Jan 14, 2016, at 9:19 AM, Chris Hegarty wrote: > >> There are existing tests whose grants this "stopThread? RuntimePermission that may not be needed for the test. The test policy likely copies that from the default system java.policy. We should update these test policy as well. > > I do see a few of these, and some will need discussion. Ok if I file a separate > bug on these, they are not directly related to this change, and do still pass, just > that the permission is superfluous. > Taking it out from the test policy file should be non-controversial and trivial to verify. I can see why you prefer to separate the test update from this change and I?m okay. >>>> I would have expected some tests to need modifying here (or other places!). >>> >>> I haven?t seen any test failures resulting from this change ( not sure >>> if that is a good or a bad thing! ). Though, there were several implementation >>> bugs that needed to be resolved before being able to remove default grant. >> >> jtreg policy tag overrides the system default security policy with the specified file. Tests that call Thread::stop and tested with security manager must have "stopThread? RuntimePermission set in the test policy. jtreg was enhanced to add a new java.security.policy tag to extend the system security policy [1]. > > Thanks for this explanation. I always get confused with how jtreg supports > this. > >> Only tests using java.security.policy tag and calling Thread::stop will need to be modified. > > I can find no such tests. That matches what I expect since most of the tests using the new java.security.policy tag are related to deprivileging work and new tests only. Mandy From chris.hegarty at oracle.com Thu Jan 14 17:32:09 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 14 Jan 2016 17:32:09 +0000 Subject: RFR [9] 7067728: Remove stopThread default java.policy In-Reply-To: <71226EC2-EF9B-41F7-996E-B14D07B91C3F@oracle.com> References: <80854855-CF11-4C11-8AD2-71C34436E309@oracle.com> <0616B189-6042-44D4-A8B1-8D19A0860D97@oracle.com> <05B81539-8555-452C-AD7E-41746C8CE5D0@oracle.com> <71226EC2-EF9B-41F7-996E-B14D07B91C3F@oracle.com> Message-ID: <098CD8EF-9BF0-4253-AEC0-164045E5643A@oracle.com> On 14 Jan 2016, at 17:29, Mandy Chung wrote: > >> On Jan 14, 2016, at 9:19 AM, Chris Hegarty wrote: >> >>> There are existing tests whose grants this "stopThread? RuntimePermission that may not be needed for the test. The test policy likely copies that from the default system java.policy. We should update these test policy as well. >> >> I do see a few of these, and some will need discussion. Ok if I file a separate >> bug on these, they are not directly related to this change, and do still pass, just >> that the permission is superfluous. >> > > Taking it out from the test policy file should be non-controversial and trivial to verify. Right. I was thinking that maybe these tests should be updated to use the new jtreg machanism, java.security.policy, rather than just removing stopThread? > I can see why you prefer to separate the test update from this change and I?m okay. Thanks. I?ll file a bug on it. > >>>>> I would have expected some tests to need modifying here (or other places!). >>>> >>>> I haven?t seen any test failures resulting from this change ( not sure >>>> if that is a good or a bad thing! ). Though, there were several implementation >>>> bugs that needed to be resolved before being able to remove default grant. >>> >>> jtreg policy tag overrides the system default security policy with the specified file. Tests that call Thread::stop and tested with security manager must have "stopThread? RuntimePermission set in the test policy. jtreg was enhanced to add a new java.security.policy tag to extend the system security policy [1]. >> >> Thanks for this explanation. I always get confused with how jtreg supports >> this. >> >>> Only tests using java.security.policy tag and calling Thread::stop will need to be modified. >> >> I can find no such tests. > > That matches what I expect since most of the tests using the new java.security.policy tag are related to deprivileging work and new tests only. Great. -Chris. From valerie.peng at oracle.com Thu Jan 14 22:21:18 2016 From: valerie.peng at oracle.com (Valerie Peng) Date: Thu, 14 Jan 2016 14:21:18 -0800 Subject: [xs] RFR: 8146967: [TEST_BUG] javax/security/auth/SubjectDomainCombiner/Optimize.java should use 4-args ProtectionDomain constructor In-Reply-To: <56960636.2090208@oracle.com> References: <56960636.2090208@oracle.com> Message-ID: <56981F5E.1050904@oracle.com> The changes look fine. However, this fix should apply to all versions of JDKs. When running against newer versions of JDK, this test accidentally passes due to other SubjectDomainCombiner regression tests and went through a different code path. Thanks, Valerie On 1/13/2016 12:09 AM, Ivan Gerasimov wrote: > Hello! > > Would you please help review the fix that solves the issue spotted > when running the test with earlier version of jdk? > > BUGURL: https://bugs.openjdk.java.net/browse/JDK-8146967 > WEBREV: http://cr.openjdk.java.net/~igerasim/8146967/00/webrev/ > > Sincerely yours, > Ivan From sean.mullan at oracle.com Fri Jan 15 19:54:59 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Fri, 15 Jan 2016 14:54:59 -0500 Subject: Code Review Request 8146669 Test SessionTimeOutTests fails intermittently In-Reply-To: <569617A9.7040803@oracle.com> References: <569617A9.7040803@oracle.com> Message-ID: <56994E93.4090704@oracle.com> It seems like it would be cleaner to use AtomicBoolean for serverReady since you are just checking if it is on or off. Otherwise looks fine. --Sean On 01/13/2016 04:23 AM, Xuelei Fan wrote: > Hi, > > Please review the intermittently test failure fix. > > http://cr.openjdk.java.net/~xuelei/8146669/webrev.00/ > > In the updated test case, an integer (createdPorts) is used to count the > server sockets. Every server socket is created in a new thread. The > access and update to createdPorts should be synchronized for multiple > threading safe. Update to use AtomicInteger.getAndIncrement() so that > the access and update to createdPorts is atomic. > > Thanks, > Xuelei > From xuelei.fan at oracle.com Sat Jan 16 00:09:44 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Sat, 16 Jan 2016 08:09:44 +0800 Subject: Code Review Request 8146669 Test SessionTimeOutTests fails intermittently In-Reply-To: <56994E93.4090704@oracle.com> References: <569617A9.7040803@oracle.com> <56994E93.4090704@oracle.com> Message-ID: <56998A48.1010701@oracle.com> On 1/16/2016 3:54 AM, Sean Mullan wrote: > It seems like it would be cleaner to use AtomicBoolean for serverReady > since you are just checking if it is on or off. Yes. However, the test may be update to support multiple server sockets. If using AtomicBoolean, need a synchronized block to check the ready state and update serverReady to true. For such situations, it is a little bit more simple to use AtomicInteger. Thanks, Xuelei > Otherwise looks fine. > > --Sean > > On 01/13/2016 04:23 AM, Xuelei Fan wrote: >> Hi, >> >> Please review the intermittently test failure fix. >> >> http://cr.openjdk.java.net/~xuelei/8146669/webrev.00/ >> >> In the updated test case, an integer (createdPorts) is used to count the >> server sockets. Every server socket is created in a new thread. The >> access and update to createdPorts should be synchronized for multiple >> threading safe. Update to use AtomicInteger.getAndIncrement() so that >> the access and update to createdPorts is atomic. >> >> Thanks, >> Xuelei >> From rob.mckenna at oracle.com Mon Jan 18 06:54:58 2016 From: rob.mckenna at oracle.com (Rob McKenna) Date: Mon, 18 Jan 2016 06:54:58 +0000 Subject: RFR: 8064330 - Remove SHA224 from the default support list if SunMSCAPI enabled Message-ID: <569C8C42.3040905@oracle.com> Hi folks, SunJSSE enables SHA224 as an available signature and hash algorithm of TLS 1.2 connections. However, the current implementation of SunMSCAPI does not support SHA224 yet, and the private key in SunMSCAPI cannot work together with other providers. This may cause problems if applications use SunMSCAPI for their private keys and use SHA224 at the same time. The solution is to remove SHA224 from the default support list if MSCAPI is enabled: http://cr.openjdk.java.net/~robm/8064330/webrev.01/ -Rob From xuelei.fan at oracle.com Mon Jan 18 10:53:35 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Mon, 18 Jan 2016 18:53:35 +0800 Subject: RFR: 8064330 - Remove SHA224 from the default support list if SunMSCAPI enabled In-Reply-To: <569C8C42.3040905@oracle.com> References: <569C8C42.3040905@oracle.com> Message-ID: <569CC42F.1090801@oracle.com> Looks fine to me. Xuelei On 1/18/2016 2:54 PM, Rob McKenna wrote: > Hi folks, > > SunJSSE enables SHA224 as an available signature and hash algorithm of > TLS 1.2 connections. However, the current implementation of SunMSCAPI > does not support SHA224 yet, and the private key in SunMSCAPI cannot > work together with other providers. This may cause problems if > applications use SunMSCAPI for their private keys and use SHA224 at the > same time. > > The solution is to remove SHA224 from the default support list if MSCAPI > is enabled: > > http://cr.openjdk.java.net/~robm/8064330/webrev.01/ > > -Rob > From weijun.wang at oracle.com Tue Jan 19 03:20:54 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Tue, 19 Jan 2016 11:20:54 +0800 Subject: RFR 8058778: New APIs for creating certificates and certificate requests In-Reply-To: <5696567D.1090207@redhat.com> References: <428C6B73-68AD-4168-BE1D-97DC2A06460A@oracle.com> <0DBE13DD-6680-4CA3-B8E8-8897966E0860@oracle.com> <56703789.7060908@oracle.com> <9AA4D1D2-098C-4797-8B72-4C0BC0947C89@oracle.com> <568EE150.10406@oracle.com> <724938C1-5B3E-4963-AC68-822AA578A5A9@oracle.com> <56901ECE.3060009@oracle.com> <2A28C2F3-D290-48CD-B17A-5726F52C2643@oracle.com> <56957719.2010508@oracle.com> <95984955-3ACA-4D76-AE50-02831243B862@oracle.com> <56963E3A.5020604@redhat.com> <933CF711-784A-4AD9-A915-FE5840C6D093@oracle.com> <5696567D.1090207@redhat.com> Message-ID: <55D2A185-B7F7-4EA4-87AE-F97137815A96@oracle.com> > On Jan 13, 2016, at 9:51 PM, David M. Lloyd wrote: > >> The current behavior is that it will consume one ----BEGIN...END---- block (with optional text before the block) or one DER SEQUENCE, or undefined if no such data structure are found. However, I am not sure if I need to document that as a requirement. Do you want any guarantee? > > I think it's probably a good idea to at least document what happens in the event of various errors. *

If an unsupported {@code type} is provided, an * {@link IllegalArgumentException} will be thrown and {@code inStream} * will not be consumed. If a parsing error is encountered, a * {@link CertificateException} will be thrown and the read position of * {@code inStream} is undefined. --Max From sean.mullan at oracle.com Tue Jan 19 21:16:07 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 19 Jan 2016 16:16:07 -0500 Subject: RFR: 8133085- Remove old style (pre-JDK 1.4) "new SunJCE()" provider calls in tests. Fails to compile. In-Reply-To: <8e461124-8f3f-4e32-8477-41eee5437ec3@default> References: <0ed013aa-b95a-4db8-9bd3-db3274d3de0f@default> <568FE522.1080905@oracle.com> <56900787.9000309@oracle.com> <8e461124-8f3f-4e32-8477-41eee5437ec3@default> Message-ID: <569EA797.9060207@oracle.com> Seems fine to me. --Sean On 01/12/2016 04:37 AM, Bhanu Gopularam wrote: > Hi all, > > Please see the updated webrev: > http://cr.openjdk.java.net/~ntv/bhanu/8133085/webrev.01/ > > Changes: Reverted changes to tests running in FIPS mode and added 2016 to copyright. > > Thanks, > Bhanu > > -----Original Message----- > From: Bradford Wetmore > Sent: Saturday, January 09, 2016 12:31 AM > To: Sean Mullan; Bhanu Gopularam; security-dev at openjdk.java.net > Subject: Re: RFR: 8133085- Remove old style (pre-JDK 1.4) "new SunJCE()" provider calls in tests. Fails to compile. > > (Xuelei, see below) > > Bhanu, > > The proposed ClientJSSEServerJSSE.java/TrustManagerTest.java changes are incorrect. These tests are setting JSSE into FIPS mode, so this test should be correct as is. > > Brad > > > > On 1/8/2016 8:34 AM, Sean Mullan wrote: >> Please update copyrights to include 2016. Otherwise, looks fine to me. >> >> --Sean >> >> On 01/08/2016 02:54 AM, Bhanu Gopularam wrote: >>> Hi all, >>> >>> Please review a fix for following bug: >>> >>> Bug Id -https://bugs.openjdk.java.net/browse/JDK-8133085 >>> >>> Issue - Some security regression tests are directly instantiating the >>> security providers instead of using the registered providers. Most of >>> the cases the issue can be corrected by using registered security >>> providers which are available during execution and instance need not >>> be created. >>> >>> Solution - Refactored tests which are directly instantiating the >>> security provider to use the registered ones. Fixes also include >>> couple of tests which run on Solaris environment. >>> >>> ->sun/security/pkcs11/fips/TrustManagerTest.java >>> >>> ->sun/security/pkcs11/fips/ClientJSSEServerJSSE.java >>> >>> Webrev - http://cr.openjdk.java.net/~ntv/bhanu/8133085/webrev/ >>> >>> Thanks, >>> >>> Bhanu >>> From xuelei.fan at oracle.com Wed Jan 20 01:14:50 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Wed, 20 Jan 2016 09:14:50 +0800 Subject: Code Review Request 8144566, Custom HostnameVerifier disables SNI extension In-Reply-To: <5666C93E.6010306@oracle.com> References: <56642AD3.6010904@oracle.com> <56662275.5000007@oracle.com> <5666C93E.6010306@oracle.com> Message-ID: <569EDF8A.5000603@oracle.com> Ping ... On 12/8/2015 8:12 PM, Xuelei Fan wrote: > Good catch! > > I copied the comment here: > > ---------- > SocketFactory sslsf = SSLSocketFactory.getDefault(); > SSLSocket ssls = (SSLSocket) sslsf.createSocket(); > ssls.connect(new InetSocketAddress( > "bugs.openjdk.java.net", 443), 0); > ssls.startHandshake(); > > No SNI is sent in this case. > ---------- > > Although this is not a regression, but this is a very good catch. > > However, I don't think the code path is a best practice, as the actual > behavior depends on providers behaviors and platform behaviors too much. > I would recommend to use SSLParameters.setServerNames() to specify the > server names explicitly. > > But, best effort should be made for the default server names for such > code paths. Here is the webrev that also fixes this code path issue: > > http://cr.openjdk.java.net/~xuelei/8144566/webrev.01/ > > The fix gets a little bit complicated because of the need to consider > the SSLParameters.setServerNames() impact in the code path: > > SSLSocket ssls = (SSLSocket) sslsf.createSocket(); > > // before the connection, need to consider the impact: > // Get the SSLParameters from the socket, or create on the fly? > // Call ssls.setSSLParameters(params) or not? > ssls.connect(socketAddress); > > // after the connection, need to consider the impact: > // Call ssls.setSSLParameters(params) or not? > > Basically, the implementation honors the server name set by > SSLParameters.setServerNames(). > > Bernd's comment: >> Isnt this codepath used as a workaround for dynamically disabling >> SNI? Using connect(host..) instead of SSLSocket(host) was at >> least a common, well known workaround. > If the code path is really used in practice, the > SSLParameters.setServerNames() would better be called actually to > disable SNI explicitly. > > SocketFactory sslsf = SSLSocketFactory.getDefault(); > SSLSocket ssls = (SSLSocket) sslsf.createSocket(); > ssls.connect(new InetSocketAddress( > "bugs.openjdk.java.net", 443), 0); > sslParameters.setServerNames(emptyList); > ssls.setSSLParameters(sslParameters); > ssls.startHandshake(); > > Thank you, Bernd and Brad, for the feedback. > > Thanks, > Xuelei > > On 12/8/2015 8:21 AM, Bradford Wetmore wrote: >> >> Please see my comment in the bug. I haven't verified this, but it seems >> the problem might be generic to the codepath through SSLSocket, not just >> Https. >> >> Brad >> >> >> >> >> >> On 12/6/2015 4:32 AM, Xuelei Fan wrote: >>> Hi, >>> >>> Please review the update for JDK-8144566: >>> >>> http://cr.openjdk.java.net/~xuelei/8144566/webrev.00/ >>> >>> For HttpsURLConnection, the server name may be set after the TLS >>> connection and handshake has been initialized. As may result in that >>> the server name does not present at TLS ClientHello messages. >>> >>> This fix resets the server name for the initialized handshake for above >>> cases. >>> >>> Thanks, >>> Xuelei >>> > From weijun.wang at oracle.com Wed Jan 20 03:32:09 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 20 Jan 2016 11:32:09 +0800 Subject: RFR 8147772: Some KerberosTicket methods throw NPE after being destroyed Message-ID: <022E107A-FCAB-43E0-B860-EB6CC1E7A120@oracle.com> http://cr.openjdk.java.net/~weijun/8147772/webrev.00/ No spec change, just safer return value. Thanks Max From sean.mullan at oracle.com Wed Jan 20 13:36:29 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Wed, 20 Jan 2016 08:36:29 -0500 Subject: RFR 8147772: Some KerberosTicket methods throw NPE after being destroyed In-Reply-To: <022E107A-FCAB-43E0-B860-EB6CC1E7A120@oracle.com> References: <022E107A-FCAB-43E0-B860-EB6CC1E7A120@oracle.com> Message-ID: <569F8D5D.3020205@oracle.com> On 01/19/2016 10:32 PM, Wang Weijun wrote: > http://cr.openjdk.java.net/~weijun/8147772/webrev.00/ > > No spec change, just safer return value. I think it would be useful to update the specification to indicate how these methods behave when the object has been destroyed. I also noticed that many of the methods do not declare that they throw IllegalStateException when destroyed, so I think a general cleanup of the specification would be a good thing to do as part of this issue for JDK 9. Thanks, Sean From weijun.wang at oracle.com Wed Jan 20 13:52:56 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 20 Jan 2016 21:52:56 +0800 Subject: RFR 8147772: Some KerberosTicket methods throw NPE after being destroyed In-Reply-To: <569F8D5D.3020205@oracle.com> References: <022E107A-FCAB-43E0-B860-EB6CC1E7A120@oracle.com> <569F8D5D.3020205@oracle.com> Message-ID: You mean let them throw an ISE after destroyed? Not sure if it is backportable. The problem is reported by customers using an old JRE. --Max > On Jan 20, 2016, at 9:36 PM, Sean Mullan wrote: > > On 01/19/2016 10:32 PM, Wang Weijun wrote: >> http://cr.openjdk.java.net/~weijun/8147772/webrev.00/ >> >> No spec change, just safer return value. > > I think it would be useful to update the specification to indicate how these methods behave when the object has been destroyed. I also noticed that many of the methods do not declare that they throw IllegalStateException when destroyed, so I think a general cleanup of the specification would be a good thing to do as part of this issue for JDK 9. > > Thanks, > Sean From sean.mullan at oracle.com Wed Jan 20 14:14:40 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Wed, 20 Jan 2016 09:14:40 -0500 Subject: RFR 8147772: Some KerberosTicket methods throw NPE after being destroyed In-Reply-To: References: <022E107A-FCAB-43E0-B860-EB6CC1E7A120@oracle.com> <569F8D5D.3020205@oracle.com> Message-ID: <569F9650.4000105@oracle.com> On 01/20/2016 08:52 AM, Wang Weijun wrote: > You mean let them throw an ISE after destroyed? Not sure if it is backportable. No, I am just talking about documenting existing behavior, ex: For these methods, I would add: This method returns null if the ticket has been destroyed. For other methods that already throw ISE, I would add: @throws IllegalStateException if the ticket has been destroyed --Sean > > The problem is reported by customers using an old JRE. > > --Max > >> On Jan 20, 2016, at 9:36 PM, Sean Mullan wrote: >> >> On 01/19/2016 10:32 PM, Wang Weijun wrote: >>> http://cr.openjdk.java.net/~weijun/8147772/webrev.00/ >>> >>> No spec change, just safer return value. >> >> I think it would be useful to update the specification to indicate how these methods behave when the object has been destroyed. I also noticed that many of the methods do not declare that they throw IllegalStateException when destroyed, so I think a general cleanup of the specification would be a good thing to do as part of this issue for JDK 9. >> >> Thanks, >> Sean > From weijun.wang at oracle.com Wed Jan 20 14:13:14 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 20 Jan 2016 22:13:14 +0800 Subject: RFR 8147772: Some KerberosTicket methods throw NPE after being destroyed In-Reply-To: <569F9650.4000105@oracle.com> References: <022E107A-FCAB-43E0-B860-EB6CC1E7A120@oracle.com> <569F8D5D.3020205@oracle.com> <569F9650.4000105@oracle.com> Message-ID: <58C6F6DD-3D54-41A8-961A-A5EEB739376C@oracle.com> > On Jan 20, 2016, at 10:14 PM, Sean Mullan wrote: > > On 01/20/2016 08:52 AM, Wang Weijun wrote: >> You mean let them throw an ISE after destroyed? Not sure if it is backportable. > > No, I am just talking about documenting existing behavior, ex: > > For these methods, I would add: > > This method returns null if the ticket has been destroyed. They don't return null, an NPE is thrown. So I have to fix it in some way. --Max > > For other methods that already throw ISE, I would add: > > @throws IllegalStateException if the ticket has been destroyed > > --Sean > >> >> The problem is reported by customers using an old JRE. >> >> --Max >> >>> On Jan 20, 2016, at 9:36 PM, Sean Mullan wrote: >>> >>> On 01/19/2016 10:32 PM, Wang Weijun wrote: >>>> http://cr.openjdk.java.net/~weijun/8147772/webrev.00/ >>>> >>>> No spec change, just safer return value. >>> >>> I think it would be useful to update the specification to indicate how these methods behave when the object has been destroyed. I also noticed that many of the methods do not declare that they throw IllegalStateException when destroyed, so I think a general cleanup of the specification would be a good thing to do as part of this issue for JDK 9. >>> >>> Thanks, >>> Sean >> From sean.mullan at oracle.com Wed Jan 20 14:18:37 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Wed, 20 Jan 2016 09:18:37 -0500 Subject: RFR 8147772: Some KerberosTicket methods throw NPE after being destroyed In-Reply-To: <58C6F6DD-3D54-41A8-961A-A5EEB739376C@oracle.com> References: <022E107A-FCAB-43E0-B860-EB6CC1E7A120@oracle.com> <569F8D5D.3020205@oracle.com> <569F9650.4000105@oracle.com> <58C6F6DD-3D54-41A8-961A-A5EEB739376C@oracle.com> Message-ID: <569F973D.9000005@oracle.com> On 01/20/2016 09:13 AM, Wang Weijun wrote: > >> On Jan 20, 2016, at 10:14 PM, Sean Mullan wrote: >> >> On 01/20/2016 08:52 AM, Wang Weijun wrote: >>> You mean let them throw an ISE after destroyed? Not sure if it is backportable. >> >> No, I am just talking about documenting existing behavior, ex: >> >> For these methods, I would add: >> >> This method returns null if the ticket has been destroyed. > > They don't return null, an NPE is thrown. So I have to fix it in some way. Sorry, I meant to say "document the new behavior for the methods in this webrev and existing behavior for the other methods with respect to when the ticket has been destroyed." --Sean > > --Max > >> >> For other methods that already throw ISE, I would add: >> >> @throws IllegalStateException if the ticket has been destroyed >> >> --Sean >> >>> >>> The problem is reported by customers using an old JRE. >>> >>> --Max >>> >>>> On Jan 20, 2016, at 9:36 PM, Sean Mullan wrote: >>>> >>>> On 01/19/2016 10:32 PM, Wang Weijun wrote: >>>>> http://cr.openjdk.java.net/~weijun/8147772/webrev.00/ >>>>> >>>>> No spec change, just safer return value. >>>> >>>> I think it would be useful to update the specification to indicate how these methods behave when the object has been destroyed. I also noticed that many of the methods do not declare that they throw IllegalStateException when destroyed, so I think a general cleanup of the specification would be a good thing to do as part of this issue for JDK 9. >>>> >>>> Thanks, >>>> Sean >>> > From weijun.wang at oracle.com Wed Jan 20 14:22:04 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 20 Jan 2016 22:22:04 +0800 Subject: RFR 8147772: Some KerberosTicket methods throw NPE after being destroyed In-Reply-To: <569F973D.9000005@oracle.com> References: <022E107A-FCAB-43E0-B860-EB6CC1E7A120@oracle.com> <569F8D5D.3020205@oracle.com> <569F9650.4000105@oracle.com> <58C6F6DD-3D54-41A8-961A-A5EEB739376C@oracle.com> <569F973D.9000005@oracle.com> Message-ID: > On Jan 20, 2016, at 10:18 PM, Sean Mullan wrote: > > On 01/20/2016 09:13 AM, Wang Weijun wrote: >> >>> On Jan 20, 2016, at 10:14 PM, Sean Mullan wrote: >>> >>> On 01/20/2016 08:52 AM, Wang Weijun wrote: >>>> You mean let them throw an ISE after destroyed? Not sure if it is backportable. >>> >>> No, I am just talking about documenting existing behavior, ex: >>> >>> For these methods, I would add: >>> >>> This method returns null if the ticket has been destroyed. >> >> They don't return null, an NPE is thrown. So I have to fix it in some way. > > Sorry, I meant to say "document the new behavior for the methods in this webrev and existing behavior for the other methods with respect to when the ticket has been destroyed." I see. So you agree with my code changes but ask me to document them. --Max From mark at p6r.com Tue Jan 12 01:38:37 2016 From: mark at p6r.com (Mark Joseph) Date: Mon, 11 Jan 2016 17:38:37 -0800 Subject: An issue with keytool and PKCS11 Message-ID: <863235152-25297@mail.p6r.com> Hi, ? ?We are a PKCS#11 vendor and we are in the process of integrating our C library with keytool and jarsigner. ?? We are executing the following comand line. ? keytool ?-keystore NONE -storetype PKCS11 -storepass 12345678 -providerName SunPKCS11-P6Rtoken -providerclass sun.security.pkcs11.SunPKCS11 -providerarg E:\work\SKC_OPT_2015_2\p6r.cfg -genkeypair -keyalg RSA -keysize 2048 -alias p6rsignkey -v We are doing this on Windows, and we are using the latest Java keytool out of the JDK. ? Our library is 64 bits and the Java version we have installed is 64 bits. Now what we are seeing is strange. ? ?The above worked one time with the key pair being generated and stored in our PKCS11 library. Then we reset everything and continued to do testing and the result was that keytool again created a Certificate and a Private key and placed them into our PKCS11 library. ? However, instead of finishing by creating the key pair by calling our PKCS11 library it just stopped and returned. ? There was no error or exception printed out. ? So we are stuck not knowing what is wrong? ? ?Any one seen this before or have a way we can see why the keytool is "aborting" out of running? Best, Mark Joseph P6R, Inc -------------- next part -------------- An HTML attachment was scrubbed... URL: From weijun.wang at oracle.com Thu Jan 21 00:36:54 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Thu, 21 Jan 2016 08:36:54 +0800 Subject: An issue with keytool and PKCS11 In-Reply-To: <863235152-25297@mail.p6r.com> References: <863235152-25297@mail.p6r.com> Message-ID: Can you add a -debug option and show me the full output? You can also add a -J-Djava.security.debug=all but I am not sure if the output is useful. --Max > On Jan 12, 2016, at 9:38 AM, Mark Joseph wrote: > > Hi, > > We are a PKCS#11 vendor and we are in the process of integrating our C library with keytool and jarsigner. > > We are executing the following comand line. > > keytool -keystore NONE -storetype PKCS11 -storepass 12345678 -providerName SunPKCS11-P6Rtoken -providerclass sun.security.pkcs11.SunPKCS11 -providerarg E:\work\SKC_OPT_2015_2\p6r.cfg -genkeypair -keyalg RSA -keysize 2048 -alias p6rsignkey -v > > We are doing this on Windows, and we are using the latest Java keytool out of the JDK. > Our library is 64 bits and the Java version we have installed is 64 bits. > > Now what we are seeing is strange. The above worked one time with the key pair being generated and stored in our PKCS11 library. > > Then we reset everything and continued to do testing and the result was that keytool again created a Certificate and a Private key and placed them into our PKCS11 library. > > However, instead of finishing by creating the key pair by calling our PKCS11 library it just stopped and returned. There was no error or exception printed out. > > So we are stuck not knowing what is wrong? Any one seen this before or have a way we can see why the keytool is "aborting" out of running? > > > > Best, > Mark Joseph > P6R, Inc From rob.mckenna at oracle.com Thu Jan 21 10:26:10 2016 From: rob.mckenna at oracle.com (Rob McKenna) Date: Thu, 21 Jan 2016 10:26:10 +0000 Subject: RFR: 8147931 - Incorrect edits for JDK-8064330 Message-ID: <56A0B242.4000207@oracle.com> Apologies folks, managed to overwrite a changeset when pushing 8064330 a few minutes ago. Looking to rectify asap: http://cr.openjdk.java.net/~robm/8147931/webrev.01/ -Rob From sean.coffey at oracle.com Thu Jan 21 10:29:50 2016 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Thu, 21 Jan 2016 10:29:50 +0000 Subject: RFR: 8147931 - Incorrect edits for JDK-8064330 In-Reply-To: <56A0B242.4000207@oracle.com> References: <56A0B242.4000207@oracle.com> Message-ID: <56A0B31E.7070303@oracle.com> Looks good. Regards, Sean. On 21/01/2016 10:26, Rob McKenna wrote: > Apologies folks, managed to overwrite a changeset when pushing 8064330 > a few minutes ago. Looking to rectify asap: > > http://cr.openjdk.java.net/~robm/8147931/webrev.01/ > > -Rob From mark at p6r.com Thu Jan 21 00:40:14 2016 From: mark at p6r.com (Mark Joseph) Date: Wed, 20 Jan 2016 16:40:14 -0800 Subject: An issue with keytool and PKCS11 In-Reply-To: Message-ID: <1637855469-7235@mail.p6r.com> Can you add a -debug option and show me the full output? You can also add a -J-Djava.security.debug=all but I am not sure if the output is useful. --Max We found it useful but there is a lot of it. ? ?We also used it while walking though the code and viewing our own logs. You can see for example that it will silently select a local Sun mechanism if it cannot find one in your P11 token. Mark Joseph P6R, Inc > On Jan 12, 2016, at 9:38 AM, Mark Joseph wrote: > > Hi, > > ? ?We are a PKCS#11 vendor and we are in the process of integrating our C library with keytool and jarsigner. ? > > We are executing the following comand line. ? > > keytool ?-keystore NONE -storetype PKCS11 -storepass 12345678 -providerName SunPKCS11-P6Rtoken -providerclass sun.security.pkcs11.SunPKCS11 -providerarg E:\work\SKC_OPT_2015_2\p6r.cfg -genkeypair -keyalg RSA -keysize 2048 -alias p6rsignkey -v > > We are doing this on Windows, and we are using the latest Java keytool out of the JDK. ? > Our library is 64 bits and the Java version we have installed is 64 bits. > > Now what we are seeing is strange. ? ?The above worked one time with the key pair being generated and stored in our PKCS11 library. > > Then we reset everything and continued to do testing and the result was that keytool again created a Certificate and a Private key and placed them into our PKCS11 library. ? > > However, instead of finishing by creating the key pair by calling our PKCS11 library it just stopped and returned. ? There was no error or exception printed out. ? > > So we are stuck not knowing what is wrong? ? ?Any one seen this before or have a way we can see why the keytool is "aborting" out of running? > > > > Best, > Mark Joseph > P6R, Inc -------------- next part -------------- An HTML attachment was scrubbed... URL: From weijun.wang at oracle.com Tue Jan 26 09:56:49 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Tue, 26 Jan 2016 17:56:49 +0800 Subject: RFR 8147400: Deprecate policytool Message-ID: <6E494C87-CFBA-4468-B171-A17C10118486@oracle.com> Hi All Please review the patch below. Every change after line 873 is adding "@SuppressWarnings("deprecation")" to a top-level class that references the PolicyTool class. I wish they were static inner classes. We also planned to add "Note: The policytool tool has been deprecated since JDK 9 and is planned to be removed in the next major JDK release" to its man page inside Oracle JDK, but it's probably not good to mention JDK 9 and 10 inside openjdk source codes. Thanks Max diff --git a/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java b/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java --- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java +++ b/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java @@ -65,8 +65,11 @@ * * @see java.security.Policy * @since 1.2 + * @deprecated The policytool tool has been deprecated and + * is planned to be removed in a future release. */ + at Deprecated public class PolicyTool { // for i18n @@ -738,6 +741,8 @@ * run the PolicyTool */ public static void main(String args[]) { + System.out.println("Note: The policytool tool has been deprecated and" + + " is planned to be removed in a future release.\n"); parseArgs(args); SwingUtilities.invokeLater(new Runnable() { public void run() { @@ -873,6 +878,7 @@ * The Permission contains the (Type, Name, Action) triplet. * */ + at SuppressWarnings("deprecation") class PolicyEntry { private CodeSource codesource; @@ -1012,6 +1018,7 @@ /** * The main window for the PolicyTool */ + at SuppressWarnings("deprecation") class ToolWindow extends JFrame { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = 5682568601210376777L; @@ -1549,6 +1556,7 @@ /** * General dialog window */ + at SuppressWarnings("deprecation") class ToolDialog extends JDialog { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = -372244357011301190L; @@ -2912,6 +2920,7 @@ /** * Event handler for the PolicyTool window */ + at SuppressWarnings("deprecation") class ToolWindowListener implements WindowListener { private PolicyTool tool; @@ -2956,6 +2965,7 @@ /** * Event handler for the Policy List */ + at SuppressWarnings("deprecation") class PolicyListListener extends MouseAdapter implements ActionListener { private PolicyTool tool; @@ -2985,6 +2995,7 @@ /** * Event handler for the File Menu */ + at SuppressWarnings("deprecation") class FileMenuListener implements ActionListener { private PolicyTool tool; @@ -3083,6 +3094,7 @@ /** * Event handler for the main window buttons and Edit Menu */ + at SuppressWarnings("deprecation") class MainWindowListener implements ActionListener { private PolicyTool tool; @@ -3158,6 +3170,7 @@ * if edit is FALSE, then we are ADDing a new PolicyEntry, * so we only need to update the GUI listing. */ + at SuppressWarnings("deprecation") class AddEntryDoneButtonListener implements ActionListener { private PolicyTool tool; @@ -3224,6 +3237,7 @@ /** * Event handler for ChangeKeyStoreOKButton button */ + at SuppressWarnings("deprecation") class ChangeKeyStoreOKButtonListener implements ActionListener { private PolicyTool tool; @@ -3270,6 +3284,7 @@ /** * Event handler for AddPrinButton button */ + at SuppressWarnings("deprecation") class AddPrinButtonListener implements ActionListener { private PolicyTool tool; @@ -3295,6 +3310,7 @@ /** * Event handler for AddPermButton button */ + at SuppressWarnings("deprecation") class AddPermButtonListener implements ActionListener { private PolicyTool tool; @@ -3320,6 +3336,7 @@ /** * Event handler for AddPrinOKButton button */ + at SuppressWarnings("deprecation") class NewPolicyPrinOKButtonListener implements ActionListener { private PolicyTool tool; @@ -3383,6 +3400,7 @@ /** * Event handler for AddPermOKButton button */ + at SuppressWarnings("deprecation") class NewPolicyPermOKButtonListener implements ActionListener { private PolicyTool tool; @@ -3446,6 +3464,7 @@ /** * Event handler for RemovePrinButton button */ + at SuppressWarnings("deprecation") class RemovePrinButtonListener implements ActionListener { private PolicyTool tool; @@ -3481,6 +3500,7 @@ /** * Event handler for RemovePermButton button */ + at SuppressWarnings("deprecation") class RemovePermButtonListener implements ActionListener { private PolicyTool tool; @@ -3523,6 +3543,7 @@ * GUI listing. If the user is editing an existing PolicyEntry, we * update both the GUI listing and the actual PolicyEntry. */ + at SuppressWarnings("deprecation") class EditPrinButtonListener extends MouseAdapter implements ActionListener { private PolicyTool tool; @@ -3569,6 +3590,7 @@ * GUI listing. If the user is editing an existing PolicyEntry, we * update both the GUI listing and the actual PolicyEntry. */ + at SuppressWarnings("deprecation") class EditPermButtonListener extends MouseAdapter implements ActionListener { private PolicyTool tool; @@ -3609,6 +3631,7 @@ /** * Event handler for Principal Popup Menu */ + at SuppressWarnings("deprecation") class PrincipalTypeMenuListener implements ItemListener { private ToolDialog td; @@ -3660,6 +3683,7 @@ /** * Event handler for Permission Popup Menu */ + at SuppressWarnings("deprecation") class PermissionMenuListener implements ItemListener { private ToolDialog td; @@ -3734,6 +3758,7 @@ /** * Event handler for Permission Name Popup Menu */ + at SuppressWarnings("deprecation") class PermissionNameMenuListener implements ItemListener { private ToolDialog td; @@ -3887,6 +3912,7 @@ /** * Event handler for UserSaveYes button */ + at SuppressWarnings("deprecation") class UserSaveYesButtonListener implements ActionListener { private ToolDialog us; @@ -3941,6 +3967,7 @@ /** * Event handler for UserSaveNoButton */ + at SuppressWarnings("deprecation") class UserSaveNoButtonListener implements ActionListener { private PolicyTool tool; @@ -3989,6 +4016,7 @@ /** * Event handler for ConfirmRemovePolicyEntryOKButtonListener */ + at SuppressWarnings("deprecation") class ConfirmRemovePolicyEntryOKButtonListener implements ActionListener { private PolicyTool tool; @@ -4144,6 +4172,7 @@ } } + at SuppressWarnings("deprecation") class AuthPerm extends Perm { AuthPerm() { super(javax.security.auth.AuthPermission.class, @@ -4216,6 +4245,7 @@ } } + at SuppressWarnings("deprecation") class URLPerm extends Perm { URLPerm() { super(java.net.URLPermission.class, @@ -4380,6 +4410,7 @@ } } + at SuppressWarnings("deprecation") class RuntimePerm extends Perm { RuntimePerm() { super(java.lang.RuntimePermission.class, @@ -4420,6 +4451,7 @@ } } + at SuppressWarnings("deprecation") class SecurityPerm extends Perm { SecurityPerm() { super(java.security.SecurityPermission.class, From xuelei.fan at oracle.com Tue Jan 26 15:06:45 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Tue, 26 Jan 2016 23:06:45 +0800 Subject: RFR 8147400: Deprecate policytool In-Reply-To: <6E494C87-CFBA-4468-B171-A17C10118486@oracle.com> References: <6E494C87-CFBA-4468-B171-A17C10118486@oracle.com> Message-ID: <56A78B85.6050707@oracle.com> Looks fine to me. Xuelei On 1/26/2016 5:56 PM, Wang Weijun wrote: > Hi All > > Please review the patch below. Every change after line 873 is adding "@SuppressWarnings("deprecation")" to a top-level class that references the PolicyTool class. I wish they were static inner classes. > > We also planned to add "Note: The policytool tool has been deprecated since JDK 9 and is planned to be removed in the next major JDK release" to its man page inside Oracle JDK, but it's probably not good to mention JDK 9 and 10 inside openjdk source codes. > > Thanks > Max > > diff --git a/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java b/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java > --- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java > +++ b/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java > @@ -65,8 +65,11 @@ > * > * @see java.security.Policy > * @since 1.2 > + * @deprecated The policytool tool has been deprecated and > + * is planned to be removed in a future release. > */ > > + at Deprecated > public class PolicyTool { > > // for i18n > @@ -738,6 +741,8 @@ > * run the PolicyTool > */ > public static void main(String args[]) { > + System.out.println("Note: The policytool tool has been deprecated and" + > + " is planned to be removed in a future release.\n"); > parseArgs(args); > SwingUtilities.invokeLater(new Runnable() { > public void run() { > @@ -873,6 +878,7 @@ > * The Permission contains the (Type, Name, Action) triplet. > * > */ > + at SuppressWarnings("deprecation") > class PolicyEntry { > > private CodeSource codesource; > @@ -1012,6 +1018,7 @@ > /** > * The main window for the PolicyTool > */ > + at SuppressWarnings("deprecation") > class ToolWindow extends JFrame { > // use serialVersionUID from JDK 1.2.2 for interoperability > private static final long serialVersionUID = 5682568601210376777L; > @@ -1549,6 +1556,7 @@ > /** > * General dialog window > */ > + at SuppressWarnings("deprecation") > class ToolDialog extends JDialog { > // use serialVersionUID from JDK 1.2.2 for interoperability > private static final long serialVersionUID = -372244357011301190L; > @@ -2912,6 +2920,7 @@ > /** > * Event handler for the PolicyTool window > */ > + at SuppressWarnings("deprecation") > class ToolWindowListener implements WindowListener { > > private PolicyTool tool; > @@ -2956,6 +2965,7 @@ > /** > * Event handler for the Policy List > */ > + at SuppressWarnings("deprecation") > class PolicyListListener extends MouseAdapter implements ActionListener { > > private PolicyTool tool; > @@ -2985,6 +2995,7 @@ > /** > * Event handler for the File Menu > */ > + at SuppressWarnings("deprecation") > class FileMenuListener implements ActionListener { > > private PolicyTool tool; > @@ -3083,6 +3094,7 @@ > /** > * Event handler for the main window buttons and Edit Menu > */ > + at SuppressWarnings("deprecation") > class MainWindowListener implements ActionListener { > > private PolicyTool tool; > @@ -3158,6 +3170,7 @@ > * if edit is FALSE, then we are ADDing a new PolicyEntry, > * so we only need to update the GUI listing. > */ > + at SuppressWarnings("deprecation") > class AddEntryDoneButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3224,6 +3237,7 @@ > /** > * Event handler for ChangeKeyStoreOKButton button > */ > + at SuppressWarnings("deprecation") > class ChangeKeyStoreOKButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3270,6 +3284,7 @@ > /** > * Event handler for AddPrinButton button > */ > + at SuppressWarnings("deprecation") > class AddPrinButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3295,6 +3310,7 @@ > /** > * Event handler for AddPermButton button > */ > + at SuppressWarnings("deprecation") > class AddPermButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3320,6 +3336,7 @@ > /** > * Event handler for AddPrinOKButton button > */ > + at SuppressWarnings("deprecation") > class NewPolicyPrinOKButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3383,6 +3400,7 @@ > /** > * Event handler for AddPermOKButton button > */ > + at SuppressWarnings("deprecation") > class NewPolicyPermOKButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3446,6 +3464,7 @@ > /** > * Event handler for RemovePrinButton button > */ > + at SuppressWarnings("deprecation") > class RemovePrinButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3481,6 +3500,7 @@ > /** > * Event handler for RemovePermButton button > */ > + at SuppressWarnings("deprecation") > class RemovePermButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3523,6 +3543,7 @@ > * GUI listing. If the user is editing an existing PolicyEntry, we > * update both the GUI listing and the actual PolicyEntry. > */ > + at SuppressWarnings("deprecation") > class EditPrinButtonListener extends MouseAdapter implements ActionListener { > > private PolicyTool tool; > @@ -3569,6 +3590,7 @@ > * GUI listing. If the user is editing an existing PolicyEntry, we > * update both the GUI listing and the actual PolicyEntry. > */ > + at SuppressWarnings("deprecation") > class EditPermButtonListener extends MouseAdapter implements ActionListener { > > private PolicyTool tool; > @@ -3609,6 +3631,7 @@ > /** > * Event handler for Principal Popup Menu > */ > + at SuppressWarnings("deprecation") > class PrincipalTypeMenuListener implements ItemListener { > > private ToolDialog td; > @@ -3660,6 +3683,7 @@ > /** > * Event handler for Permission Popup Menu > */ > + at SuppressWarnings("deprecation") > class PermissionMenuListener implements ItemListener { > > private ToolDialog td; > @@ -3734,6 +3758,7 @@ > /** > * Event handler for Permission Name Popup Menu > */ > + at SuppressWarnings("deprecation") > class PermissionNameMenuListener implements ItemListener { > > private ToolDialog td; > @@ -3887,6 +3912,7 @@ > /** > * Event handler for UserSaveYes button > */ > + at SuppressWarnings("deprecation") > class UserSaveYesButtonListener implements ActionListener { > > private ToolDialog us; > @@ -3941,6 +3967,7 @@ > /** > * Event handler for UserSaveNoButton > */ > + at SuppressWarnings("deprecation") > class UserSaveNoButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3989,6 +4016,7 @@ > /** > * Event handler for ConfirmRemovePolicyEntryOKButtonListener > */ > + at SuppressWarnings("deprecation") > class ConfirmRemovePolicyEntryOKButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -4144,6 +4172,7 @@ > } > } > > + at SuppressWarnings("deprecation") > class AuthPerm extends Perm { > AuthPerm() { > super(javax.security.auth.AuthPermission.class, > @@ -4216,6 +4245,7 @@ > } > } > > + at SuppressWarnings("deprecation") > class URLPerm extends Perm { > URLPerm() { > super(java.net.URLPermission.class, > @@ -4380,6 +4410,7 @@ > } > } > > + at SuppressWarnings("deprecation") > class RuntimePerm extends Perm { > RuntimePerm() { > super(java.lang.RuntimePermission.class, > @@ -4420,6 +4451,7 @@ > } > } > > + at SuppressWarnings("deprecation") > class SecurityPerm extends Perm { > SecurityPerm() { > super(java.security.SecurityPermission.class, > From sean.mullan at oracle.com Wed Jan 27 13:30:39 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Wed, 27 Jan 2016 08:30:39 -0500 Subject: RFR 8147400: Deprecate policytool In-Reply-To: <6E494C87-CFBA-4468-B171-A17C10118486@oracle.com> References: <6E494C87-CFBA-4468-B171-A17C10118486@oracle.com> Message-ID: <56A8C67F.8060404@oracle.com> Looks good to me. --Sean On 01/26/2016 04:56 AM, Wang Weijun wrote: > Hi All > > Please review the patch below. Every change after line 873 is adding "@SuppressWarnings("deprecation")" to a top-level class that references the PolicyTool class. I wish they were static inner classes. > > We also planned to add "Note: The policytool tool has been deprecated since JDK 9 and is planned to be removed in the next major JDK release" to its man page inside Oracle JDK, but it's probably not good to mention JDK 9 and 10 inside openjdk source codes. > > Thanks > Max > > diff --git a/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java b/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java > --- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java > +++ b/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java > @@ -65,8 +65,11 @@ > * > * @see java.security.Policy > * @since 1.2 > + * @deprecated The policytool tool has been deprecated and > + * is planned to be removed in a future release. > */ > > + at Deprecated > public class PolicyTool { > > // for i18n > @@ -738,6 +741,8 @@ > * run the PolicyTool > */ > public static void main(String args[]) { > + System.out.println("Note: The policytool tool has been deprecated and" + > + " is planned to be removed in a future release.\n"); > parseArgs(args); > SwingUtilities.invokeLater(new Runnable() { > public void run() { > @@ -873,6 +878,7 @@ > * The Permission contains the (Type, Name, Action) triplet. > * > */ > + at SuppressWarnings("deprecation") > class PolicyEntry { > > private CodeSource codesource; > @@ -1012,6 +1018,7 @@ > /** > * The main window for the PolicyTool > */ > + at SuppressWarnings("deprecation") > class ToolWindow extends JFrame { > // use serialVersionUID from JDK 1.2.2 for interoperability > private static final long serialVersionUID = 5682568601210376777L; > @@ -1549,6 +1556,7 @@ > /** > * General dialog window > */ > + at SuppressWarnings("deprecation") > class ToolDialog extends JDialog { > // use serialVersionUID from JDK 1.2.2 for interoperability > private static final long serialVersionUID = -372244357011301190L; > @@ -2912,6 +2920,7 @@ > /** > * Event handler for the PolicyTool window > */ > + at SuppressWarnings("deprecation") > class ToolWindowListener implements WindowListener { > > private PolicyTool tool; > @@ -2956,6 +2965,7 @@ > /** > * Event handler for the Policy List > */ > + at SuppressWarnings("deprecation") > class PolicyListListener extends MouseAdapter implements ActionListener { > > private PolicyTool tool; > @@ -2985,6 +2995,7 @@ > /** > * Event handler for the File Menu > */ > + at SuppressWarnings("deprecation") > class FileMenuListener implements ActionListener { > > private PolicyTool tool; > @@ -3083,6 +3094,7 @@ > /** > * Event handler for the main window buttons and Edit Menu > */ > + at SuppressWarnings("deprecation") > class MainWindowListener implements ActionListener { > > private PolicyTool tool; > @@ -3158,6 +3170,7 @@ > * if edit is FALSE, then we are ADDing a new PolicyEntry, > * so we only need to update the GUI listing. > */ > + at SuppressWarnings("deprecation") > class AddEntryDoneButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3224,6 +3237,7 @@ > /** > * Event handler for ChangeKeyStoreOKButton button > */ > + at SuppressWarnings("deprecation") > class ChangeKeyStoreOKButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3270,6 +3284,7 @@ > /** > * Event handler for AddPrinButton button > */ > + at SuppressWarnings("deprecation") > class AddPrinButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3295,6 +3310,7 @@ > /** > * Event handler for AddPermButton button > */ > + at SuppressWarnings("deprecation") > class AddPermButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3320,6 +3336,7 @@ > /** > * Event handler for AddPrinOKButton button > */ > + at SuppressWarnings("deprecation") > class NewPolicyPrinOKButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3383,6 +3400,7 @@ > /** > * Event handler for AddPermOKButton button > */ > + at SuppressWarnings("deprecation") > class NewPolicyPermOKButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3446,6 +3464,7 @@ > /** > * Event handler for RemovePrinButton button > */ > + at SuppressWarnings("deprecation") > class RemovePrinButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3481,6 +3500,7 @@ > /** > * Event handler for RemovePermButton button > */ > + at SuppressWarnings("deprecation") > class RemovePermButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3523,6 +3543,7 @@ > * GUI listing. If the user is editing an existing PolicyEntry, we > * update both the GUI listing and the actual PolicyEntry. > */ > + at SuppressWarnings("deprecation") > class EditPrinButtonListener extends MouseAdapter implements ActionListener { > > private PolicyTool tool; > @@ -3569,6 +3590,7 @@ > * GUI listing. If the user is editing an existing PolicyEntry, we > * update both the GUI listing and the actual PolicyEntry. > */ > + at SuppressWarnings("deprecation") > class EditPermButtonListener extends MouseAdapter implements ActionListener { > > private PolicyTool tool; > @@ -3609,6 +3631,7 @@ > /** > * Event handler for Principal Popup Menu > */ > + at SuppressWarnings("deprecation") > class PrincipalTypeMenuListener implements ItemListener { > > private ToolDialog td; > @@ -3660,6 +3683,7 @@ > /** > * Event handler for Permission Popup Menu > */ > + at SuppressWarnings("deprecation") > class PermissionMenuListener implements ItemListener { > > private ToolDialog td; > @@ -3734,6 +3758,7 @@ > /** > * Event handler for Permission Name Popup Menu > */ > + at SuppressWarnings("deprecation") > class PermissionNameMenuListener implements ItemListener { > > private ToolDialog td; > @@ -3887,6 +3912,7 @@ > /** > * Event handler for UserSaveYes button > */ > + at SuppressWarnings("deprecation") > class UserSaveYesButtonListener implements ActionListener { > > private ToolDialog us; > @@ -3941,6 +3967,7 @@ > /** > * Event handler for UserSaveNoButton > */ > + at SuppressWarnings("deprecation") > class UserSaveNoButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -3989,6 +4016,7 @@ > /** > * Event handler for ConfirmRemovePolicyEntryOKButtonListener > */ > + at SuppressWarnings("deprecation") > class ConfirmRemovePolicyEntryOKButtonListener implements ActionListener { > > private PolicyTool tool; > @@ -4144,6 +4172,7 @@ > } > } > > + at SuppressWarnings("deprecation") > class AuthPerm extends Perm { > AuthPerm() { > super(javax.security.auth.AuthPermission.class, > @@ -4216,6 +4245,7 @@ > } > } > > + at SuppressWarnings("deprecation") > class URLPerm extends Perm { > URLPerm() { > super(java.net.URLPermission.class, > @@ -4380,6 +4410,7 @@ > } > } > > + at SuppressWarnings("deprecation") > class RuntimePerm extends Perm { > RuntimePerm() { > super(java.lang.RuntimePermission.class, > @@ -4420,6 +4451,7 @@ > } > } > > + at SuppressWarnings("deprecation") > class SecurityPerm extends Perm { > SecurityPerm() { > super(java.security.SecurityPermission.class, > From sean.coffey at oracle.com Wed Jan 27 15:09:42 2016 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Wed, 27 Jan 2016 15:09:42 +0000 Subject: RFR : 8038837:Add support to jarsigner for specifying timestamp hash algorithm Message-ID: <56A8DDB6.6040401@oracle.com> Hi, I'd like to backport this enhancement to JDK 8u. It's been approved via CCC process already. The fix differs to that in JDK 9 in that I've chosen not to update the JDK 9 deprecated ContentSignerParameters interface. That was a request from Dev engineer. For jdk8u, the tSAPolicyID value is obtained from the JarSignerParameters class. I've moved that class to its own source file. Build and tests are green. webrev : http://cr.openjdk.java.net/~coffeys/webrev.8038837.8u/webrev*/ *bug report : https://bugs.openjdk.java.net/browse/JDK-8038837 -- Regards, Sean. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ecki at zusammenkunft.net Wed Jan 27 16:43:23 2016 From: ecki at zusammenkunft.net (ecki at zusammenkunft.net) Date: Wed, 27 Jan 2016 17:43:23 +0100 Subject: SHA1 deprecation for codesigning? (Was: RFR : 8038837:Add support to jarsigner for specifying timestamp hash algorithm) In-Reply-To: <56A8DDB6.6040401@oracle.com> References: <56A8DDB6.6040401@oracle.com> Message-ID: BTW, is there any SHA1 deprecation planned/expected for JNLP code signing? -- http://bernd.eckenfels.net -----Original Message----- From: "Se?n Coffey" To: "security-dev at openjdk.java.net" Sent: Mi., 27 Jan. 2016 17:40 Subject: RFR : 8038837:Add support to jarsigner for specifying timestamp hash algorithm Hi, I'd like to backport this enhancement to JDK 8u. It's been approved via CCC process already. The fix differs to that in JDK 9 in that I've chosen not to update the JDK 9 deprecated ContentSignerParameters interface. That was a request from Dev engineer. For jdk8u, the tSAPolicyID value is obtained from the JarSignerParameters class. I've moved that class to its own source file. Build and tests are green. webrev : http://cr.openjdk.java.net/~coffeys/webrev.8038837.8u/webrev*/ *bug report : https://bugs.openjdk.java.net/browse/JDK-8038837 -- Regards, Sean. From coderaptor at gmail.com Wed Jan 27 17:23:07 2016 From: coderaptor at gmail.com (coderaptor) Date: Wed, 27 Jan 2016 09:23:07 -0800 Subject: RFC 7627 functionality (session hash and extended master secret extension) in JSSE? Message-ID: When would the TLS protocol changes as defined by RFC 7627 be committed to JSSE? So far my search has turned up nothing (no open feature request or bug on OpenJDK, nor anything in web-searches). I realize the RFC was finalized fairly recent, and the mitigation has been in JSSE for a while now. Thanks in advance. -Amarendra P.S.: My first mail to the list, and apologies if I've missed any etiquette (though I tried hard not to). From sean.mullan at oracle.com Wed Jan 27 20:22:55 2016 From: sean.mullan at oracle.com (Sean Mullan) Date: Wed, 27 Jan 2016 15:22:55 -0500 Subject: SHA1 deprecation for codesigning? (Was: RFR : 8038837:Add support to jarsigner for specifying timestamp hash algorithm) In-Reply-To: References: <56A8DDB6.6040401@oracle.com> Message-ID: <56A9271F.6080008@oracle.com> On 01/27/2016 11:43 AM, ecki at zusammenkunft.net wrote: > BTW, is there any SHA1 deprecation planned/expected for JNLP code signing? Yes. We are working on a plan for restricting certificates signed with SHA-1 and other use cases, but don't have any dates to share yet. Thanks, Sean From valerie.peng at oracle.com Thu Jan 28 02:50:07 2016 From: valerie.peng at oracle.com (Valerie Peng) Date: Wed, 27 Jan 2016 18:50:07 -0800 Subject: RFR: 8098581 SecureRandom.nextBytes() hurts performance with small size requests In-Reply-To: <565E30F7.5060307@oracle.com> References: <565E30F7.5060307@oracle.com> Message-ID: <56A981DF.4040205@oracle.com> Changes look fine except for the following nit: NativePRNG.java: mark all constants final. Thanks, Valerie On 12/1/2015 3:44 PM, Anthony Scarpino wrote: > Hi all, > > I'd like a review of this change. It improves nextBytes() performance > by allowing the random buffer to grow and shrink as random data is > needed and remove the high level synchronization. Also disable > SecureRandom for Solaris PKCS11 as it's not as fast as native. > > http://cr.openjdk.java.net/~ascarpino/8098581/webrev/ > > Thanks > > Tony From joe.darcy at oracle.com Thu Jan 28 18:37:40 2016 From: joe.darcy at oracle.com (joe darcy) Date: Thu, 28 Jan 2016 10:37:40 -0800 Subject: JDK 9 RFR of JDK-8148497: Mark SSLSocketSSLEngineTemplate.java as failing intermittently Message-ID: <56AA5FF4.9080205@oracle.com> Hello, The test javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java has been seen to fail intermittently (JDK-8049314). The test should be marked accordingly. Please review the patch below which does this. Thanks, -Joe --- a/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Sat Jan 16 10:44:40 2016 -0800 +++ b/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Thu Jan 28 10:36:49 2016 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -31,6 +31,7 @@ * @bug 7105780 * @summary Add SSLSocket client/SSLEngine server to templates directory. * @run main/othervm SSLSocketSSLEngineTemplate + * @key intermittent */ /** From xuelei.fan at oracle.com Thu Jan 28 23:45:13 2016 From: xuelei.fan at oracle.com (Xuelei Fan) Date: Fri, 29 Jan 2016 07:45:13 +0800 Subject: JDK 9 RFR of JDK-8148497: Mark SSLSocketSSLEngineTemplate.java as failing intermittently In-Reply-To: <56AA5FF4.9080205@oracle.com> References: <56AA5FF4.9080205@oracle.com> Message-ID: <56AAA809.6060502@oracle.com> Looks fine to me. Thanks! Xuelei On 1/29/2016 2:37 AM, joe darcy wrote: > Hello, > > The test > > javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java > > has been seen to fail intermittently (JDK-8049314). The test should be > marked accordingly. Please review the patch below which does this. > > Thanks, > > -Joe > > --- a/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Sat > Jan 16 10:44:40 2016 -0800 > +++ b/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Thu > Jan 28 10:36:49 2016 -0800 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 2011, 2016, 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 > @@ -31,6 +31,7 @@ > * @bug 7105780 > * @summary Add SSLSocket client/SSLEngine server to templates directory. > * @run main/othervm SSLSocketSSLEngineTemplate > + * @key intermittent > */ > > /** > From weijun.wang at oracle.com Fri Jan 29 11:42:20 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Fri, 29 Jan 2016 19:42:20 +0800 Subject: RFR : 8038837:Add support to jarsigner for specifying timestamp hash algorithm In-Reply-To: <56A8DDB6.6040401@oracle.com> References: <56A8DDB6.6040401@oracle.com> Message-ID: <05D2C80E-07FA-444A-BE6E-B415FA1B06EE@oracle.com> Why did you remove the JarSignerParameters class definition inside jarsigner/Main.java? Was it duplicated somewhere else? Thanks Max > On Jan 27, 2016, at 11:09 PM, Se?n Coffey wrote: > > Hi, > > I'd like to backport this enhancement to JDK 8u. It's been approved via CCC process already. > > The fix differs to that in JDK 9 in that I've chosen not to update the JDK 9 deprecated ContentSignerParameters interface. That was a request from Dev engineer. > > For jdk8u, the tSAPolicyID value is obtained from the JarSignerParameters class. I've moved that class to its own source file. Build and tests are green. > > webrev : http://cr.openjdk.java.net/~coffeys/webrev.8038837.8u/webrev/ > bug report : https://bugs.openjdk.java.net/browse/JDK-8038837 > -- > Regards, > Sean. > From sean.coffey at oracle.com Fri Jan 29 11:48:20 2016 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Fri, 29 Jan 2016 11:48:20 +0000 Subject: RFR : 8038837:Add support to jarsigner for specifying timestamp hash algorithm In-Reply-To: <05D2C80E-07FA-444A-BE6E-B415FA1B06EE@oracle.com> References: <56A8DDB6.6040401@oracle.com> <05D2C80E-07FA-444A-BE6E-B415FA1B06EE@oracle.com> Message-ID: <56AB5184.1050400@oracle.com> Since I now reference the JarSignerParameters class directly in TimestampedSigner.java, the compiler was generating a warning. I thought it might be neater to break JarSignerParameters into its own separate class. Shall I revert ? Regards, Sean. On 29/01/16 11:42, Wang Weijun wrote: > Why did you remove the JarSignerParameters class definition inside jarsigner/Main.java? Was it duplicated somewhere else? > > Thanks > Max > >> On Jan 27, 2016, at 11:09 PM, Se?n Coffey wrote: >> >> Hi, >> >> I'd like to backport this enhancement to JDK 8u. It's been approved via CCC process already. >> >> The fix differs to that in JDK 9 in that I've chosen not to update the JDK 9 deprecated ContentSignerParameters interface. That was a request from Dev engineer. >> >> For jdk8u, the tSAPolicyID value is obtained from the JarSignerParameters class. I've moved that class to its own source file. Build and tests are green. >> >> webrev : http://cr.openjdk.java.net/~coffeys/webrev.8038837.8u/webrev/ >> bug report : https://bugs.openjdk.java.net/browse/JDK-8038837 >> -- >> Regards, >> Sean. >> From weijun.wang at oracle.com Fri Jan 29 11:52:28 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Fri, 29 Jan 2016 19:52:28 +0800 Subject: RFR : 8038837:Add support to jarsigner for specifying timestamp hash algorithm In-Reply-To: <56AB5184.1050400@oracle.com> References: <56A8DDB6.6040401@oracle.com> <05D2C80E-07FA-444A-BE6E-B415FA1B06EE@oracle.com> <56AB5184.1050400@oracle.com> Message-ID: <2B987044-1C19-4A97-8517-12095005A9B6@oracle.com> > On Jan 29, 2016, at 7:48 PM, Se?n Coffey wrote: > > Since I now reference the JarSignerParameters class directly in TimestampedSigner.java, the compiler was generating a warning. I thought it might be neater to break JarSignerParameters into its own separate class. Oh, yes. > Shall I revert ? No. It's not a good practice putting 2 top level classes into one file. Was that the compiler is complaining about? Thanks Max > > Regards, > Sean. > > On 29/01/16 11:42, Wang Weijun wrote: >> Why did you remove the JarSignerParameters class definition inside jarsigner/Main.java? Was it duplicated somewhere else? >> >> Thanks >> Max >> >>> On Jan 27, 2016, at 11:09 PM, Se?n Coffey wrote: >>> >>> Hi, >>> >>> I'd like to backport this enhancement to JDK 8u. It's been approved via CCC process already. >>> >>> The fix differs to that in JDK 9 in that I've chosen not to update the JDK 9 deprecated ContentSignerParameters interface. That was a request from Dev engineer. >>> >>> For jdk8u, the tSAPolicyID value is obtained from the JarSignerParameters class. I've moved that class to its own source file. Build and tests are green. >>> >>> webrev : http://cr.openjdk.java.net/~coffeys/webrev.8038837.8u/webrev/ >>> bug report : https://bugs.openjdk.java.net/browse/JDK-8038837 >>> -- >>> Regards, >>> Sean. >>> > From sean.coffey at oracle.com Fri Jan 29 13:41:35 2016 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Fri, 29 Jan 2016 13:41:35 +0000 Subject: RFR : 8038837:Add support to jarsigner for specifying timestamp hash algorithm In-Reply-To: <2B987044-1C19-4A97-8517-12095005A9B6@oracle.com> References: <56A8DDB6.6040401@oracle.com> <05D2C80E-07FA-444A-BE6E-B415FA1B06EE@oracle.com> <56AB5184.1050400@oracle.com> <2B987044-1C19-4A97-8517-12095005A9B6@oracle.com> Message-ID: <56AB6C0F.2030907@oracle.com> On 29/01/16 11:52, Wang Weijun wrote: >> On Jan 29, 2016, at 7:48 PM, Se?n Coffey wrote: >> >> Since I now reference the JarSignerParameters class directly in TimestampedSigner.java, the compiler was generating a warning. I thought it might be neater to break JarSignerParameters into its own separate class. > Oh, yes. > >> Shall I revert ? > No. It's not a good practice putting 2 top level classes into one file. > > Was that the compiler is complaining about? Yes - compiler picks this up : /home/scoffey/ws/jdk8u-dev/jdk/src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java:137: warning: auxiliary class JarSignerParameters in /home/scoffey/ws/jdk8u-dev/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java should not be accessed from outside its own source file tSADigestAlg = ((JarSignerParameters)params).getTSADigestAlg(); ^ error: warnings found and -Werror specified regards, Sean. > > Thanks > Max > > >> Regards, >> Sean. >> >> On 29/01/16 11:42, Wang Weijun wrote: >>> Why did you remove the JarSignerParameters class definition inside jarsigner/Main.java? Was it duplicated somewhere else? >>> >>> Thanks >>> Max >>> >>>> On Jan 27, 2016, at 11:09 PM, Se?n Coffey wrote: >>>> >>>> Hi, >>>> >>>> I'd like to backport this enhancement to JDK 8u. It's been approved via CCC process already. >>>> >>>> The fix differs to that in JDK 9 in that I've chosen not to update the JDK 9 deprecated ContentSignerParameters interface. That was a request from Dev engineer. >>>> >>>> For jdk8u, the tSAPolicyID value is obtained from the JarSignerParameters class. I've moved that class to its own source file. Build and tests are green. >>>> >>>> webrev : http://cr.openjdk.java.net/~coffeys/webrev.8038837.8u/webrev/ >>>> bug report : https://bugs.openjdk.java.net/browse/JDK-8038837 >>>> -- >>>> Regards, >>>> Sean. >>>> From ivan.gerasimov at oracle.com Fri Jan 29 15:40:19 2016 From: ivan.gerasimov at oracle.com (Ivan Gerasimov) Date: Fri, 29 Jan 2016 18:40:19 +0300 Subject: RFR 8059212: Modify sun/security/smartcardio manual regression tests so that they do not just fail if no cardreader found Message-ID: <56AB87E3.5060502@oracle.com> Hello! We've got a request to modify the smartcardio-related regtests so that they'll be more convenient to use. Konstantin, could you please confirm this will work for you? BUGURL: https://bugs.openjdk.java.net/browse/JDK-8059212 WEBREV: http://cr.openjdk.java.net/~igerasim/8059212/00/webrev/ Sincerely yours, Ivan