1 /* |
1 /* |
2 * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 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 |
35 */ |
35 */ |
36 class CPrivateKey extends CKey implements PrivateKey { |
36 class CPrivateKey extends CKey implements PrivateKey { |
37 |
37 |
38 private static final long serialVersionUID = 8113152807912338063L; |
38 private static final long serialVersionUID = 8113152807912338063L; |
39 |
39 |
40 private CPrivateKey(String alg, long hCryptProv, long hCryptKey, int keyLength) { |
40 private CPrivateKey(String alg, NativeHandles handles, int keyLength) { |
41 super(alg, hCryptProv, hCryptKey, keyLength); |
41 super(alg, handles, keyLength); |
42 } |
42 } |
43 |
43 |
44 public static CPrivateKey of(String alg, long hCryptProv, long hCryptKey, int keyLength) { |
44 // Called by native code inside security.cpp |
45 return new CPrivateKey(alg, hCryptProv, hCryptKey, keyLength); |
45 static CPrivateKey of( |
|
46 String alg, long hCryptProv, long hCryptKey, int keyLength) { |
|
47 return of(alg, new NativeHandles(hCryptProv, hCryptKey), keyLength); |
|
48 } |
|
49 |
|
50 public static CPrivateKey of(String alg, NativeHandles handles, int keyLength) { |
|
51 return new CPrivateKey(alg, handles, keyLength); |
46 } |
52 } |
47 |
53 |
48 // this key does not support encoding |
54 // this key does not support encoding |
49 public String getFormat() { |
55 public String getFormat() { |
50 return null; |
56 return null; |