Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsISupports.idl" |
michael@0 | 6 | |
michael@0 | 7 | // An opaque key object. |
michael@0 | 8 | [scriptable, uuid(4b31f4ed-9424-4710-b946-79b7e33cf3a8)] |
michael@0 | 9 | interface nsIKeyObject : nsISupports |
michael@0 | 10 | { |
michael@0 | 11 | // Key types |
michael@0 | 12 | const short SYM_KEY = 1; |
michael@0 | 13 | const short PRIVATE_KEY = 2; |
michael@0 | 14 | const short PUBLIC_KEY = 3; |
michael@0 | 15 | |
michael@0 | 16 | // Algorithm types |
michael@0 | 17 | const short RC4 = 1; |
michael@0 | 18 | const short AES_CBC = 2; |
michael@0 | 19 | const short HMAC = 257; |
michael@0 | 20 | |
michael@0 | 21 | // aAlgorithm is an algorithm type |
michael@0 | 22 | // aKey is either a PK11SymKey, SECKEYPublicKey, or a SECKEYPrivateKey. |
michael@0 | 23 | // The nsIKeyObject will take ownership of the key and be responsible |
michael@0 | 24 | // for freeing the key memory when destroyed. |
michael@0 | 25 | [noscript] void initKey(in short aAlgorithm, in voidPtr aKey); |
michael@0 | 26 | |
michael@0 | 27 | // Return a pointer to the underlying key object |
michael@0 | 28 | [noscript] voidPtr getKeyObj(); |
michael@0 | 29 | |
michael@0 | 30 | // Will return NS_ERROR_NOT_INITIALIZED if initKey hasn't been run |
michael@0 | 31 | short getType(); |
michael@0 | 32 | }; |
michael@0 | 33 | |
michael@0 | 34 | [scriptable, uuid(264eb54d-e20d-49a0-890c-1a5986ea81c4)] |
michael@0 | 35 | interface nsIKeyObjectFactory : nsISupports |
michael@0 | 36 | { |
michael@0 | 37 | nsIKeyObject lookupKeyByName(in ACString aName); |
michael@0 | 38 | |
michael@0 | 39 | nsIKeyObject unwrapKey(in short aAlgorithm, |
michael@0 | 40 | [const, array, size_is(aWrappedKeyLen)] in octet aWrappedKey, |
michael@0 | 41 | in unsigned long aWrappedKeyLen); |
michael@0 | 42 | |
michael@0 | 43 | // TODO: deriveKeyFrom* |
michael@0 | 44 | |
michael@0 | 45 | |
michael@0 | 46 | // DO NOT USE |
michael@0 | 47 | // This is not FIPS compliant and should not be used. |
michael@0 | 48 | nsIKeyObject keyFromString(in short aAlgorithm, in ACString aKey); |
michael@0 | 49 | }; |