< prev index next >

src/java.base/share/classes/java/security/spec/RSAPrivateKeySpec.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -42,22 +42,37 @@
  * @see RSAPrivateCrtKeySpec
  */
 
 public class RSAPrivateKeySpec implements KeySpec {
 
-    private BigInteger modulus;
-    private BigInteger privateExponent;
+    private final BigInteger modulus;
+    private final BigInteger privateExponent;
+    private final AlgorithmParameterSpec params;
 
     /**
      * Creates a new RSAPrivateKeySpec.
      *
      * @param modulus the modulus
      * @param privateExponent the private exponent
      */
     public RSAPrivateKeySpec(BigInteger modulus, BigInteger privateExponent) {
+        this(modulus, privateExponent, null);
+    }
+
+    /**
+     * Creates a new RSAPrivateKeySpec with additional key parameters. 
+     *
+     * @param modulus the modulus
+     * @param privateExponent the private exponent
+     * @param params the parameters associated with this key, may be null
+     * @since 11
+     */
+    public RSAPrivateKeySpec(BigInteger modulus, BigInteger privateExponent,
+            AlgorithmParameterSpec params) {
         this.modulus = modulus;
         this.privateExponent = privateExponent;
+        this.params = params;
     }
 
     /**
      * Returns the modulus.
      *

@@ -73,6 +88,17 @@
      * @return the private exponent
      */
     public BigInteger getPrivateExponent() {
         return this.privateExponent;
     }
+
+    /**
+     * Returns the parameters associated with this key, may be null if not
+     * present.
+     *
+     * @return the parameters associated with this key
+     * @since 11
+     */
+    public AlgorithmParameterSpec getParams() {
+        return this.params;
+    }
 }
< prev index next >