equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1996, 2011, 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 |
206 algid.getName()); |
206 algid.getName()); |
207 if (classname == null) { |
207 if (classname == null) { |
208 throw new InstantiationException(); |
208 throw new InstantiationException(); |
209 } |
209 } |
210 |
210 |
211 Class keyClass = null; |
211 Class<?> keyClass = null; |
212 try { |
212 try { |
213 keyClass = Class.forName(classname); |
213 keyClass = Class.forName(classname); |
214 } catch (ClassNotFoundException e) { |
214 } catch (ClassNotFoundException e) { |
215 ClassLoader cl = ClassLoader.getSystemClassLoader(); |
215 ClassLoader cl = ClassLoader.getSystemClassLoader(); |
216 if (cl != null) { |
216 if (cl != null) { |
340 if (val.tag != DerValue.tag_Sequence) |
340 if (val.tag != DerValue.tag_Sequence) |
341 throw new InvalidKeyException ("invalid key format"); |
341 throw new InvalidKeyException ("invalid key format"); |
342 |
342 |
343 |
343 |
344 BigInteger version = val.data.getBigInteger(); |
344 BigInteger version = val.data.getBigInteger(); |
345 if (!version.equals(this.version)) { |
345 if (!version.equals(PKCS8Key.version)) { |
346 throw new IOException("version mismatch: (supported: " + |
346 throw new IOException("version mismatch: (supported: " + |
347 Debug.toHexString(this.version) + |
347 Debug.toHexString(PKCS8Key.version) + |
348 ", parsed: " + |
348 ", parsed: " + |
349 Debug.toHexString(version)); |
349 Debug.toHexString(version)); |
350 } |
350 } |
351 algid = AlgorithmId.parse (val.data.getDerValue ()); |
351 algid = AlgorithmId.parse (val.data.getDerValue ()); |
352 key = val.data.getOctetString (); |
352 key = val.data.getOctetString (); |