jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java
changeset 7043 5e2d1edeb2c7
parent 5506 202f599c92aa
child 10336 0bb1999251f8
equal deleted inserted replaced
7042:56e990297bc5 7043:5e2d1edeb2c7
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2010, 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
   137                 // mgf algid
   137                 // mgf algid
   138                 AlgorithmId val = AlgorithmId.parse(data.data.getDerValue());
   138                 AlgorithmId val = AlgorithmId.parse(data.data.getDerValue());
   139                 if (!val.getOID().equals((Object) OID_MGF1)) {
   139                 if (!val.getOID().equals((Object) OID_MGF1)) {
   140                     throw new IOException("Only MGF1 mgf is supported");
   140                     throw new IOException("Only MGF1 mgf is supported");
   141                 }
   141                 }
   142                 AlgorithmId params = AlgorithmId.parse(new DerValue(val.getEncodedParams()));
   142                 AlgorithmId params = AlgorithmId.parse(
       
   143                     new DerValue(val.getEncodedParams()));
   143                 String mgfDigestName = convertToStandardName(params.getName());
   144                 String mgfDigestName = convertToStandardName(params.getName());
   144                 if (mgfDigestName.equals("SHA-1")) {
   145                 if (mgfDigestName.equals("SHA-1")) {
   145                     mgfSpec = MGF1ParameterSpec.SHA1;
   146                     mgfSpec = MGF1ParameterSpec.SHA1;
   146                 } else if (mgfDigestName.equals("SHA-256")) {
   147                 } else if (mgfDigestName.equals("SHA-256")) {
   147                     mgfSpec = MGF1ParameterSpec.SHA256;
   148                     mgfSpec = MGF1ParameterSpec.SHA256;
   148                 } else if (mgfDigestName.equals("SHA-384")) {
   149                 } else if (mgfDigestName.equals("SHA-384")) {
   149                     mgfSpec = MGF1ParameterSpec.SHA384;
   150                     mgfSpec = MGF1ParameterSpec.SHA384;
   150                 } else if (mgfDigestName.equals("SHA-512")) {
   151                 } else if (mgfDigestName.equals("SHA-512")) {
   151                     mgfSpec = MGF1ParameterSpec.SHA512;
   152                     mgfSpec = MGF1ParameterSpec.SHA512;
   152                 } else {
   153                 } else {
   153                     throw new IOException("Unrecognized message digest algorithm");
   154                     throw new IOException(
       
   155                         "Unrecognized message digest algorithm");
   154                 }
   156                 }
   155             } else if (data.isContextSpecific((byte) 0x02)) {
   157             } else if (data.isContextSpecific((byte) 0x02)) {
   156                 // pSource algid
   158                 // pSource algid
   157                 AlgorithmId val = AlgorithmId.parse(data.data.getDerValue());
   159                 AlgorithmId val = AlgorithmId.parse(data.data.getDerValue());
   158                 if (!val.getOID().equals((Object) OID_PSpecified)) {
   160                 if (!val.getOID().equals((Object) OID_PSpecified)) {