src/java.base/share/classes/java/security/KeyRep.java
changeset 57950 4612a3cfb927
parent 47216 71c04702a3d5
child 58242 94bb65cb37d3
equal deleted inserted replaced
57945:e09c993ac476 57950:4612a3cfb927
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2017, 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
    55  * @since 1.5
    55  * @since 1.5
    56  */
    56  */
    57 
    57 
    58 public class KeyRep implements Serializable {
    58 public class KeyRep implements Serializable {
    59 
    59 
       
    60     @java.io.Serial
    60     private static final long serialVersionUID = -4757683898830641853L;
    61     private static final long serialVersionUID = -4757683898830641853L;
    61 
    62 
    62     /**
    63     /**
    63      * Key type.
    64      * Key type.
    64      *
    65      *
   160      * @exception ObjectStreamException if the Type/format
   161      * @exception ObjectStreamException if the Type/format
   161      *  combination is unrecognized, if the algorithm, key format, or
   162      *  combination is unrecognized, if the algorithm, key format, or
   162      *  encoded key bytes are unrecognized/invalid, of if the
   163      *  encoded key bytes are unrecognized/invalid, of if the
   163      *  resolution of the key fails for any reason
   164      *  resolution of the key fails for any reason
   164      */
   165      */
       
   166     @java.io.Serial
   165     protected Object readResolve() throws ObjectStreamException {
   167     protected Object readResolve() throws ObjectStreamException {
   166         try {
   168         try {
   167             if (type == Type.SECRET && RAW.equals(format)) {
   169             if (type == Type.SECRET && RAW.equals(format)) {
   168                 return new SecretKeySpec(encoded, algorithm);
   170                 return new SecretKeySpec(encoded, algorithm);
   169             } else if (type == Type.PUBLIC && X509.equals(format)) {
   171             } else if (type == Type.PUBLIC && X509.equals(format)) {