equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2012, 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 |
328 // Strip leading zeroes ourselves if possible (key not sensitive). |
328 // Strip leading zeroes ourselves if possible (key not sensitive). |
329 // This should be removed once the Solaris fix is available |
329 // This should be removed once the Solaris fix is available |
330 // as here we always retrieve the CKA_VALUE even for tokens |
330 // as here we always retrieve the CKA_VALUE even for tokens |
331 // that do not have that bug. |
331 // that do not have that bug. |
332 byte[] keyBytes = key.getEncoded(); |
332 byte[] keyBytes = key.getEncoded(); |
333 byte[] newBytes = P11Util.trimZeroes(keyBytes); |
333 byte[] newBytes = KeyUtil.trimZeroes(keyBytes); |
334 if (keyBytes != newBytes) { |
334 if (keyBytes != newBytes) { |
335 key = new SecretKeySpec(newBytes, algorithm); |
335 key = new SecretKeySpec(newBytes, algorithm); |
336 } |
336 } |
337 } |
337 } |
338 return key; |
338 return key; |