equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2013, 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 |
65 algid = RSAPrivateCrtKeyImpl.rsaId; |
65 algid = RSAPrivateCrtKeyImpl.rsaId; |
66 try { |
66 try { |
67 DerOutputStream out = new DerOutputStream(); |
67 DerOutputStream out = new DerOutputStream(); |
68 out.putInteger(n); |
68 out.putInteger(n); |
69 out.putInteger(e); |
69 out.putInteger(e); |
70 DerValue val = |
70 byte[] keyArray = |
71 new DerValue(DerValue.tag_Sequence, out.toByteArray()); |
71 new DerValue(DerValue.tag_Sequence, |
72 key = val.toByteArray(); |
72 out.toByteArray()).toByteArray(); |
|
73 setKey(new BitArray(keyArray.length*8, keyArray)); |
73 } catch (IOException exc) { |
74 } catch (IOException exc) { |
74 // should never occur |
75 // should never occur |
75 throw new InvalidKeyException(exc); |
76 throw new InvalidKeyException(exc); |
76 } |
77 } |
77 } |
78 } |
102 /** |
103 /** |
103 * Parse the key. Called by X509Key. |
104 * Parse the key. Called by X509Key. |
104 */ |
105 */ |
105 protected void parseKeyBits() throws InvalidKeyException { |
106 protected void parseKeyBits() throws InvalidKeyException { |
106 try { |
107 try { |
107 DerInputStream in = new DerInputStream(key); |
108 DerInputStream in = new DerInputStream(getKey().toByteArray()); |
108 DerValue derValue = in.getDerValue(); |
109 DerValue derValue = in.getDerValue(); |
109 if (derValue.tag != DerValue.tag_Sequence) { |
110 if (derValue.tag != DerValue.tag_Sequence) { |
110 throw new IOException("Not a SEQUENCE"); |
111 throw new IOException("Not a SEQUENCE"); |
111 } |
112 } |
112 DerInputStream data = derValue.data; |
113 DerInputStream data = derValue.data; |