< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 2001, 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 --- 1,7 ---- /* ! * 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,65 **** * @see RSAPrivateCrtKeySpec */ public class RSAPublicKeySpec implements KeySpec { ! private BigInteger modulus; ! private BigInteger publicExponent; /** * Creates a new RSAPublicKeySpec. * * @param modulus the modulus * @param publicExponent the public exponent */ public RSAPublicKeySpec(BigInteger modulus, BigInteger publicExponent) { this.modulus = modulus; this.publicExponent = publicExponent; } /** * Returns the modulus. * * @return the modulus */ --- 42,81 ---- * @see RSAPrivateCrtKeySpec */ public class RSAPublicKeySpec implements KeySpec { ! private final BigInteger modulus; ! private final BigInteger publicExponent; ! private final AlgorithmParameterSpec params; /** * Creates a new RSAPublicKeySpec. * * @param modulus the modulus * @param publicExponent the public exponent */ public RSAPublicKeySpec(BigInteger modulus, BigInteger publicExponent) { + this(modulus, publicExponent, null); + } + + /** + * Creates a new RSAPublicKeySpec with additional key parameters. + * + * @param modulus the modulus + * @param publicExponent the public exponent + * @param params the parameters associated with this key, may be null + * @since 11 + */ + public RSAPublicKeySpec(BigInteger modulus, BigInteger publicExponent, + AlgorithmParameterSpec params) { this.modulus = modulus; this.publicExponent = publicExponent; + this.params = params; } + /** * Returns the modulus. * * @return the modulus */
*** 73,78 **** --- 89,106 ---- * @return the public exponent */ public BigInteger getPublicExponent() { return this.publicExponent; } + + /** + * 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 >