diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 18:59:14 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 18:59:14 +0000 |
commit | fdf3cff0b9c29d8646b1d05cab64c5f38048181c (patch) | |
tree | 60169195526961729ab7da7035e2fcf503d3d742 /base/crypto/signature_creator_nss.cc | |
parent | 86b1c8261850a20461be441b824b1b27cef63b66 (diff) | |
download | chromium_src-fdf3cff0b9c29d8646b1d05cab64c5f38048181c.zip chromium_src-fdf3cff0b9c29d8646b1d05cab64c5f38048181c.tar.gz chromium_src-fdf3cff0b9c29d8646b1d05cab64c5f38048181c.tar.bz2 |
Revert "Linux (nss) implementations of RSAPrivateKey and SignatureCreator"
This reverts commit 4e0de697be80a0a91fbcceda63d3c85055f1afcc.
TBR=davemoore
Review URL: http://codereview.chromium.org/219013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/crypto/signature_creator_nss.cc')
-rw-r--r-- | base/crypto/signature_creator_nss.cc | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/base/crypto/signature_creator_nss.cc b/base/crypto/signature_creator_nss.cc deleted file mode 100644 index a6a820b..0000000 --- a/base/crypto/signature_creator_nss.cc +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/crypto/signature_creator.h" - -#include <cryptohi.h> -#include <keyhi.h> -#include <stdlib.h> - -#include "base/logging.h" -#include "base/nss_init.h" -#include "base/scoped_ptr.h" - -namespace base { - -// static -SignatureCreator* SignatureCreator::Create(RSAPrivateKey* key) { - scoped_ptr<SignatureCreator> result(new SignatureCreator); - result->key_ = key; - - result->sign_context_ = SGN_NewContext(SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION, - key->key()); - if (!result->sign_context_) { - NOTREACHED(); - return NULL; - } - - SECStatus rv = SGN_Begin(result->sign_context_); - if (rv != SECSuccess) { - NOTREACHED(); - return NULL; - } - - return result.release(); -} - -SignatureCreator::SignatureCreator() : sign_context_(NULL) { - EnsureNSSInit(); -} - -SignatureCreator::~SignatureCreator() { - if (sign_context_) { - SGN_DestroyContext(sign_context_, PR_TRUE); - sign_context_ = NULL; - } -} - -bool SignatureCreator::Update(const uint8* data_part, int data_part_len) { - SECStatus rv = SGN_Update(sign_context_, - const_cast<unsigned char*>(data_part), - data_part_len); - if (rv != SECSuccess) { - NOTREACHED(); - return false; - } - - return true; -} - -bool SignatureCreator::Final(std::vector<uint8>* signature) { - SECItem signature_item; - SECStatus rv = SGN_End(sign_context_, &signature_item); - if (rv != SECSuccess) { - NOTREACHED(); - return false; - } - signature->assign(signature_item.data, - signature_item.data + signature_item.len); - - return true; -} - -} // namespace base |