• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 Google Inc.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.polo.encoding;
18 
19 /**
20  * Methods that must be implemented by a secret encoding scheme.
21  */
22 public interface SecretEncoder {
23 
24   /**
25    * Converts the byte representation of a secret to the appropriate string
26    * value in this encoding.
27    */
encodeToString(byte[] secretBytes)28   public String encodeToString(byte[] secretBytes);
29 
30   /**
31    * Converts the encoded value of a secret to the raw byte representation.
32    */
decodeToBytes(String encodedString)33   public byte[] decodeToBytes(String encodedString);
34 
35   /**
36    * Returns the number of symbols produced per each byte of raw input.
37    */
symbolsPerByte()38   public int symbolsPerByte();
39 
40 }
41