Lines 1-4
Link Here
|
1 |
// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
1 |
// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 |
// Use of this source code is governed by a BSD-style license that can be |
2 |
// Use of this source code is governed by a BSD-style license that can be |
3 |
// found in the LICENSE file. |
3 |
// found in the LICENSE file. |
4 |
|
4 |
|
Lines 128-134
bool ECPrivateKey::ImportFromEncryptedPrivateKeyInfo(
Link Here
|
128 |
SECItem encoded_epki = { |
128 |
SECItem encoded_epki = { |
129 |
siBuffer, |
129 |
siBuffer, |
130 |
const_cast<unsigned char*>(encrypted_private_key_info), |
130 |
const_cast<unsigned char*>(encrypted_private_key_info), |
131 |
encrypted_private_key_info_len |
131 |
static_cast<unsigned>(encrypted_private_key_info_len) |
132 |
}; |
132 |
}; |
133 |
SECKEYEncryptedPrivateKeyInfo epki; |
133 |
SECKEYEncryptedPrivateKeyInfo epki; |
134 |
memset(&epki, 0, sizeof(epki)); |
134 |
memset(&epki, 0, sizeof(epki)); |
Lines 150-156
bool ECPrivateKey::ImportFromEncryptedPrivateKeyInfo(
Link Here
|
150 |
SECItem password_item = { |
150 |
SECItem password_item = { |
151 |
siBuffer, |
151 |
siBuffer, |
152 |
reinterpret_cast<unsigned char*>(const_cast<char*>(password.data())), |
152 |
reinterpret_cast<unsigned char*>(const_cast<char*>(password.data())), |
153 |
password.size() |
153 |
static_cast<unsigned>(password.size()) |
154 |
}; |
154 |
}; |
155 |
|
155 |
|
156 |
rv = ImportEncryptedECPrivateKeyInfoAndReturnKey( |
156 |
rv = ImportEncryptedECPrivateKeyInfoAndReturnKey( |
Lines 185-191
bool ECPrivateKey::ExportEncryptedPrivateKey(
Link Here
|
185 |
SECItem password_item = { |
185 |
SECItem password_item = { |
186 |
siBuffer, |
186 |
siBuffer, |
187 |
reinterpret_cast<unsigned char*>(const_cast<char*>(password.data())), |
187 |
reinterpret_cast<unsigned char*>(const_cast<char*>(password.data())), |
188 |
password.size() |
188 |
static_cast<unsigned>(password.size()) |
189 |
}; |
189 |
}; |
190 |
|
190 |
|
191 |
SECKEYEncryptedPrivateKeyInfo* encrypted = PK11_ExportEncryptedPrivKeyInfo( |
191 |
SECKEYEncryptedPrivateKeyInfo* encrypted = PK11_ExportEncryptedPrivKeyInfo( |
Lines 264-270
ECPrivateKey* ECPrivateKey::CreateWithParams(bool permanent,
Link Here
|
264 |
DCHECK_LE(oid_data->oid.len, 127U); |
264 |
DCHECK_LE(oid_data->oid.len, 127U); |
265 |
std::vector<unsigned char> parameters_buf(2 + oid_data->oid.len); |
265 |
std::vector<unsigned char> parameters_buf(2 + oid_data->oid.len); |
266 |
SECKEYECParams ec_parameters = { |
266 |
SECKEYECParams ec_parameters = { |
267 |
siDEROID, ¶meters_buf[0], parameters_buf.size() |
267 |
siDEROID, ¶meters_buf[0], |
|
|
268 |
static_cast<unsigned>(parameters_buf.size()) |
268 |
}; |
269 |
}; |
269 |
|
270 |
|
270 |
ec_parameters.data[0] = SEC_ASN1_OBJECT_ID; |
271 |
ec_parameters.data[0] = SEC_ASN1_OBJECT_ID; |
Lines 300-306
ECPrivateKey* ECPrivateKey::CreateFromEncryptedPrivateKeyInfoWithParams(
Link Here
|
300 |
SECItem encoded_spki = { |
301 |
SECItem encoded_spki = { |
301 |
siBuffer, |
302 |
siBuffer, |
302 |
const_cast<unsigned char*>(&subject_public_key_info[0]), |
303 |
const_cast<unsigned char*>(&subject_public_key_info[0]), |
303 |
subject_public_key_info.size() |
304 |
static_cast<unsigned>(subject_public_key_info.size()) |
304 |
}; |
305 |
}; |
305 |
CERTSubjectPublicKeyInfo* decoded_spki = SECKEY_DecodeDERSubjectPublicKeyInfo( |
306 |
CERTSubjectPublicKeyInfo* decoded_spki = SECKEY_DecodeDERSubjectPublicKeyInfo( |
306 |
&encoded_spki); |
307 |
&encoded_spki); |