| Index: content/renderer/webcrypto/webcrypto_util.h
|
| diff --git a/content/renderer/webcrypto/webcrypto_util.h b/content/renderer/webcrypto/webcrypto_util.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fd8614e9d0ea15593aa5d3264c22786230e39f30
|
| --- /dev/null
|
| +++ b/content/renderer/webcrypto/webcrypto_util.h
|
| @@ -0,0 +1,71 @@
|
| +// Copyright (c) 2013 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.
|
| +
|
| +#ifndef CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_
|
| +#define CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_
|
| +
|
| +#include <map>
|
| +#include <string>
|
| +#include <vector>
|
| +#include "base/basictypes.h"
|
| +#include "third_party/WebKit/public/platform/WebArrayBuffer.h"
|
| +#include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
|
| +
|
| +namespace content {
|
| +
|
| +// Returns a pointer to the start of |data|, or NULL if it is empty. This is a
|
| +// convenience function for getting the pointer, and should not be used beyond
|
| +// the expected lifetime of |data|.
|
| +const uint8* Start(const std::vector<uint8>& data);
|
| +
|
| +// Shrinks a WebArrayBuffer to a new size.
|
| +// TODO(eroman): This works by re-allocating a new buffer. It would be better if
|
| +// the WebArrayBuffer could just be truncated instead.
|
| +void ShrinkBuffer(WebKit::WebArrayBuffer* buffer, unsigned new_size);
|
| +
|
| +// This function decodes unpadded 'base64url' encoded data, as described in
|
| +// RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5. To do this, first
|
| +// change the incoming data to 'base64' encoding by applying the appropriate
|
| +// transformation including adding padding if required, and then call a base64
|
| +// decoder.
|
| +// In Web Crypto, this type of encoding is only used inside JWK.
|
| +bool Base64DecodeUrlSafe(const std::string& input, std::string* output);
|
| +
|
| +WebKit::WebCryptoAlgorithm GetInnerHashAlgorithm(
|
| + const WebKit::WebCryptoAlgorithm& algorithm);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateAlgorithm(WebKit::WebCryptoAlgorithmId id);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateHmacAlgorithmByDigestLen(
|
| + unsigned short digest_length_bits);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateHmacAlgorithmByHashId(
|
| + WebKit::WebCryptoAlgorithmId hash_id);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateHmacKeyGenAlgorithm(
|
| + WebKit::WebCryptoAlgorithmId hash_id,
|
| + unsigned hash_length);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateRsaEsAlgorithm();
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateRsaSsaAlgorithm(
|
| + WebKit::WebCryptoAlgorithmId hash_algorithm_id);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateRsaOaepAlgorithm(
|
| + WebKit::WebCryptoAlgorithmId hash_algorithm_id);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateAesCbcAlgorithm(const std::vector<uint8>& iv);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateAesGcmAlgorithm(
|
| + const std::vector<uint8>& iv,
|
| + const std::vector<uint8>& additional_data,
|
| + unsigned char tag_length);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateAesCbcKeyGenAlgorithm(unsigned short length);
|
| +
|
| +WebKit::WebCryptoAlgorithm CreateAesGcmKeyGenAlgorithm(unsigned short length);
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_
|
|
|