src/java.base/share/classes/sun/security/rsa/RSAPublicKeyImpl.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 50918 ebff24bd9302
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2019, 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
    50  * @since   1.5
    50  * @since   1.5
    51  * @author  Andreas Sterbenz
    51  * @author  Andreas Sterbenz
    52  */
    52  */
    53 public final class RSAPublicKeyImpl extends X509Key implements RSAPublicKey {
    53 public final class RSAPublicKeyImpl extends X509Key implements RSAPublicKey {
    54 
    54 
       
    55     @java.io.Serial
    55     private static final long serialVersionUID = 2644735423591199609L;
    56     private static final long serialVersionUID = 2644735423591199609L;
    56     private static final BigInteger THREE = BigInteger.valueOf(3);
    57     private static final BigInteger THREE = BigInteger.valueOf(3);
    57 
    58 
    58     private BigInteger n;       // modulus
    59     private BigInteger n;       // modulus
    59     private BigInteger e;       // public exponent
    60     private BigInteger e;       // public exponent
    60 
    61 
    61     // optional parameters associated with this RSA key
    62     // optional parameters associated with this RSA key
    62     // specified in the encoding of its AlgorithmId
    63     // specified in the encoding of its AlgorithmId
    63     // must be null for "RSA" keys.
    64     // must be null for "RSA" keys.
       
    65     @SuppressWarnings("serial") // Not statically typed as Serializable
    64     private AlgorithmParameterSpec keyParams;
    66     private AlgorithmParameterSpec keyParams;
    65 
    67 
    66     /**
    68     /**
    67      * Generate a new RSAPublicKey from the specified encoding.
    69      * Generate a new RSAPublicKey from the specified encoding.
    68      * Used by SunPKCS11 provider.
    70      * Used by SunPKCS11 provider.
   196         return "Sun " + getAlgorithm() + " public key, " + n.bitLength()
   198         return "Sun " + getAlgorithm() + " public key, " + n.bitLength()
   197                + " bits" + "\n  params: " + keyParams + "\n  modulus: " + n
   199                + " bits" + "\n  params: " + keyParams + "\n  modulus: " + n
   198                + "\n  public exponent: " + e;
   200                + "\n  public exponent: " + e;
   199     }
   201     }
   200 
   202 
       
   203     @java.io.Serial
   201     protected Object writeReplace() throws java.io.ObjectStreamException {
   204     protected Object writeReplace() throws java.io.ObjectStreamException {
   202         return new KeyRep(KeyRep.Type.PUBLIC,
   205         return new KeyRep(KeyRep.Type.PUBLIC,
   203                         getAlgorithm(),
   206                         getAlgorithm(),
   204                         getFormat(),
   207                         getFormat(),
   205                         getEncoded());
   208                         getEncoded());