equal
deleted
inserted
replaced
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 |
34 |
34 |
35 private final CPrivateKey privateKey; |
35 private final CPrivateKey privateKey; |
36 |
36 |
37 private final CPublicKey publicKey; |
37 private final CPublicKey publicKey; |
38 |
38 |
|
39 /** |
|
40 * This method is called by native codes in security.cpp. |
|
41 */ |
39 CKeyPair(String alg, long hCryptProv, long hCryptKey, int keyLength) { |
42 CKeyPair(String alg, long hCryptProv, long hCryptKey, int keyLength) { |
40 privateKey = CPrivateKey.of(alg, hCryptProv, hCryptKey, keyLength); |
43 CKey.NativeHandles handles = new CKey.NativeHandles(hCryptProv, hCryptKey); |
41 publicKey = CPublicKey.of(alg, hCryptProv, hCryptKey, keyLength); |
44 privateKey = CPrivateKey.of(alg, handles, keyLength); |
|
45 publicKey = CPublicKey.of(alg, handles, keyLength); |
42 } |
46 } |
43 |
47 |
44 public CPrivateKey getPrivate() { |
48 public CPrivateKey getPrivate() { |
45 return privateKey; |
49 return privateKey; |
46 } |
50 } |