src/java.base/share/classes/java/security/spec/RSAPublicKeySpec.java
branchJDK-8145252-TLS13-branch
changeset 56542 56aaa6cb3693
parent 47216 71c04702a3d5
equal deleted inserted replaced
56541:92cbbfc996f3 56542:56aaa6cb3693
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    42  * @see RSAPrivateCrtKeySpec
    42  * @see RSAPrivateCrtKeySpec
    43  */
    43  */
    44 
    44 
    45 public class RSAPublicKeySpec implements KeySpec {
    45 public class RSAPublicKeySpec implements KeySpec {
    46 
    46 
    47     private BigInteger modulus;
    47     private final BigInteger modulus;
    48     private BigInteger publicExponent;
    48     private final BigInteger publicExponent;
       
    49     private final AlgorithmParameterSpec params;
    49 
    50 
    50     /**
    51     /**
    51      * Creates a new RSAPublicKeySpec.
    52      * Creates a new RSAPublicKeySpec.
    52      *
    53      *
    53      * @param modulus the modulus
    54      * @param modulus the modulus
    54      * @param publicExponent the public exponent
    55      * @param publicExponent the public exponent
    55      */
    56      */
    56     public RSAPublicKeySpec(BigInteger modulus, BigInteger publicExponent) {
    57     public RSAPublicKeySpec(BigInteger modulus, BigInteger publicExponent) {
       
    58         this(modulus, publicExponent, null);
       
    59     }
       
    60 
       
    61     /**
       
    62      * Creates a new RSAPublicKeySpec with additional key parameters.
       
    63      *
       
    64      * @param modulus the modulus
       
    65      * @param publicExponent the public exponent
       
    66      * @param params the parameters associated with this key, may be null
       
    67      * @since 11
       
    68      */
       
    69     public RSAPublicKeySpec(BigInteger modulus, BigInteger publicExponent,
       
    70             AlgorithmParameterSpec params) {
    57         this.modulus = modulus;
    71         this.modulus = modulus;
    58         this.publicExponent = publicExponent;
    72         this.publicExponent = publicExponent;
       
    73         this.params = params;
    59     }
    74     }
       
    75 
    60 
    76 
    61     /**
    77     /**
    62      * Returns the modulus.
    78      * Returns the modulus.
    63      *
    79      *
    64      * @return the modulus
    80      * @return the modulus
    73      * @return the public exponent
    89      * @return the public exponent
    74      */
    90      */
    75     public BigInteger getPublicExponent() {
    91     public BigInteger getPublicExponent() {
    76         return this.publicExponent;
    92         return this.publicExponent;
    77     }
    93     }
       
    94 
       
    95     /**
       
    96      * Returns the parameters associated with this key, may be null if not
       
    97      * present.
       
    98      *
       
    99      * @return the parameters associated with this key
       
   100      * @since 11
       
   101      */
       
   102     public AlgorithmParameterSpec getParams() {
       
   103         return this.params;
       
   104     }
       
   105 
    78 }
   106 }