src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSAPublicKey.java
branchJDK-8145252-TLS13-branch
changeset 56542 56aaa6cb3693
parent 47216 71c04702a3d5
equal deleted inserted replaced
56541:92cbbfc996f3 56542:56aaa6cb3693
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 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
    28 import java.math.BigInteger;
    28 import java.math.BigInteger;
    29 import java.security.KeyException;
    29 import java.security.KeyException;
    30 import java.security.KeyRep;
    30 import java.security.KeyRep;
    31 import java.security.ProviderException;
    31 import java.security.ProviderException;
    32 
    32 
       
    33 import sun.security.rsa.RSAUtil.KeyType;
    33 import sun.security.rsa.RSAPublicKeyImpl;
    34 import sun.security.rsa.RSAPublicKeyImpl;
    34 
    35 
    35 /**
    36 /**
    36  * The handle for an RSA public key using the Microsoft Crypto API.
    37  * The handle for an RSA public key using the Microsoft Crypto API.
    37  *
    38  *
   163     public byte[] getEncoded()
   164     public byte[] getEncoded()
   164     {
   165     {
   165         if (encoding == null) {
   166         if (encoding == null) {
   166 
   167 
   167             try {
   168             try {
   168                 encoding = new RSAPublicKeyImpl(getModulus(),
   169                 encoding = RSAPublicKeyImpl.newKey(KeyType.RSA, null,
   169                     getPublicExponent()).getEncoded();
   170                     getModulus(), getPublicExponent()).getEncoded();
   170 
   171 
   171             } catch (KeyException e) {
   172             } catch (KeyException e) {
   172                 // ignore
   173                 // ignore
   173             }
   174             }
   174         }
   175         }