security/manager/ssl/public/nsIKeyModule.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/manager/ssl/public/nsIKeyModule.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +// An opaque key object.
    1.11 +[scriptable, uuid(4b31f4ed-9424-4710-b946-79b7e33cf3a8)]
    1.12 +interface nsIKeyObject : nsISupports
    1.13 +{
    1.14 +  // Key types
    1.15 +  const short SYM_KEY = 1;
    1.16 +  const short PRIVATE_KEY = 2;
    1.17 +  const short PUBLIC_KEY = 3;
    1.18 +
    1.19 +  // Algorithm types
    1.20 +  const short RC4 = 1;
    1.21 +  const short AES_CBC = 2;
    1.22 +  const short HMAC = 257;
    1.23 +
    1.24 +  // aAlgorithm is an algorithm type
    1.25 +  // aKey is either a PK11SymKey, SECKEYPublicKey, or a SECKEYPrivateKey.
    1.26 +  // The nsIKeyObject will take ownership of the key and be responsible
    1.27 +  // for freeing the key memory when destroyed.
    1.28 +  [noscript] void initKey(in short aAlgorithm, in voidPtr aKey);
    1.29 +
    1.30 +  // Return a pointer to the underlying key object
    1.31 +  [noscript] voidPtr getKeyObj();
    1.32 +
    1.33 +  // Will return NS_ERROR_NOT_INITIALIZED if initKey hasn't been run
    1.34 +  short getType();
    1.35 +};
    1.36 +
    1.37 +[scriptable, uuid(264eb54d-e20d-49a0-890c-1a5986ea81c4)]
    1.38 +interface nsIKeyObjectFactory : nsISupports
    1.39 +{
    1.40 +  nsIKeyObject lookupKeyByName(in ACString aName);
    1.41 +
    1.42 +  nsIKeyObject unwrapKey(in short aAlgorithm,
    1.43 +                         [const, array, size_is(aWrappedKeyLen)] in octet aWrappedKey,
    1.44 +                         in unsigned long aWrappedKeyLen);
    1.45 +
    1.46 +  // TODO: deriveKeyFrom*
    1.47 +
    1.48 +
    1.49 +  // DO NOT USE
    1.50 +  // This is not FIPS compliant and should not be used.
    1.51 +  nsIKeyObject keyFromString(in short aAlgorithm, in ACString aKey);
    1.52 +};

mercurial