Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/sun/security/rsa/pss/DefaultParamSpec.java
41153 views
1
/*
2
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
import sun.security.x509.X500Name;
25
import sun.security.x509.X509CRLImpl;
26
27
import java.security.KeyFactory;
28
import java.security.KeyPairGenerator;
29
import java.security.spec.MGF1ParameterSpec;
30
import java.security.spec.PSSParameterSpec;
31
import java.security.spec.RSAKeyGenParameterSpec;
32
import java.util.Date;
33
34
/**
35
* @test
36
* @bug 8242811
37
* @modules java.base/sun.security.x509
38
* @summary AlgorithmId::getDefaultAlgorithmParameterSpec returns incompatible
39
* PSSParameterSpec for an RSASSA-PSS key
40
*/
41
public class DefaultParamSpec {
42
public static void main(String[] args) throws Exception {
43
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSASSA-PSS");
44
KeyFactory kf = KeyFactory.getInstance("RSASSA-PSS");
45
kpg.initialize(new RSAKeyGenParameterSpec(2048,
46
RSAKeyGenParameterSpec.F4,
47
new PSSParameterSpec(
48
"SHA-384", "MGF1",
49
new MGF1ParameterSpec("SHA-384"),
50
48, PSSParameterSpec.TRAILER_FIELD_BC)));
51
52
X509CRLImpl crl = new X509CRLImpl(
53
new X500Name("CN=Issuer"), new Date(), new Date());
54
crl.sign(kpg.generateKeyPair().getPrivate(), "RSASSA-PSS");
55
}
56
}
57
58